Highstock 图表在某些缩放级别上显示点而不是线

发布于 2024-12-22 09:52:05 字数 426 浏览 0 评论 0原文

我正在使用 Highcharts Stock 图表来显示相对于时间的百分比。

http://jsfiddle.net/michaelchart/yYmPR/1/

在某些缩放级别(在在这种情况下,当时间跨度放大到大约 6 到 12 年之间时,情节会奇怪地从一条线变成零星的点。

关于为什么会这样的任何想法吗?或者这是 Highstock 的一个错误?

您可以在此处查看工作 Highstock 图表的示例 http://www.highcharts.com/股票/演示/基本线

I am using a Highcharts Stock graph to show a percentage with respect to time.

http://jsfiddle.net/michaelchart/yYmPR/1/

At certain zoom levels (in this case, when zooming to a timespan of between about 6 and 12 years) the plot strangely turns from a line to sporadic points.

Any ideas as to why this might be? Or is it a bug with Highstock?

You can see an example of a working Highstock graph here http://www.highcharts.com/stock/demo/basic-line.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烟凡古楼 2024-12-29 09:52:05

在 Highstock 论坛上发帖并随后在 github 上发布问题后,我发现这是由于 gapSize 选项的默认值造成的。根据文档

间隙大小:数字
定义何时在图表中显示间隙。间隙大小为 5 意味着如果两点之间的距离大于两个最近点的距离的五倍,则图形将被破坏。

实际上,此选项最常用于可视化时间序列中的间隙。在股票图表中,日间数据在白天可用,而缺口将在夜间和周末出现。

默认为 5。

gapSize 设置为 null 可以解决问题

After posting on the Highstock forum and consequently having an issue posted on github, I found that it was because of the default value of the gapSize option. According to the docs;

gapSize : Number
Defines when to display a gap in the graph. A gap size of 5 means that if the distance between two points is greater than five times that of the two closest points, the graph will be broken.

In practice, this option is most often used to visualize gaps in time series. In a stock chart, intraday data is available for daytime hours, while gaps will appear in nights and weekends.

Defaults to 5.

Setting gapSize to null fixes the problem.

涙—继续流 2024-12-29 09:52:05

在我的特定情况下,这个问题的原因是数据输出错误。
在“series”属性中,“data”数组中有一个“false”值。

示例:

series : {
   "type":"column",
   "name":"Test",
   "data":[541,784,false,251,353]
}

更正了后端的问题,因此“false”被解释为 0,现在一切正常。

In my particular case, the reason of this problem was bad data output.
Within "series" property, within the "data" array there was a "false" value.

Example:

series : {
   "type":"column",
   "name":"Test",
   "data":[541,784,false,251,353]
}

Corrected the problem in the backend so "false" was interpreted as 0, and everything works now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文