Highcharts: Is it possible to show Sunburst chart

2019-08-21 05:21发布

问题:

Currently, it is observed that all series data labels when shown, overlap or only the show/hide behaviour of data labels can be achieved through the formatter function. Its observed that connectors for series data labels of leaf level nodes or the position of series data labels outside are not configurable.

Refer the following JS Fiddle: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/sunburst

dataLabels: {
        format: '{point.name}',
        filter: {
            property: 'innerArcLength',
            operator: '>',
            value: 16
        }
    }

Refer the Sunburst chart's series data labels on the following link:- http://www.dundas.com/support/blog/sunburst-charts-homerun-or-groundout

Expected behaviour is to configure the series data labels in such a way that if the arc size of a node is less than a particular value, instead of hiding the data label, show it outside the leaf level nodes of the chart, also adjust the distance of data labels and its connectors from the chart. I would like to show series data labels similar to the Sunburst chart shown in above link. Is there any way to achieve this in Highcharts Sunburst chart?

回答1:

Currently sunburst doesn't support data labels with connectors.

Share the idea of adding them to Highcharts here if you like: https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api

You can create your own connectors functionality using SVGRenderer (first check whether the label appeared or not and draw a connector if needed) or you can try to adjust the functionality implemented for pie series to your case (overwriting sunburst core functions).


API reference: https://api.highcharts.com/class-reference/Highcharts.SVGRenderer

Code reference: https://github.com/highcharts/highcharts/blob/master/js/parts/PieSeries.js

Docs reference: https://www.highcharts.com/docs/extending-highcharts/extending-highcharts