amCharts日期和时间格式无法正常工作

问题描述 投票:0回答:1

我正在设置amCharts,以便用户可以跟踪资产的价格。资产价格每天都在变化,图表应反映出来。

在这里使用官方文档:https://amcharts.zendesk.com/hc/en-us/articles/203002512-Formatting-dates-on-category-axis

我正在使用日期格式:

"dataDateFormat": "YYYY-MM-DD, JJ:NN:SS"

这是我的样本数据:enter image description here

这就是amChart提出的不正确之处。 enter image description here

我不确定我的日期格式有什么问题。我似乎可以使用的唯一格式是"YYYY-MM-DD",但不允许更改第二种格式。我究竟做错了什么?

javascript amcharts
1个回答
0
投票

您需要将类别轴minPeriod设置为与数据点之间的最小间隔对应,以便正确呈现它们。默认情况下,它设置为DD(1天),因此您需要将其更改为ss几秒钟才能正确显示数据集。例如:

AmCharts.makeChart("...", {
  // ...
  categoryAxis: {
    // ...
    minPeriod: "ss",
    // ...
  },
  // ...
});
© www.soinside.com 2019 - 2024. All rights reserved.