Skip to content

Commit

Permalink
Support setting timezone for charts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar committed Nov 21, 2015
1 parent fdb08bf commit b2ab84f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion django_datastream/static/datastream/js/datastream.js
Expand Up @@ -1248,6 +1248,19 @@
return self;
}

var currentTimezoneOffset = Highcharts.getOptions().global.timezoneOffset;
if (!_.isUndefined(currentTimezoneOffset) && currentTimezoneOffset !== options.timezoneOffset) {
// TODO: Make it not global.
// See: https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api/suggestions/10803462-timezone-specific-to-chart-not-global
console.warn("Redefining timezone from '" + currentTimezoneOffset + "' to '" + options.timezoneOffset + "'");
}

Highcharts.setOptions({
'global': {
'timezoneOffset': options.timezoneOffset
}
});

self.each(function (i, element) {
new StreamManager(element, options).start();
});
Expand All @@ -1257,7 +1270,9 @@

$.fn.datastream.defaults = {
'streamListUri': '/api/v1/stream/',
'streamListParams': {}
'streamListParams': {},
// Positive values are west, negative values are east of UTC, as in the ECMAScript getTimezoneOffset method.
'timezoneOffset': 0
};

})(jQuery);

0 comments on commit b2ab84f

Please sign in to comment.