public update()

in src/radarChart.ts [475:551]


    public update(options: VisualUpdateOptions): void {
        if (!options.dataViews || !options.dataViews[0]) {
            this.clear();
            return;
        }
        let dataView: DataView = options.dataViews[0];
        this.radarChartData = RadarChart.converter(
            dataView,
            this.colorPalette,
            this.colorHelper,
            this.visualHost,
            this.interactivityService);

        let categories: PrimitiveValue[] = [],
            series: RadarChartSeries[] = this.radarChartData.series;

        if (dataView.categorical
            && dataView.categorical.categories
            && dataView.categorical.categories[0]
            && dataView.categorical.categories[0].values
            && (series.length > 0)) {

            categories = dataView.categorical.categories[0].values;
        } else {
            this.clear();
            return;
        }
        this.viewport = {
            height: options.viewport.height > RadarChart.MinViewport.height
                ? options.viewport.height
                : RadarChart.MinViewport.height,
            width: options.viewport.width > RadarChart.MinViewport.width
                ? options.viewport.width
                : RadarChart.MinViewport.width
        };

        this.parseLegendProperties(dataView);
        this.parseLineWidth();
        this.renderLegend();
        this.updateViewport();

        this.svg.attr("height", this.viewport.height);
        this.svg.attr("width", this.viewport.width);

        this.mainGroupElement.attr(
            "transform",
            translate(this.viewport.width / 2, this.viewport.height / 2));

        let labelsFontSize: number = this.radarChartData.settings.labels.fontSize;

        this.margin.top = Math.max(RadarChart.DefaultMargin.top, labelsFontSize);
        this.margin.left = Math.max(RadarChart.DefaultMargin.left, labelsFontSize);
        this.margin.right = Math.max(RadarChart.DefaultMargin.right, labelsFontSize);
        this.margin.bottom = Math.max(RadarChart.DefaultMargin.bottom, labelsFontSize);

        let width: number = this.viewport.width - this.margin.left - this.margin.right,
            height: number = this.viewport.height - this.margin.top - this.margin.bottom;

        if ((width < RadarChart.MinViewportToRender.width) || (height < RadarChart.MinViewportToRender.height)) {
            this.clear();
            return;
        }

        this.viewportAvailable = {
            width: this.viewport.width / RadarChart.ViewportFactor,
            height: this.viewport.height / RadarChart.ViewportFactor
        };

        this.angle = RadarChart.Radians / categories.length;
        this.radius = RadarChart.SegmentFactor * RadarChart.Scale * Math.min(width, height) / 2;

        this.drawCircularSegments(categories);
        this.drawAxes(categories);

        this.createAxesLabels();
        this.drawChart(series, RadarChart.AnimationDuration);
    }