start reversed y-axis at 1 for ranking graph in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

start reversed y-axis at 1 for ranking graph in line chart

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 () {/*from   ww  w. j a v  a2  s . c o  m*/
    var chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },
        yAxis: {
            min: 1,
            tickPositioner: function () {
                var positions = [],
                    tick = 2.5,
                    increment = 2.5;
                positions.push(1);
                for (tick; tick - increment <= this.dataMax; tick += increment) {
                    positions.push(tick);
                }
                return positions;
            },
            startOnTick: false,
            reversed: true
        },
        series: [{
            data: [1, 3, 3, 8, 13, 17, 18, 17, 14, 9, 3, 15]
        }]
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="width: 500px; height: 500px"></div>  
   </body>
</html>

Related Tutorials