我努力用dojo获得一些功能图表......
我想用 3 条线创建一个堆积面积图。对于您在 JSON 数据中看到的“bas”、“moy”和“haut”。
var jStore = {"identifier":"mois",
"items":[{"mois":1, "bas":98, "moy":122.5, "haut":147},
{"mois":2, "bas":91, "moy":113.75, "haut":136.5},
{"mois":3, "bas":91, "moy":113.75, "haut":136.5},
{"mois":4, "bas":84, "moy":105, "haut":126},
{"mois":5, "bas":77, "moy":96.25, "haut":115.5},
{"mois":6, "bas":63, "moy":78.75, "haut":94.5},
{"mois":7, "bas":49, "moy":61.25, "haut":73.5},
{"mois":8, "bas":42, "moy":52.5, "haut":63},
{"mois":9, "bas":49, "moy":61.25, "haut":73.5},
{"mois":10, "bas":70, "moy":87.5, "haut":105},
{"mois":11, "bas":77, "moy":96.25, "haut":115.5},
{"mois":12, "bas":84, "moy":105, "haut":126}]
};
我想将 x 轴放入代码中看到的月份。调用 JSON 中的特定数据来创建每一行。
dojo.addOnLoad(function() {
var chart1 = new dojox.charting.Chart2D('chart1');
chart1.addPlot('default', {
type: 'StackedAreas',
markers: true,
tension: 'S',
lines: true,
areas: true,
labelOffset: -30,
shadows: {
dx:2, dy:2, dw:2
}
});
chart1.addAxis('x', {max:12,
labels:[
{value: 0, text: ""},
{value: 1, text: "Jan"},
{value: 2, text: "Feb"},
{value: 3, text: "Mar"},
{value: 4, text: "Apr"},
{value: 5, text: "May"},
{value: 6, text: "Jun"},
{value: 7, text: "Jul"},
{value: 8, text: "Aug"},
{value: 9, text: "Sept"},
{value: 10, text: "Oct"},
{value: 11, text: "Nov"},
{value: 12, text: "Dec"}
]});
chart1.addAxis('y', { vertical: true, max:200, includeZero: true });
chart1.addSeries('Basse', (jStore, {query: {bas: "*"}}, "bas"),{ stroke: 'red', fill: 'pink' });
chart1.addSeries('Moyenne',(jStore, {query: {moy: "*"}}, "moy"), { stroke: 'green', fill: 'lightgreen' });
chart1.addSeries('Haute',(jStore, {query: {haut: "*"}}, "haut"), { stroke: 'blue', fill: 'lightblue' });
chart1.render();
var anim1a = new dojox.charting.action2d.Magnify(chart1, "default");
var anim1b = new dojox.charting.action2d.Tooltip(chart1, "default");
var legend1 = new dojox.charting.widget.Legend({
chart:chart1
},"legend1");
chart1.render();
});
它不起作用,我不知道我必须放置而不是(jStore, {query: {haut: "*"}}, "haut")
调用我的特定数据。
请帮忙 !非常感谢。