public update()

in src/Sunburst.ts [250:327]


    public update(options: VisualUpdateOptions): void {
        this.clear();

        if (!options
            || !options.dataViews
            || !options.dataViews[0]
            || !options.dataViews[0].matrix
            || !options.dataViews[0].matrix.rows
            || !options.dataViews[0].matrix.rows.root
            || !options.dataViews[0].matrix.rows.root.children
            || !options.dataViews[0].matrix.rows.root.children.length
            || !options.dataViews[0].matrix.columns
            || !options.dataViews[0].matrix.columns.root
            || !options.dataViews[0].matrix.columns.root.children
            || !options.dataViews[0].matrix.columns.root.children.length
        ) {
            return;
        }

        try {
            this.events && this.events.renderingStarted(options);

            this.viewport = options.viewport;

            this.settings = this.parseSettings(options.dataViews[0]);

            const formatter: IValueFormatter = valueFormatter.create({
                value: this.settings.tooltip.displayUnits,
                precision: this.settings.tooltip.precision,
                cultureSelector: this.visualHost.locale
            });

            this.data = this.convert(
                options.dataViews[0],
                this.colorPalette,
                this.colorHelper,
                this.visualHost,
                formatter
            );


            const selection = this.render(this.colorHelper);

            if (this.data) {
                this.legendData = Sunburst.createLegend(this.data, this.settings);

                this.renderLegend();
            }

            if (this.settings.legend.show) {
                this.chartWrapper.style("width", PixelConverter.toString(this.viewport.width));
                this.chartWrapper.style("height", PixelConverter.toString(this.viewport.height));
            } else {
                this.chartWrapper.attr("style", null);
            }

            if (this.interactivityService) {
                const behaviorOptions: BehaviorOptions = {
                    selection,
                    clearCatcher: this.svg,
                    interactivityService: this.interactivityService,
                    onSelect: this.onVisualSelection.bind(this),
                    dataPoints: this.data.dataPoints,
                    behavior: this.behavior
                };

                this.interactivityService.bind(behaviorOptions);

                this.behavior.renderSelection(false);
            }

            this.events && this.events.renderingFinished(options);
        }
        catch (e) {
            console.error(e);
            this.events && this.events.renderingFailed(options);
        }
    }