Google折线图显示错误的timeofday值 [英] Google line chart displays wrong timeofday values
本文介绍了Google折线图显示错误的timeofday值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的图表有2列'timeofday'和'number'格式。显示图表但时间值错误。如果时间是00:00(HH:mm),则显示为05:30,其中所有时间值都加上+05:30。我已经包含了时区,但这不会对值产生任何影响。请帮忙解决这个问题。我被困在这......
我的尝试:
Hello all,
I have a chart that has 2 columns with 'timeofday' and 'number' format. The chart gets displayed but the time value is wrong. If the time is 00:00 (HH:mm), it displays as 05:30 which adds +05:30 for all the time values. I have included timezone but that does not create any impact on the values. Please help how to handle this. I am stuck in this...
What I have tried:
google.charts.load('current', {'packages':['line']});//type of chart is line chart
google.charts.setOnLoadCallback(drawChart);
var dateFormatter = new google.visualization.DateFormat({formatType: 'long',timeZone: -0530 });
dateFormatter.format(data,0);
推荐答案
不知道你指的是lib,但是日期值可以是本地化的,也可以是UTC(世界时)。
我的猜测是你传递的是本地化的lib期望UTC时间的服务器时间。在进行lib调用之前尝试转换为UTC。
Not knowing the lib that you are referring to, but date values can be either localized or UTC (Universal Time).
My guess is that you are passing a Localized server time where the lib is expecting a UTC time. Try converting to UTC before making the lib call.
这篇关于Google折线图显示错误的timeofday值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文