public update()

in packages/network-navigator-powerbi/src/NetworkNavigatorVisual.ts [149:180]


    public update(options: VisualUpdateOptions, vm?: any, type?: UpdateType) {
        const updateType = type !== undefined ? type : calcUpdateType(this.prevUpdateOptions, options);
        this.prevUpdateOptions = options;
        const dataView = options.dataViews && options.dataViews.length && options.dataViews[0];
        this._dataView = dataView;
        const dataViewTable = dataView && dataView.table;
        let forceReloadData = false;

        // Some settings have been updated
        if ((updateType & UpdateType.Settings) === UpdateType.Settings) {
            forceReloadData = this.loadSettingsFromPowerBI(dataView);
        }

        // The dataset has been modified, or something has happened that requires us to force reload the data
        if (((updateType & UpdateType.Data) === UpdateType.Data) || forceReloadData) {
            if (dataViewTable) {
                const filterColumn = dataView.metadata.columns.filter(n => n.roles[DATA_ROLES.filterField.name])[0];
                const newData = converter(dataView, this._internalState, filterColumn, () => this.host.createSelectionIdBuilder());
                this.myNetworkNavigator.setData(newData);
            } else {
                this.myNetworkNavigator.setData({
                    links: [],
                    nodes: [],
                });
            }
        }

        // Load the settings after we have loaded the nodes, cause otherwise
        this.loadSelectionFromPowerBI();

        this.myNetworkNavigator.redrawLabels();
    }