Created
November 5, 2013 09:26
-
-
Save j0nes2k/7316272 to your computer and use it in GitHub Desktop.
Highcharts currently does not support setting different timezones. One workaround was to send data in local time and tell Highcharts to treat these timestamps as UTC timezones. Another solution is to send the data in UTC timezone and use a different xAxis formatter to adjust the timezone difference.
This is just a starting point for others facin…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xAxis: { | |
type: 'datetime', | |
labels: { | |
align: 'center', | |
y: 15, | |
formatter: function(){ | |
var datetime = moment.utc(this.value); | |
var utcOffset = 0; | |
// utcOffset should be set globally to whatever timezone you want to show | |
if (self.options.utcOffset) { | |
utcOffset = self.options.utcOffset * 60; | |
} | |
if (utcOffset > 0) { | |
datetime = datetime.add('minutes', Math.abs(utcOffset)); | |
} | |
else { | |
datetime = datetime.subtract('minutes', utcOffset); | |
} | |
return datetime.format('H:mm'); | |
} | |
}, | |
plotLines: [] | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment