Formatting Highchart dateime time categories

121 views Asked by At

Can someone please tell me how do I specify format for categories in following code. Why my xAxis categories in milliseconds are getting converted to "1970-01-01 00:00:00"

here is the link to my Fiddler

var chart = new Highcharts.Chart({

    chart: {
        renderTo: 'container'
    },

    title: {
        text: 'Categorized chart'
    },

    xAxis: {
        categories: [1496275200000,1498867200000,1501545600000,1504224000000],
        type : 'datetime'
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]

});

$('#preview').html(chart.getCSV());
1

There are 1 answers

1
Deep 3015 On

Take idea from official example

Your code will be like

xAxis: {
    //categories: [1496275200000,1498867200000,1501545600000,1504224000000],
    type : 'datetime'
},

series: [{
    data: [[1496275200000,29.9],[1498867200000,71.5],[1501545600000,106.4] , [1504224000000,129.2]]
}]

Fiddle Demo