Javascript examples for highcharts:Line Chart
datalabel per point with different format for line chart
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function () {//from w w w . j av a 2 s . co m $('#container').highcharts({ chart: { zoomType: 'xy' }, title: { text: 'Average Monthly Weather Data for Tokyo' }, subtitle: { text: 'Source: WorldClimate.com' }, xAxis: [{ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], crosshair: true }], yAxis: [{ // Primary yAxis labels: { format: '{value}?C', style: { color: Highcharts.getOptions().colors[2] } }, title: { text: 'Temperature', style: { color: Highcharts.getOptions().colors[2] } }, opposite: true }, { // Secondary yAxis gridLineWidth: 0, title: { text: 'Sea-Level Pressure', style: { color: Highcharts.getOptions().colors[1] } }, labels: { format: '{value} mb', style: { color: Highcharts.getOptions().colors[1] } }, opposite: true }], tooltip: { shared: true }, series: [{ name: 'Sea-Level Pressure', type: 'spline', yAxis: 1, data: [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7], dataLabels: { enabled: true, formatter: function() { return this.y + ' mb'; }}, dashStyle: 'shortdot', tooltip: { valueSuffix: ' mb' } }, { name: 'Temperature', type: 'spline', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6], dataLabels: { enabled: true, formatter: function() { return this.y + '?C'; }}, tooltip: { valueSuffix: ' ?C' } }] }); }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> </body> </html>