y-axis range 0-100 200 300 after 1k 2k and 3k - Javascript highcharts

Javascript examples for highcharts:Chart Axis

Description

y-axis range 0-100 200 300 after 1k 2k and 3k

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 {//from   www .  j ava2 s. co  m
   min-width: 310px;
   max-width: 800px;
   height: 400px;
   margin: 0 auto
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  yAxis: {
    tickPositions: [0, 200, 500, 1000, 2000, 3000],
    labels: {
      formatter: function() {
        if (this.value < 1000) {
          return this.value
        }
        return this.value / 1000 + 'k'
      }
    }
  },
  series: [{
    data: [5, 100, 200, 300, 1000, 2500]
  }]
});

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

Related Tutorials