Handling unix timestamp with highcharts

You are right, timestamps in Javascript are milliseconds so you should multiply everything by 1000.

For the other problem it comes from the fact that your data is ordered backwards. Apparently HighCharts is messing up when the series are not properly ordered.

Here's the correction for your code: http://jsfiddle.net/cvedovini/RjPRd/2/


An easy way to work with timestamp (milliseconds) in Highcharts is use the formatter. So first receive your time values as unix timestamp and then set one of the features below in the chart:

Using in xAxis labels:

xAxis:[{
  labels:{
     formatter:function(){
         return Highcharts.dateFormat('%Y %M %d',this.value);
     }
  }
}]

Using in tooltip:

tooltip: {
    readerFormat: {
        formatter: function(){
         return Highcharts.dateFormat('%Y %M %d',this.value);
     }
  },
    pointFormat: '{point.y} ms',
    shared: true
},

An exemple of code with tooltip

A reference about formatter