问题描述
- HighChart 怎麼綁定json數據
-
我後台生成的Json
{"DT":
[
{"Name":"Name1","Chinese":"43","Math":"2","English":"34"},
{"Name":"Name2","Chinese":"33","Math":"93","English":"20"},
{"Name":"Name3","Chinese":"5","Math":"54","English":"41"},
{"Name":"Name4","Chinese":"86","Math":"36","English":"37"}
]
}
怎麼去前台綁定數據啊。生成的圖如下
解决方案
先 把json 转换成js 对象遍历 js对象 中的数组, 拼成 [{data:[x,x,x,x]}] 的格式的series对象 后再options.series = series; 把配置项 放入new Highcharts.Chart(options); 中即可
时间: 2024-10-27 18:11:09