晚安, 希望你能帮助我,我使用highcharts在我的网站上做一些图表,一切都很好,直到最后一张图表,出于某种原因,而不是写出正确的值,因为它得到了[对象]对象],我在jsfidle上尝试了相同的代码并且没问题。
$(function () {
var chart = new Highcharts.Chart({
"xAxis":{"categories":[{"name":1,
"categories":["a","b","c"]},{"name":2,"categories":["a","b","c"]},{"name":3,"categories":["a","b","c"]},{"name":4,"categories":["a","b","c"]},{"name":5,"categories":["a","b","c"]},{"name":6,"categories":["a","b","c"]},{"name":7,"categories":["a","b","c"]},{"name":8,"categories":["a","b","c"]},{"name":9,"categories":["a","b","c"]},{"name":10,"categories":["a","b","c"]}]},
"series":[{"data":[0,0,0,0,0,0,0,0,0,0,0,0,3,2,1,7,7,0,21,11,4,23,23,5,33,30,0],"name":"Forecast","color":"#124191","stack":"male"},{"data":[0,0,0,0,0,0,0,0,0,0,0,0,3,2,1,7,7,0,21,11,4,21,22,5,21,22,0],"name":"Actual","color":"#00C9FF","stack":"female"}],
"chart":{"type":"column",
"renderTo":"container",
"zoomType":"xy",
"marginTop":"100",
"marginBottom":"100",
"columnColor":["#509be6","#124191","#90ed7d","#f7a35c","#8085e9","#f15c80","#e4d354","#8085e8","#8d4653","#91e8e1"]},
"title":{"text":"Tests"},
"yAxis":{"allowDecimals":false,"min":0,"title":{"text":"Total"}},"plotOptions":{"column":{"stacking":"normal"}},"legend":{"style":"text-align:center","width":"270"},"credits":{"enabled":false}});
});
我使用的是最新版本的Highcharts和Jquery 1.8.2,
提前致谢,
答案 0 :(得分:2)
根据documentation类别,接受字符串数组作为参数。您正在传递对象数组,因此它正在显示[object object]
。
如果您需要,可以plugin用于组类别。