public renderLabels()

in src/services/dataRenderService.ts [457:487]


    public renderLabels(labelsElement: Selection<any>, isHighlight: boolean) {
        let dataPoints: AsterArcDescriptor[] = isHighlight ? this.highlightedDataPoints : this.dataPoints;
        if (!this.data.hasHighlights || (this.data.hasHighlights && isHighlight)) {
            let labelRadCalc = (d: AsterDataPoint) => {
                let height: number = this.viewportRadius * (d && !isNaN(d.sliceHeight) ? d.sliceHeight : 1) / this.maxHeight + this.innerRadius;
                return Math.max(height, this.innerRadius);
            };

            let labelArc = arc<AsterArcDescriptor>()
                .innerRadius(d => labelRadCalc(d.data))
                .outerRadius(d => labelRadCalc(d.data));

            let lineRadCalc = (d: AsterDataPoint) => {
                let height: number = (this.viewportRadius - this.innerRadius) * (d && !isNaN(d.sliceHeight) ? d.sliceHeight : 1) / this.maxHeight;
                height = this.innerRadius + height * DataRenderService.AsterRadiusRatio;
                return Math.max(height, this.innerRadius);
            };
            let outlineArc = arc<AsterArcDescriptor>()
                .innerRadius(d => lineRadCalc(d.data))
                .outerRadius(d => lineRadCalc(d.data));

            let labelLayout: ILabelLayout = this.getLabelLayout(labelArc, this.layout.viewport);
            this.drawLabels(
                dataPoints.filter(x => !isHighlight || x.data.sliceHeight !== null),
                labelsElement,
                labelLayout,
                this.layout.viewport,
                outlineArc,
                labelArc);
        }
    }