private renderXAxis()

in src/EnhancedScatterChart.ts [2321:2381]


    private renderXAxis(
        xAxis: IAxisProperties,
        xAxisSettings: AxisSettings,
        tickLabelMargins: any,
        duration: number): void {
        // hide show x-axis heres
        if (this.shouldRenderAxis(xAxis, xAxisSettings)) {
            const axisProperties = xAxis;
            const scale: any = axisProperties.scale;
            const ticksCount: number = axisProperties.values.length;
            const format: any = (domainValue: d3.AxisDomain, value: any) => axisProperties.values[value];

            let newAxis = d3.axisBottom(scale);
            xAxis.axis = newAxis;
            this.xAxisGraphicsContext.call(newAxis.tickArguments([ticksCount]).tickFormat(format));

            xAxis.axis
                .tickSize(-this.viewportIn.height);

            if (!xAxis.willLabelsFit) {
                xAxis.axis.tickPadding(EnhancedScatterChart.DefaultAxisXTickPadding);
            }

            if (duration) {
                this.xAxisGraphicsContext
                    .transition()
                    .duration(duration)
                    .call(xAxis.axis);
            }
            else {
                this.xAxisGraphicsContext.call(xAxis.axis);
            }

            const xAxisTextNodes: Selection<any> = this.xAxisGraphicsContext.selectAll("text");
            if (xAxis.willLabelsWordBreak) {
                xAxisTextNodes.call(
                    axis.LabelLayoutStrategy.wordBreak,
                    xAxis,
                    this.bottomMarginLimit
                );
            } else {
                xAxisTextNodes.call(
                    axis.LabelLayoutStrategy.rotate,
                    this.bottomMarginLimit,
                    getTailoredTextOrDefault,
                    EnhancedScatterChart.TextProperties,
                    !xAxis.willLabelsFit,
                    this.bottomMarginLimit === tickLabelMargins.xMax,
                    xAxis,
                    this.margin,
                    this.isXScrollBarVisible || this.isYScrollBarVisible
                );
            }
            this.applyAxisColor(this.xAxisGraphicsContext, xAxisSettings);
        }
        else {
            this.xAxisGraphicsContext
                .selectAll("*")
                .remove();
        }
    }