Timezone in Charts (any chart) | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Timezone in Charts (any chart)
Avatar
fishmastaflex

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
1
September 15, 2015 - 12:39 am
sp_Permalink sp_Print

I'm having an issue getting the correct Timezone to display in charts that i'm embedding on other webpages. The timezone parameter doesn't seem to be changing what Thingspeak is displaying on the X axis. Here is the very simple chart I'm trying to display.
http://api.thingspeak.com/channels/52499/charts/1?timezone=Asia/Kolkata

The timezone in my account is set to Pacific Standard Time (I'm in California), but my channel and hardware is in India. For the future, I will be having multiple channels probably with different time zones. The API says this should work. https://thingspeak.com/docs/charts

I tried the offset parameter to see if it had something to do with my settings, and that is also displaying my current PST time.
http://api.thingspeak.com/channels/52499/charts/1?offset=5

I also tried changing my account settings to a different timezone (Asia/Kolkata) and that did not remedy the issue.

Avatar
ma11en
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
2
September 15, 2015 - 1:45 pm
sp_Permalink sp_Print

I am looking into this and will have something for you shortly.

Matt

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
3
September 15, 2015 - 1:46 pm
sp_Permalink sp_Print

Hi fishmastaflex,

As you mentioned, you can use the timezone parameter or the offset parameter to request for data from a field in a specific time zone. For e.g:

https://thingspeak.com/channels/52499/fields/1.json?timezone=Asia/Kolkata

However, thingspeak high-charts are designed to use the browser timezone (thereby the OS timezone) always. Therefore, even when the feed parameter for setting timezone is specified, the high-chart will always default back to using the browser timezone. Note that, changing the OS clock's timezone should lead to thingspeak high-chart display to change the timezone used for x-axis. But, changing your account setting will not affect it.

To enable charts to be displayed with fixed timezones, create a MATLAB Visualization App, read data from your channel, change the timezone and create a plot. For example:

[data, time] = thingSpeakRead(52499, 'Fields', 1, 'NumPoints', 100);
time.TimeZone = 'Asia/Kolkata';
plot(time, data);
xlabel('Time in Kolkata timezone');
title('Data displayed with Shifted timezone');

You can then embed the MATLAB plot into other webpages.

For more information on the datetime function, following this link:
http://www.mathworks.com/help/matlab/ref/datetime.html

- Adarsh

Avatar
fishmastaflex

Silver
Forum Posts: 11
sp_UserOfflineSmall Offline
4
September 15, 2015 - 3:35 pm
sp_Permalink sp_Print

Thanks Adarsh. I had a feeling I would have to use MatLab to do this and you have verified my thoughts.

Does that mean that the timezone parameter (in ThingSpeak charts) is basically useless? If it always defaults to the browser timezone, then I don't see a reason for stating it as a parameter in the API under the charts section.

Avatar
Adarsh_Murthy

Forum Posts: 59
sp_UserOfflineSmall Offline
5
September 16, 2015 - 2:31 pm
sp_Permalink sp_Print

You are right. The timezone parameter is controlling the display of timestamps for the feed data only, i.e.,

https://thingspeak.com/channels/12397/fields/1.json?timezone=Asia/Kolkata

It does not have any effect on the x-axis display in the charts though. We will add to the documentation to explain this behavior. Thanks for bringing this to our attention.

-Adarsh

Avatar
gpc

Silver
Forum Posts: 6
sp_UserOfflineSmall Offline
6
October 16, 2017 - 9:23 am
sp_Permalink sp_Print

Any updates on this?

Looks like parameter timezone still hasn't been implemented or is not functioning?

Also, regardless of the graphical display of data, how does one control the period used for the "daily" keyword for timescale/sum/average/median chart api parameters?

Avatar
gpc

Silver
Forum Posts: 6
sp_UserOfflineSmall Offline
7
November 3, 2017 - 5:30 pm
sp_Permalink sp_Print

Just bumping it to the top, still looking for answers. 

Avatar
Piez

Silver
Forum Posts: 15
sp_UserOfflineSmall Offline
8
January 3, 2018 - 10:14 am
sp_Permalink sp_Print sp_EditHistory

I've just noticed the timestamps on downloaded data are incorrect even though they are correct online when viewd in the chart itself.

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: jacktheripper125, pudderz
26 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

bbruno22

pudderz

Utkya

Poornak26

LindasHed

reddysiva

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee