【问题标题】:Plotly.js setting timezone for type:"date"Plotly.js 为类型设置时区:“日期”
【发布时间】:2016-03-18 14:59:58
【问题描述】:

我正在制作一个图表来显示一段时间内的状态。所有数据均采用 unix 格式。我使用 javascript (new Date(data)).toUTCString 在我的标题中显示数据。这是用于图表的相同数据,但图表提前 1 小时运行。 Image

这是我的布局配置:

layout = {
    "showlegend": true,
    "title": new Date(min).toUTCString() + " to " + new Date(max).toUTCString(),
    "xaxis": {
        "autorange": true,
        "range": [
            min,
            max
        ],
        "title": "Time",
        "type": "date"    //if I change this to scatter, I get the unix values
    }

}
 Plotly.newPlot('graphMain', temp, layout); //temp contains the arrays

我目前居住在奥地利 (UTC+01:00)。 有人对此有想法吗?

【问题讨论】:

    标签: javascript date timezone plotly


    【解决方案1】:

    阴谋doesn't currently support timezones

    如果您需要将日期时间预先计算为本地时区或 UTC,您可能需要使用 moment.js timezone 之类的东西。或者,如果您愿意,也可以手动完成。

    【讨论】:

      猜你喜欢
      • 2016-03-26
      • 2016-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-10
      • 2020-07-08
      • 1970-01-01
      • 2020-09-15
      相关资源
      最近更新 更多