I am making use of highcharts-ng
in my AngularJS
application, and was wondering if one could filter data making use of the dataLabels formatter function
?
I would like to display a {point.name}
and {point.value}
only when there is a {point.value}
.
I have tried the function below (and some variations), but this does not seem to work:
dataLabels: {
enabled: true,
formatter: function () {
if ('{point.value}') {
return '{point.name} {point.value}'
}
}
}
The solution is quite simple.
I changed my code as follows:
dataLabels: {
formatter: function () {
if (this.point.value) {
return [this.point.name, this.point.value];
}
}
}
My question answered on the Highcharts forum: