Reputation: 129
As mentioned in the title, Highcharts displays the next month instead of the correct month that I want to be shown.
<script>
$(function () {
Highcharts.setOptions({
global: {
//timezoneOffset: 3.30 * 60
}
});
$('#container').highcharts({
xAxis: {
type: 'datetime',
tickInterval: 3600 * 1000,
min: Date.UTC(2016,02,20),
max: Date.UTC(2016,02,21),
},
series: [{
data: [
[Date.UTC(2016, 02, 20,0,45), 1],
[Date.UTC(2016, 02, 20,12,15), 3],
[Date.UTC(2016, 02, 20,14,30), 6],
[Date.UTC(2016, 02, 20,15,45), 9],
[Date.UTC(2016, 02, 20,17,45), 5],
],
pointStart: Date.UTC(2016, 02, 20),
pointInterval: 3600 *1000
}]
});
});
</script>
<div id="container"></div>
So as per the code I provide I want it to display Feb in xAxis but it jumps to March instead.
How can I fix this to display the month that I want?
Does Highcharts use the user timezone? How can I display a fixed timezone and avoid using user timezone?
https://jsfiddle.net/v4kasmv1/
Upvotes: 4
Views: 1532
Reputation: 194
Just edit 02 to 01 for Feb min: Date.UTC(2016,01,20)
as 00 for Jan, 01 for Feb and 02 for March:
$(function () {
Highcharts.setOptions({
global: {
//timezoneOffset: 3.30 * 60
}
});
$('#container').highcharts({
xAxis: {
type: 'datetime',
tickInterval: 3600 * 1000,
min: Date.UTC(2016,01,20),
max: Date.UTC(2016,01,21),
},
series: [{
data: [
[Date.UTC(2016, 01, 20,0,45), 1],
[Date.UTC(2016, 01, 20,12,15), 3],
[Date.UTC(2016, 01, 20,14,30), 6],
[Date.UTC(2016, 01, 20,15,45), 9],
[Date.UTC(2016, 01, 20,17,45), 5],
],
pointStart: Date.UTC(2016, 01, 20),
pointInterval: 3600 *1000
}]
});
});
Upvotes: 5