show()

in packages/powerbi/src/visual.ts [235:311]


    show(dataView: powerbiVisualsApi.DataView) {
        this.settings = Visual.parseSettings(dataView);
        const oldData = this.app.getDataContent();
        const temp = convertTableToObjectArray(dataView.table, oldData, this.host);
        const { data } = temp;
        let { different } = temp;
        if (!this.prevSettings) {
            different = true;
        }

        this.app.setChromeless(!this.settings.sandDanceMainSettings.showchrome);
        this.app.changeTheme(this.settings.sandDanceMainSettings.darktheme);

        const wasSignalChange = this.persistAction.signalChange;
        this.persistAction = {};

        this.prevSettings = util.clone(this.settings);

        if (!different || wasSignalChange) {
            // console.log('Visual update - not different');
            return;
        }

        const { sandDanceConfig } = this.settings;

        let snapshots: SandDance.types.Snapshot[] = [];
        if (sandDanceConfig.snapshotsJSON) {
            try {
                snapshots = JSON.parse(sandDanceConfig.snapshotsJSON);
            } catch (e) {
                // continue regardless of error
            }
        }

        let tooltipExclusions: string[] = [];
        if (sandDanceConfig.tooltipExclusionsJSON) {
            try {
                tooltipExclusions = JSON.parse(sandDanceConfig.tooltipExclusionsJSON);
            } catch (e) {
                // continue regardless of error
            }
        }

        this.app.load(
            data,
            columns => {
                if (!columns) return;

                // remove column which contains powerbi selectionId
                for (let i = 0; i < columns.length; i++) {
                    if (SandDance.util.isInternalFieldName(columns[i].name)) {
                        columns.splice(i, 1);
                        i--;
                    }
                }

                let insight: Partial<SandDance.specs.Insight>;

                if (sandDanceConfig.insightJSON) {
                    try {
                        insight = JSON.parse(sandDanceConfig.insightJSON);
                        delete insight.size;
                    } catch (e) {
                        // continue regardless of error
                    }
                }

                if (this.filters) {
                    insight.filter = this.filters.sd;
                }

                return insight;
            },
            snapshots,
            tooltipExclusions);

    }