创建过滤要显示的数据的Highcharts数据标签格式化程序

时间:2016-10-18 05:13:23

标签: javascript angularjs highcharts highcharts-ng

我正在highcharts-ng应用中使用AngularJS,并想知道是否可以过滤使用dataLabels formatter function的数据?

我希望仅在{point.name}时显示{point.value}{point.value}

我已尝试过以下功能(以及一些变体),但这似乎不起作用:

dataLabels: {
    enabled: true,
    formatter: function () {
        if ('{point.value}') {
            return '{point.name} {point.value}'
        }
    }
}

1 个答案:

答案 0 :(得分:0)

解决方案非常简单。

我更改了我的代码如下:

dataLabels: { 
    formatter: function () {
        if (this.point.value) {
            return [this.point.name, this.point.value];
        }
    }
}

我在Highcharts论坛上回答了我的问题:

http://forum.highcharts.com/post128864.html#p128864

相关问题