-
-
Save nilsrunde/14ea8da9708778ecae6143a5e8bb5ba9 to your computer and use it in GitHub Desktop.
highcharts - show label for first and last data points in a series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plotOptions: { | |
line : { | |
dataLabels : { | |
enabled : true, | |
formatter: function() { | |
var first = this.series.data[0], | |
last = this.series.data[this.series.data.length - 1]; | |
if ((this.point.category === first.category && this.point.y === first.y) || | |
(this.point.category === last.category && this.point.y === last.y)) { | |
return this.point.y; | |
} | |
return ""; | |
} | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment