public init()

in src/WordCloud.ts [820:868]


    public init(options: VisualConstructorOptions): void {
        this.root = d3.select(options.element).append("svg");
        this.eventService = options.host.eventService;
        this.tooltipService = createTooltipServiceWrapper(
            options.host.tooltipService,
            options.element);

        this.colorPalette = options.host.colorPalette;
        this.visualHost = options.host;

        this.valueSelectionManager = new ValueSelectionManager<string>(
            this.visualHost,
            (text: string): ISelectionId[] => {
                const dataPoints: WordCloudDataPoint[] = this.data
                    && this.data.dataPoints
                    && this.data.dataPoints.filter((dataPoint: WordCloudDataPoint) => {
                        return dataPoint.text === text;
                    });

                return dataPoints && dataPoints[0] && dataPoints[0].selectionIds
                    ? dataPoints[0].selectionIds
                    : [];
            },
            () => {
                return this.data.dataPoints;
            },
            this.renderSelection.bind(this)
        );

        this.layout = new VisualLayout(null, WordCloud.DefaultMargin);

        this.root
            .classed(WordCloud.ClassName, true)
            .on("click", () => {
                this.clearSelection();
            });

        this.fontFamily = this.root.style("font-family");

        this.main = this.root.append("g");

        this.wordsContainerSelection = this.main
            .append("g")
            .classed(WordCloud.Words.className, true);

        // init canvas context for calculate label positions
        const canvas = document.createElement("canvas");
        this.canvasContext = this.getCanvasContext(canvas);
    }