【问题标题】:JSON format for dojo/dojox spider chartdojo/dojox 蜘蛛图的 JSON 格式
【发布时间】:2012-01-20 11:55:56
【问题描述】:

我正在拼命尝试使用 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();

有什么想法吗?

【问题讨论】:

    标签: json dojox.grid dojox.charting dojo


    【解决方案1】:

    好的,我无法通过 dojo itemFileReadStore 完成...不知道为什么它不起作用。

    我通过执行 dojo xhr.get 请求并通过 data[i] 引用接收到的数据解决了这个问题:

    chart.addSeries("<name>", data[0], { fill: "<color>" });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 2017-09-11
      相关资源
      最近更新 更多