show a custom message box at last point - Javascript highcharts

Javascript examples for highcharts:Chart Box

Description

show a custom message box at last point

Demo Code

ResultView the demo in separate window

<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 () {// ww w .j  av a 2s. c  om
    // create the chart
    $('#container').highcharts({
        chart: {
            events: {
                load: function () {
                    var chart = this,
                        series = this.series,
                        len, lastPoint;
                    $.each(series, function (i, s) {
                        if (s.options.showLabel) {
                            len = s.data.length - 1;
                            lastPoint = s.data[len];
                            chart.renderer.text('Label', lastPoint.plotX + chart.plotLeft, lastPoint.plotY + chart.plotTop)
                                .css({
                                color: '#4572A7'
                            })
                                .add();
                        }
                    });
                }
            }
        },
        series: [{
            data: [1, 2, 3, 4, 2, 2, 3, 2, 1, 1]
        }, {
            showLabel: true,
            data: [5, 4, 3, 2, 3]
        }]
    });
});

      </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="height: 500px; min-width: 310px"></div>  
   </body>
</html>

Related Tutorials