开发者

Incorrect rendering of Data Under X -axis and AddSeries Method Dynamically

开发者 https://www.devze.com 2023-02-19 10:59 出处:网络
I am getting all the Values from the UserInputs to display Charts . So nothing is fixed in my case , So how can i use the below cases , as the Data forchart.addSeries(series[i]); Might be bigger than

I am getting all the Values from the UserInputs to display Charts . So nothing is fixed in my case ,

So how can i use the below cases , as the Data for chart.addSeries(series[i]); Might be bigger than the X axis Labels

In my case nothing is fixed all the values will come from Server side Objects .

chart1.addAxis("x", {max:7, labels: [开发者_C百科{value:1, text:"New"}, {value:2, text:"Closed"}, {value:3, text:"Open"}, {value:4, text:"UAT"}, {value:5, text:"Maint"}, {value:6, text:"Long"}, {value:7, text:""}] });

chart1.addSeries(series[i]);

please give me some inputs to proceed further .


To add a series to your chart1 in Dojox, you need to use the following structure:

chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);

So, you could iterate through your series array on your server side with something like this:

chart1.addSeries("Series 1", [
// Your server code here
// series is an array(1, 2, 3, 17);
foreach ($series as $v) {
    echo "$v, ";
}
// End server code
]);

You could even nest this in a loop, if you wanted to graph multiple series on the same plot.
For the axis labels, replace the echo with something like:

chart1.addAxis("x", { max: 7, labels: [
// Start server code
for ($i=1; $i<=5; $i++) {
  echo " {value: $i, text: \"$labels[$i]\" },";
}
// End server code
] } );
0

精彩评论

暂无评论...
验证码 换一张
取 消