原創|使用教程|編輯:龔雪|2014-08-11 10:02:17.000|閱讀 1213 次
概述:本文整理了10個Highcharts報錯代碼,涉及Highcharts的數軸值、數據量、圖表渲染器、數據類型、數據排序、坐標軸等錯誤。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
我們在使用Highcharts的時候,常常會報錯,小編整理了10個報錯代碼供大家參考查閱。
對數軸的值不能為 0 或負數
下述情況下會發生這個錯誤:
數據量超過
This error occurs if the series.data option contains object configurations and the number of points exceeds theturboThreshold. It can be fixed by either setting the turboThreshold option to a higher value, or changing your point configurations to numbers or arrays.
圖表 div 渲染容器不存在
This error occurs if the chart.renderTo option is misconfigured so that Highcharts is unable to find the HTML element to render the chart in.
數據類型錯誤,需要的是Number類型,傳入的卻是String
This happens if you pass in a string as a data point, for example in a setup like this:
series: [{ data: ["3", "5", "1", "6"] }]
Highcharts expects the data values to be numbers. The most common reason for this is that data is parsed from CSV or from a XML source, and the implementer forgot to run parseFloat on the parsed value.
For performance reasons internal type casting is not performed, and only the first value is checked (since 2.3).
未排序的數據
This happens when you are trying to create a line series or a stock chart where the data is not sorted in ascending X order. For performance reasons, Highcharts does not sort the data, instead it is required that the implementer pre-sorts the data.
Highcharts 重復定義
This error happens the second time Highcharts or Highstock is loaded in the same page, so the Highchartsnamespace is already defined. Keep in mind that the Highcharts.Chart constructor and all features of Highcharts are included in Highstock, so if you are running Chart and StockChart in combination, you only need to load the highstock.js file.
指定的數據列類型不存在
This error happens when you are setting chart.type or series.type to a series type that isn't defined in Highcharts. A typical reason may be that your are missing the extension file where the series type is defined, for example in order to run an arearange series you need to load the highcharts-more.js file.
指定的數軸不存在
This error happens when you set a series' xAxis or yAxis property to point to an axis that does not exist.
坐標軸間隔過多
This error happens when you try to apply too many ticks to an axis, specifically when you add more ticks than the axis pixel length. In practice, it doesn't make sense to add ticks so densely that they can't be distinguished from each other. One cause of the error may be that you set a tickInterval that is too small for the data value range. In general,tickPixelInterval is a better option, as it will handle this automatically. Another case is if you try to set categories on a datetime axis, which will result in Highcharts trying to add one tick on every millisecond since 1970.
不能為長數據添加對象配置
In Highstock, if you try to add a point using the object literal configuration syntax, it works only when the number of data points is below the series' turboThreshold. Instead of the object syntax, use the Array syntax.
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn