2
votes

If i create a chart with datetime datalabels on X axis and the month of the dates are not january, the ticks show with wrong alignments and shows wrong values.

http://jsfiddle.net/FWjLw/

$(function () {
$('#container').highcharts({
    chart: {
        type: "column"
    },
    xAxis: {
        type: 'datetime',
        minTickInterval: 24 * 60 * 60 * 1000 * 30
    },
    series: [{
        pointInterval: 24 * 60 * 60 * 1000 * 30,
        data: [
            //with month = 0 works well
            //[Date.UTC(2010, 0, 1), 29.9],
            //[Date.UTC(2011, 0, 1), 176.0],
            //[Date.UTC(2012, 0, 1), 176.0]
            [Date.UTC(2010, 11, 1), 29.9],
            [Date.UTC(2011, 11, 1), 176.0],
            [Date.UTC(2012, 11, 1), 176.0]
         ]
    }]
});
});
1

1 Answers

3
votes

1) You need to set pointRange

2) Months are indexed from 0, not 1, so January - 0

3) You can customise labels by formatter and dateFormat or setting dateTimeLabelFormats