数据从后端正常传输,我可以在java脚本中使用alert查看数据。但无法在高图表(条形图)的数据部分动态设置数据。
var cwk = "${myFormpage.cweek}";
var cwk2 = "${myFormpage.cweek2}";
var cwk3 = "${myFormpage.cweek3}";
var series = [{
name: 'This week',
color: '#ed7717',
data: [11000, 12000, 17000]
}, {
name: '4 week ago',
color: '#bd0066',
data: [11000, 12000, 17000]
}, {
name: '52 week back',
color: '#691e7d',
data: [10000, 11000, 14000]
}
];
上面的代码片段工作正常。但是,如果我像
那样动态添加数据data: [cwk,cwk2,cwk3]
图表未创建。请帮助我如何在没有ajax调用的情况下添加动态数据。
答案 0 :(得分:0)
根据我在代码中看到的内容,您似乎将值转换为字符串:
var cwk = "${myFormpage.cweek}";
var cwk2 = "${myFormpage.cweek2}";
var cwk3 = "${myFormpage.cweek3}";
更改为:
var cwk = ${myFormpage.cweek};
var cwk2 = ${myFormpage.cweek2};
var cwk3 = ${myFormpage.cweek3};
它应该有用......