I am trying to implement a Spider Chart using dojo chart library. I am using a dummy example from dojo: http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/charting/tests/test_spider2d.html
It uses the addSeries method like this:
chart1.addSeries("China", {data: {"GDP": 2,"area": 6,"population": 2000,"inflation": 15,"growth": 12}}, { fill: "blue" });
chart1.addSeries("France", {data: {"GDP": 6,"area": 15,"population": 500,"inflation": 5,"growth": 6}}, { fill: "red" });
chart1.addSeries("USA", {data: {"GDP": 3,"area": 20,"population": 1500,"inflation": 10,"growth": 3}}, { fill: "green" });
..and so on..
chart1.render();
But I want to pass in the data dynamically. I have got my data something like following:
var obj1 = [{
"qNo": "THR1",
"qAns": "3"
}, {
"qNo": "THR2",
"qAns": "3"
}, {
"qNo": "THR3",
"qAns": "1"
}, {
"qNo": "THR4",
"qAns": "3"
}, {
"qNo": "THR5",
"qAns": "3"
}, {
"qNo": "THR7",
"qAns": "3"
}
];
I have got obj2 as well of same structure but with different qAns values.
So I want to use obj1 and obj2 in place of "China" and "France" as given in the example above.
So i want something like
chart1.addSeries("obj1", {data: {obj1 data needs to go here but how?}}, { fill: "blue" });
chart1.addSeries("obj2", {data: {obj1 data needs to go here but how?}}, { fill: "red" });
Can you please help me what syntax shall I use to pass in obj variables in addSeries method? I have a small idea that i need to use it as JSON object and convert it to datastore and pass in the datastore, but I am unable to get the syntax working.
Please help ! thanx a lot. Regards