问题描述
我有一个web应用程序,有很多功能齐全的Highchart图表。
我试图在图表中实现Highstock,但它直接在Highstock文件中给我一个萤火虫错误:
this.labelBBox未定义Highstock.js第30行
我的所有库都是最新版本(与在线演示版本完全相同)
我无法弄清楚为什么我有这个错误,在这里是我的代码:
$ $ p $ function generateChart10(id,dataChart,currency){
//创建图表
chart = new Highcharts.StockChart({
图表:{
renderTo:id,
marginLeft:15,
borderColor:'#FFFFFF'
},
rangeSelector:{
启用:false
},
导航器:{
启用:false
},
滚动条:{
启用:false
},
标题:{
text:''
},
系列:[{
type:'烛台',
名称:货币,
数据:dataChart
}]
});
}
我的dataChart有这个值:
有谁知道为什么我有这个错误?
谢谢!
问题在于时间戳顺序相反(从新到旧)。
所以我只是颠倒了数组 dataChart
并且修正了它!
I have a web application, with tons of fully functional Highchart graphs.
I am trying to implement Highstock in a graph, but it is giving me a firebug error directly in the Highstock file:
this.labelBBox is undefined line 30 of Highstock.js
All my libraries are up to date (exactly the same as the demo versions online)
I cannot figure out why I am having this error, here is my code:
function generateChart10(id, dataChart, currencies){
// create the chart
chart = new Highcharts.StockChart({
chart : {
renderTo : id,
marginLeft: 15,
borderColor: '#FFFFFF'
},
rangeSelector : {
enabled: false
},
navigator : {
enabled: false
},
scrollbar : {
enabled: false
},
title : {
text : ''
},
series : [{
type : 'candlestick',
name : currencies,
data : dataChart
}]
});
}
My dataChart has this value:
[[1336507200000,0.9996,1.0063,0.9989,1.0022],[1336420800000,0.9924,1.0022,0.9924,0.9996],[1336334400000,0.9981,0.9986,0.9921,0.9926],[1336075200000,0.9879,0.9963,0.9861,0.9956],[1335988800000,0.9867,0.9892,0.9828,0.9879],[1335902400000,0.9856,0.9903,0.9849,0.9867],[1335816000000,0.9877,0.9897,0.9832,0.9857],[1335729600000,0.981,0.9894,0.9804,0.9877],[1335470400000,0.9858,0.987,0.98,0.9801],[1335384000000,0.9826,0.9865,0.9805,0.9858]]
Would anyone know why I am having this error ?
Thank you!
The problem was just that the order of the timestamps were in reverse (new to old).So I just reversed the array dataChart
and that fixed it!
这篇关于Highstock图表错误:this.labelBBox未定义第30行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!