在钻取或钻取后没有显示的highcharts sunburst数据标签

时间:2017-10-27 10:55:37

标签: javascript highcharts drilldown sunburst-diagram

highcharts sunburst图表非常棒,但在向下钻取或钻取后它并没有显示dataLabels

这是股票示例:http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/sunburst/

请注意,一旦您向下钻取大陆或区域,数据标签就会消失。我注意到github提交中有一个注释,这是可以修复的吗? https://github.com/highcharts/highcharts/commit/3ffa39287f4b713517200d7c0b1d498c392c4fba

我可以通过更改数据源(使用setData)重新显示它们,但这应该会自动发生。我试过chart.redraw,以及event.drilldown但没有欢乐

series: [{
    type: "sunburst",
    data: data,
    allowDrillToNode: true,
    cursor: 'pointer',
    dataLabels: {
        /**
         * A custom formatter that returns the name only if the inner arc
         * is longer than a certain pixel size, so the shape has place for
         * the label.
         */
        formatter: function () {
            var shape = this.point.node.shapeArgs;

            var innerArcFraction = (shape.end - shape.start) / (2 * Math.PI);
            var perimeter = 2 * Math.PI * shape.innerR;

            var innerArcPixels = innerArcFraction * perimeter;

            if (innerArcPixels > 16) {
                return this.point.name;
            }
        }
  }]

0 个答案:

没有答案