我想在Devexpress图表中使用JSON删除数据,ı已经获取数据, 但是json不考虑函数x()
$(document).ready(function () {
function x(dataSource){
$("#container").dxChart({
dataSource: dataSource,
series: {
argumentField: "day",
valueField: "oranges",
name: "My oranges",
type: "bar",
color: '#ffa500'
}
});
}
$.getJSON("data/simpleJSON.json", function (dataSource) {
x(dataSource);
});
});
SIMPLE JSON :
[{
day: "Monday",
oranges: 3
}, {
day: "Tuesday",
oranges: 2
}, {
day: "Wednesday",
oranges: 3
}, {
day: "Thursday",
oranges: 4
}, {
day: "Friday",
oranges: 6
}, {
day: "Saturday",
oranges: 11
}, {
day: "Sunday",
oranges: 4
}]
<div id="container"></div>
答案 0 :(得分:0)
我发现了我的错误,JS元素必须用引号(“...”)。
SIMPLE JSON:
[{ “天”:“星期一”, “橘子”:3 },{ “天”:“星期二”, “橘子”:2 },{ “天”:“星期三”, “橘子”:3 },{ “天”:“星期四”, “橘子”:4 },{ “天”:“星期五”, “橘子”:6 },{ “天”:“星期六”, “橘子”:11 },{ “天”:“星期天”, “橘子”:4 }]