Hide dataLabels when value = 0 (optionally check if minPointLength is also 0)
My stacked bars show dataLabels even though the bar itself is hidden, because it has a value of 0
0 is also a value, so this behaviour is by design. If however the value is null, the data label should go away. If you want to treat 0 as null, you can return null from the data label formatter.
-
Thanks, it's fixed. See http://jsfiddle.net/highcharts/Lu2FD/
-
Sjon commented
Okay, I found the bug, but cannot find a bug-tracker so I'll just post it here:
drawDataLabels contains this line:
if (isBarLike && series.options.stacking) {
this should be changed to:
if (isBarLike && series.options.stacking && dataLabel) {
-
Sjon commented
@Torstein, I have tried null as a value, but then the entire graph isn't rendered. Also, I couldn't find out how to specify a custom dataformatter?
Anyway, after looking into what goes wrong with null, it seems I found a bug; drawDataLabels throws an Uncaught TypeError which I will debug and report