How to display UTC data as local time with DST in an outsystems chart?

How to display UTC data as local time with DST in an outsystems chart?

  

I am building a chart, that displays timeseries data in a 15 minutes resolution. I am working in the cloud environment, with all data stored in UTC. So the timeseries data source is also captured in UTC.

On the client side I want to display the data in a chart, which displays the local time. Obviously i also want to display the extra DST hour during the day that the clock shifts. I think that there are two approaches to do this:


approach 1: provide all timeseries data to higcharts in UTC and use highcharts to convert to local time in some way

approach 2: server side conversion to the local timezone. and let highcharts just display the data


I tried approach #2, but ran into the issue that the hour from 2:00 - 3:00 was not displayed in the chart.



By default highcharts assumes that the timestamps on the X-axis must be delivered in UTC. I also found that outsystems creates datapoints with some UTC tag:    {x:Date.UTC(2016,9,30,11,15,0) , y:50},


According to the highcharts documentation, I need to change a global setting. but i have not been able to fix this myself, via the highchartsjson_init action:



Highcharts.setOptions({

    global: {

        useUTC: true

    }

});


until now i fixed this with an extremely ugly workaround, forcing the labels as text, in stead of as time, but this leads to all kind of other issues such as a display of way too many labels, and not making use of the built in time functions of highcharts on the x-axis.



my questions are


- is my approach #2 the best approach? or would you recommend a better one?

- how can I set the 'useUTC' global highcharts option? is that the best solution?





see attached OML for a very simple example

Hello Rogier,

I believe you'll want to set useUTC to false. According to the documentation, that's the value you'll want to show local times (default is true). I wanted to test this, but since my timezone is UTC, I couldn't... 

Regarding the disappearing hours, that happens because Oct 30 2016 is the date that daylight savings ends! This means you have repeated values for the same time, and highcharts only shows the latest value.

Cheers,
R