constructor()

in src/radarChart.ts [422:473]


    constructor(options: VisualConstructorOptions) {
        const element: HTMLElement = options.element;

        this.colorPalette = options.host.colorPalette;
        this.colorHelper = new ColorHelper(this.colorPalette);

        if (!this.svg) {
            this.svg = d3.select(element).append("svg");
            this.svg.style("position", "absolute");
        }

        if (!this.margin) {
            this.margin = _.clone(RadarChart.DefaultMargin);
        }

        this.svg.classed(RadarChart.VisualClassName, true);

        this.visualHost = options.host;
        this.interactivityService = createInteractivityService(this.visualHost);
        this.behavior = new RadarChartWebBehavior();

        this.tooltipServiceWrapper = createTooltipServiceWrapper(
            options.host.tooltipService,
            options.element);

        const interactiveBehavior: IInteractiveBehavior = this.colorHelper.isHighContrast ? new OpacityLegendBehavior() : null;
        this.legend = createLegend(
            element,
            false,
            this.interactivityService,
            true,
            LegendPosition.Top,
            interactiveBehavior);

        this.mainGroupElement = this.svg.append("g");

        this.mainGroupElement
            .append("g")
            .classed(RadarChart.LabelGraphicsContextSelector.className, true);

        this.mainGroupElement
            .append("g")
            .classed(RadarChart.SegmentsSelector.className, true);

        this.mainGroupElement
            .append("g")
            .classed(RadarChart.AxisSelector.className, true);

        this.chart = this.mainGroupElement
            .append("g")
            .classed(RadarChart.ChartSelector.className, true);
    }