Highcharts: Dates Off By 1 Month -
i'm not sure what's going on, dates being displayed on axis , in tooltips month out. first date in data on chart in july shows in august , on. ideas? i've put code in jsfiddle (http://jsfiddle.net/z2vgl/1/) , below:
$(function () { $('#container').highcharts({ chart: { type: 'spline' }, title: { text: '' }, plotoptions: { series: { linewidth: 5, marker: { fillcolor: '#ffffff', linewidth: 2, radius: 6, linecolor: null // inherit series } } }, subtitle: { text: '' }, xaxis: { type: 'datetime', datetimelabelformats: { // don't display dummy year month: '%e %b', year: '%b' } }, yaxis: { title: { text: 'ability score (out of 100)', style: { color: '#323a45', fontweight: 'bold' } }, min: 0 }, tooltip: { formatter: function () { return '<b>' + this.series.name + '</b><br/>' + highcharts.dateformat('%e %b', this.x) + ': ' + this.y; } }, series: [{ name: 'overall ability', // define data points. series have dummy year // of 1970/71 in order compared on same x axis. note // in javascript, months start @ 0 january, 1 february etc. data: [ [date.utc(2013, 07, 12), 50], [date.utc(2013, 08, 13), 57.9474605576], [date.utc(2013, 08, 14), 58.5667571154], [date.utc(2013, 08, 15), 69.0590308869], ] }, { name: 'target', data: [ [date.utc(2013, 07, 12), 80], [date.utc(2013, 08, 13), 80], [date.utc(2013, 08, 14), 80], [date.utc(2013, 08, 15), 80], /* [date.utc(2013, 0, 1), 80.0], [date.utc(2013, 1, 1), 80.0], [date.utc(2013, 2, 1), 80.0], [date.utc(2013, 3, 1), 80.0], [date.utc(2013, 4, 1), 80.0], [date.utc(2013, 5, 1), 80.0], [date.utc(2013, 6, 1), 80.0], [date.utc(2013, 7, 1), 80.0] */
], dashstyle: 'longdash', marker: { enabled: false } }]
});
});
thanks in advance.
as can see doc: mozilla js reference date utc
month integer between 0 , 11 representing month.
Comments
Post a Comment