Use A different suffix for each line - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

Use A different suffix for each line

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

#container {/* w  w  w  .ja  v a2  s .  c  o m*/
   min-width: 310px;
   max-width: 800px;
   height: 400px;
   margin: 0 auto
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
Highcharts.stockChart('container', {
    tooltip: {
        formatter: function() {
            var points = this.points,
                title,
                result = '';
            Highcharts.each(points, function(p) {
                result += p.y;
                title = p.series.yAxis.axisTitle.textStr;
                if (title === 'yAxis1') {
                    result += 'suffix1<br>'
                } else if (title === 'yAxis1') {
                    result += 'suffix2<br>'
                } else {
                    result += 'suffix2<br>'
                }
            });
            return result
        }
    },
    series: [{
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9],
        yAxis: 0
    }, {
        data: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
        yAxis: 1
    }, {
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9].reverse(),
        yAxis: 2
    }],
    yAxis: [{
        title: {
            text: 'yAxis1'
        }
    }, {
        title: {
            text: 'yAxis2'
        }
    }, {
        title: {
            text: 'yAxis3'
        }
    }]
});

      </script>  
   </body>
</html>

Related Tutorials