return the right month of a datetime when using Date.UTC conversion - Javascript highcharts

Javascript examples for highcharts:Chart Configuration

Description

return the right month of a datetime when using Date.UTC conversion

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {/*  ww w  .  j a va  2s  .  co  m*/
    Highcharts.setOptions({
        global: {
            useUTC: false
        }
    });
    $('#container').highcharts({
        xAxis: {
            type: 'datetime'
        },
        series: [{
            data: [
                [Date.parse('2015-05-05 00:03:08'), 0],
                [Date.parse('2015-05-05 01:19:34'), -2],
                [Date.parse('2015-05-05 02:44:16'), 0],
                [Date.parse('2015-05-05 03:18:19'), 0],
                [Date.parse('2015-05-05 04:24:06'), 0],
                [Date.parse('2015-05-05 05:12:44'), 0],
                [Date.parse('2015-05-05 06:55:08'), 0],
                [Date.parse('2015-05-05 07:26:08'), 0],
                [Date.parse('2015-05-05 08:32:05'), 1],
                [Date.parse('2015-05-05 09:34:50'), 2],
                [Date.parse('2015-05-05 10:42:16'), 3],
                [Date.parse('2015-05-05 11:16:03'), 3],
                [Date.parse('2015-05-05 12:27:07'), 1],
                [Date.parse('2015-05-05 13:22:08'), 1],
                [Date.parse('2015-05-05 14:18:51'), 3],
                [Date.parse('2015-05-05 15:06:27'), -1],
                [Date.parse('2015-05-05 16:40:00'), 2],
                [Date.parse('2015-05-05 17:30:24'), 1],
                [Date.parse('2015-05-05 18:36:24'), 0],
                [Date.parse('2015-05-05 19:43:57'), 0],
                [Date.parse('2015-05-05 20:32:41'), 0],
                [Date.parse('2015-05-05 21:28:29'), 0],
                [Date.parse('2015-05-05 22:37:14'), 0],
                [Date.parse('2015-05-05 23:53:14'), 0], ],
        }]
    });
});

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

Related Tutorials