private renderElements()

in packages/timebrush/src/TimeBrush.ts [347:377]


    private renderElements() {
        const margin = { top: 0, bottom: 20, left: 20, right: 20 };

        // Renders the rest of the elements within the chart (minus the y axis)
        const renderRest = () => {
            // Important that these two occur here, cause the margin gets tweaked by renderYAxis
            const width = this._dimensions.width - margin.left - margin.right;
            const height = this._dimensions.height - margin.top - margin.bottom;

            // adjust the x range to account for y axis labels
            const xmin = (this.showYAxis && this.yAxisPosition === AxisPosition.Left) ? margin.left : 0;
            const xmax: any = (this.showYAxis && this.yAxisPosition === AxisPosition.Right) ? width - margin.right : width;
            this.x.range([xmin, xmax]);


            this.renderValueBars(height);
            this.renderValueBarGradients();
            this.undoPBIScale(width, height, margin);
            this.renderXAxis(height);
            this.renderYOrigin(xmin, xmax);
            this.renderBrush(height);
            this.renderLegend();
        };

        this.renderYAxis(margin);

        // Call the rest of the rendering after the y axis has had some time to render, after the text has been rendered
        this.yAxis.call(() => {
            renderRest();
        });
    }