0

I'm following the instructions here to create a plot with irregular time data. However, as you can see in this Fiddle, the dates in the x-axis are displaying as 00:00:00.001, 00:00:00.002, etc.

$("#chart").highcharts({
    xAxis: {
        type: "datetime",
    },
    area: {
        visible: true
    },
    series: [{
        data: [
            [new Date(1411014072), 1],
            [new Date(1412742072), 2],
            [new Date(1413606072), 3]
        ]
    }]
});

Any ideas how to fix this?

David Jones
  • 10,117
  • 28
  • 91
  • 139

1 Answers1

3

First value in data must be UTC date

you are converting to datetime format Try following code:

$("#chart").highcharts({
    xAxis: {
        type: "datetime",
    },
    area: {
        visible: true
    },
    series: [{
        data: [
            [1411014072*1000, 1],
            [1412742072*1000, 2],
            [1413606072*1000, 3]
        ]
    }]
});
undefined_variable
  • 6,180
  • 2
  • 22
  • 37
  • 1
    Thanks! I also had to multiply the timestamp values by 1000. – David Jones Sep 28 '14 at 15:32
  • @Undefined_variable: Please help me on [my question here](http://stackoverflow.com/questions/27983248/need-help-in-plotting-a-chart-using-highcharts-in-angularjs) – AabinGunz Jan 17 '15 at 19:05