0

ZK Charts Timezone problem

asked 2014-11-14 07:13:32 +0800

M4tt gravatar image M4tt
39 5

Hi,

I got some problems when using ZK Chart (1.3 now), one thing is that I never got the timezone right. I'm in GMT+8 timezone, and my time series chart always draws the point at 18:00pm (which should be at 0:00). So I tried to set the timezone right to solve the problem, but what i tried were all in vain.

image description

Here are what I did.

Set up chart options.

 Options options = new Options();
 Global global = new Global();
 global.setTimezoneOffset(8);
 options.setGlobal(global);
 chart.setOptions(options);

I tried to use this code at chart onCreate phase and ViewModel afterCompose phase and none of them was working. API Doc says there was a Charts.setOption(options) method, but I can't find it.

Then I tried to set up the org.zkoss.web.preferred.timeZone attribute in zk.xml, and of course it's not working.

It's hard to find any relevant example on the demo application or to search a valid solution. (ZK chart is really easy to confused with the old chart library for keyword search.)

So I come here and ask for help. Thank you.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-26 07:48:32 +0800

M4tt gravatar image M4tt
39 5

I found the solution myself.

The reason why this code won't work is because the UTC time is still enabled. Here is the code that would work.

Options options = new Options();
Global global = new Global();
global.setTimezoneOffset(8);
global.setUseUTC(false);
options.setGlobal(global);
chart.setOptions(options);
link publish delete flag offensive edit

Comments

Thanks for your post! I just came across the same damn issue.

bztom35 ( 2021-06-10 12:46:54 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-11-14 07:13:32 +0800

Seen: 8 times

Last updated: Dec 26 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More