2012-01-20 9 views
0

私はdojoスパイダーチャートを埋めるためにjsonデータを必死に使用しようとしています。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(); 

任意のアイデア:

これは、私はちょうどそれを試してみました方法ですか?

答えて

0

私はdojo itemFileReadStoreによってそれを行うことができませんでした。なぜそれが機能していなかったのか分かりません。

私は道場xhr.get要求を行うと、データが受信したデータを参照することで、問題を解決し、[I]:

chart.addSeries("<name>", data[0], { fill: "<color>" }); 
関連する問題