我想做一个派DataChart与联想使用JSON文件我的js代码如下所示
var store = new dojo.data.ItemFileWriteStore(
{ url:dojo.moduleUrl("dojox.charting", "file.json")
});
makeObjects = function(){
var chart1 = new dojox.charting.DataChart("test11111111", {
type: dojox.charting.plot2d.Pie, // <-- chart type. Can be used Pie
scroll:false,
stretchToFit:true
});
var c = dojo.connect(chart1, "onData", function(){
dojo.disconnect(c);
new dojox.charting.widget.Legend({chart:chart1}, "legendPie");
});
chart1.setStore(store2, {legend:"*"}, "ss_series");
chart1.render();JSON文件如下所示
{ "items": [
{ "ss_series":[10126, 9803, 15965, 17290, 15667, 17762],
"legend":["Rome", "Paris", "Madrid", "Berlin", "London", "Dublin"]}
]}问题是,图例还显示了饼的百分比,而不是图例值,有人能帮我吗?谢谢
发布于 2014-01-23 19:06:34
将您的数据重新格式化为:
"ss_series": [{y: 10126, legend: "Rome"}, {y: 9803, legend: "Paris"} , ... ] 这应该能起作用吗?
https://stackoverflow.com/questions/21286380
复制相似问题