HighCharts: strange error from creation of stock c

2019-08-17 18:36发布

问题:

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]]

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

回答1:

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/



回答2:

i have the same problem, but in mi case I have a file named jquery.resize.js, this was the error, because it search the property for your purpose, i remove the link to the file and it works nice.

I hope it helps!

Kind regards.