HighCharts:创建股票图表时出现奇怪的错误 [英] HighCharts: strange error from creation of stock chart

查看:81
本文介绍了HighCharts:创建股票图表时出现奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的股票图表,例如

I'm trying to create a simple Stock Chart, like this but it throws this error in console:

Uncaught TypeError: Cannot read property 'width' of undefined
Tick.getLabelSideshighstock.src.js:5338
Tick.handleOverflowhighstock.src.js:5360
Tick.renderhighstock.src.js:5573
(anonymous function)highstock.src.js:7491
eachhighstock.src.js:1021
Axis.renderhighstock.src.js:7473
Chart.render.chart.seriesGroup.renderer.g.attr.zIndexhighstock.src.js:10529
eachhighstock.src.js:1021
Chart.renderhighstock.src.js:10528
Chart.firstRenderhighstock.src.js:10729
Chart.inithighstock.src.js:10813
Charthighstock.src.js:9399
Highcharts.StockChart

为什么? 我以为问题出在不正确的数据(或时间戳中日期的错误转换),但数据似乎是正确的.这是我正在使用的数据:

Why? I was thinking that the problem is from incorrect data (or bad conversions of date in timestamp), but the data seems to be correct. Here's the data I'm using:

[[1343833881,1],[1343833879,-1],[1343833876,0],[1343833007,0],[1343833003,0],
 [1343833000,-1],[1343832993,-1],[1343832993,1],[1343497396,0],[1343497340,0.5],
 [1343497330,-1],[1343497316,-0.5]]

如果您在上面链接的JSFiddle高库存示例中尝试此数据,您将发现它无效.

If you try this data in the JSFiddle example of high stock linked above you will see that it doesn't work.

推荐答案

您的时间值按降序排列,而严格按照升序排列, 在此处找到具有相同数据的图表,只需正确排序即可, http://jsfiddle.net/jugal/Swj3E/

Your time values are in descending order, whereas they need to be strictly in ascending order, find here chart with same data, just ordered correctly, http://jsfiddle.net/jugal/Swj3E/

这篇关于HighCharts:创建股票图表时出现奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆