0
我拼命地嘗試使用json數據來填充我的dojo蜘蛛圖。dojo/dojox蜘蛛圖的JSON格式
首先:我需要先將我的商店(從ItemFileReadStore檢索到)先傳遞給dojox.charting.DataSeries,然後才能將其用於我的蜘蛛圖?
那麼,json需要怎樣的樣子?
這是我剛試過的方式:
var data = {"identifier":"id","items":[
{"id": "1", "data": {"GDP": 2,"area": 6,"population": 2000,"inflation": 15,"growth": 12}},
{"id": "2", "data": {"GDP": 6,"area": 15,"population": 500,"inflation": 5,"growth": 6}},
{"id": "3", "data": {"GDP": 10,"area": 10,"population": 800,"inflation": 2,"growth": 18}}
]
};
var fileStore = new dojo.data.ItemFileWriteStore({data: data});
var store1 = new dojox.charting.DataSeries(fileStore, {query: {id:"1"}}, "data");
var store2 = new dojox.charting.DataSeries(fileStore, {query: {id:"2"}}, "data");
var store3 = new dojox.charting.DataSeries(fileStore, {query: {id:"3"}}, "data");
chart1.addSeries("USA", store1, { fill: "green" });
chart1.addSeries("Japan", store2, { fill: "yellow" });
chart1.addSeries("Korean", store3, { fill: "orange" });
chart1.render();
任何想法?