Search code examples
graphhighchartspie-chart

Highchart connector custom style


I want to create doughnut chart using highcharts like below: enter image description here

Please help me to create. Thanks in advance.


Solution

  • By using attr method you can set stroke-dasharray property for connectors:

    chart: {
        ...,
        events: {
            load: function() {
                var points = this.series[0].points;
    
                points.forEach(function(p) {
                    p.connector.attr({
                        'stroke-dasharray': "4, 4"
                    });
                });
            }
        }
    }
    

    Live demo: https://jsfiddle.net/BlackLabel/boxhv0yt/

    API Reference: https://api.highcharts.com/class-reference/Highcharts.SeriesPieDataLabelsOptionsObject#connectorShape

    Docs: https://www.highcharts.com/docs/advanced-chart-features/pie-datalabels-alignment