configureLabels() {
        this.label
            .attr("class", "lgv-label")
            .attr("data-arc-value", d => d.value)
            .attr("data-small-arc", d => (d.endAngle - d.startAngle) < 0.3 ? "true" : "false")
            .attr("transform", d => `translate(${this.labelArcs.centroid(d)[0]}, ${this.labelArcs.centroid(d)[1] + 4})`)
            .attr("text-anchor", d => {

                let isOnLeftDial = d.endAngle > Math.PI && d.startAngle > Math.PI;
                let isCentered = d.startAngle < Math.PI && d.endAngle > Math.PI && d.startAngle > (Math.PI / 2);

                return isOnLeftDial ? "start" : (isCentered ? "middle" : "end");

            })
            .each((d, i, nodes) => {
                select(nodes[i])
                    .selectAll("tspan")
                    .data([d.data.label.length > 11 ? `${d.data.label.slice(0,11)}...` : d.data.label, `${Math.round(d.data.value)}%`])
                    .enter()
                    .append("tspan")
                    .text(x => x)
                    .attr("x", 0)
                    .attr("dy", (x, j) => j == 0 ? "-0.4em" : "1em")
            });
    }
/**
     * Position and minimally style labels in SVG dom element.
     */
Position and minimally style labels in SVG dom element.
Position and minimally style labels in SVG dom element .
configureLabels() {
        this.label
            .attr("class", "lgv-label")
            .attr("data-arc-value", d => d.value)
            .attr("data-small-arc", d => (d.endAngle - d.startAngle) < 0.3 ? "true" : "false")
            .attr("transform", d => `translate(${this.labelArcs.centroid(d)[0]}, ${this.labelArcs.centroid(d)[1] + 4})`)
            .attr("text-anchor", d => {
                let isOnLeftDial = d.endAngle > Math.PI && d.startAngle > Math.PI;
                let isCentered = d.startAngle < Math.PI && d.endAngle > Math.PI && d.startAngle > (Math.PI / 2);
                return isOnLeftDial ? "start" : (isCentered ? "middle" : "end");
            })
            .each((d, i, nodes) => {
                select(nodes[i])
                    .selectAll("tspan")
                    .data([d.data.label.length > 11 ? `${d.data.label.slice(0,11)}...` : d.data.label, `${Math.round(d.data.value)}%`])
                    .enter()
                    .append("tspan")
                    .text(x => x)
                    .attr("x", 0)
                    .attr("dy", (x, j) => j == 0 ? "-0.4em" : "1em")
            });
    }
configureLabels ( ) { this . label . attr ( "class" , "lgv-label" ) . attr ( "data-arc-value" , d => d . value ) . attr ( "data-small-arc" , d => ( d . endAngle - d . startAngle ) < 0.3 ? "true" : "false" ) . attr ( "transform" , d => ` ${ this . labelArcs . centroid ( d ) [ 0 ] } ${ this . labelArcs . centroid ( d ) [ 1 ] + 4 } ` ) . attr ( "text-anchor" , d => { let isOnLeftDial = d . endAngle > Math . PI && d . startAngle > Math . PI ; let isCentered = d . startAngle < Math . PI && d . endAngle > Math . PI && d . startAngle > ( Math . PI / 2 ) ; return isOnLeftDial ? "start" : ( isCentered ? "middle" : "end" ) ; } ) . each ( ( d , i , nodes ) => { select ( nodes [ i ] ) . selectAll ( "tspan" ) . data ( [ d . data . label . length > 11 ? ` ${ d . data . label . slice ( 0 , 11 ) } ` : d . data . label , ` ${ Math . round ( d . data . value ) } ` ] ) . enter ( ) . append ( "tspan" ) . text ( x => x ) . attr ( "x" , 0 ) . attr ( "dy" , ( x , j ) => j == 0 ? "-0.4em" : "1em" ) } ) ; }
Position and minimally style labels in SVG dom element.
Position and minimally style labels in SVG dom element .