display monthly data in chart? - Javascript highcharts

Javascript examples for highcharts:Chart Data

Description

display monthly data in chart?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>info: time </title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
      <style id="compiled-css" type="text/css">

#container {//from ww  w  . ja v  a 2 s .c o m
   min-width: 1024px;
   max-width: 1024px;
   height: 300px;
   margin: 1em auto;
}


      </style> 
      <script type="text/javascript">
    $(function(){
  var xArr = [1455661712000,
    1455661791000,
    1455661869000,
    1455661947000,
  ];
var yArr=[14, 13, 14];
var dataArr=[];
for (i=0;i<yArr.length;i++)
{
   dataArr.push([xArr[i], yArr[i]]);
}
  $('#container').highcharts({
    xAxis: {
      type: 'datetime',
      labels: {
        formatter: function() {
          return Highcharts.dateFormat('%Y %M %d', this.value);
        }
      }
    },
    series: [{
      data: dataArr
    }]
  });
    });

      </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"></div>  
   </body>
</html>

Related Tutorials