private shiftIntersectText()

in src/radarChart.ts [697:725]


    private shiftIntersectText(current: RadarChartLabel, others: RadarChartLabel[], shiftDown: boolean): void {
        let labelSettings: LabelSettings = this.radarChartData.settings.labels;

        let properties: TextProperties = {
            fontFamily: RadarChart.AxesLabelsFontFamily,
            fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
            text: this.radarChartData.labels.formatter.format(current.text)
        };

        let currentTextHeight: number = textMeasurementService.estimateSvgTextHeight(properties);

        for (let i: number = 0; i < others.length; i++) {
            let label: RadarChartLabel = others[i];

            properties.text = label.text;
            let otherTextHeight: number = textMeasurementService.estimateSvgTextHeight(properties);

            let curTextUpperPoint: number = current.y - currentTextHeight;
            let labelTextUpperPoint: number = label.y - otherTextHeight;

            if (RadarChart.isIntersect(current.y, curTextUpperPoint, label.y, labelTextUpperPoint)) {
                let shift: number = this.shiftText(current.y, curTextUpperPoint, label.y, labelTextUpperPoint, shiftDown);
                current.y += shift;
                if (!shiftDown && current.y - 5 < 0 || shiftDown && current.y + currentTextHeight / 2 + 5 > 0) {
                    current.hide = true;
                }
            }
        }
    }