DOJO addSeries method in a loop ploting a graph with commulative sum

◇◆丶佛笑我妖孽 提交于 2019-12-14 03:24:25

问题


While creating a dynamic stacked Line chart in Dojo, i use Chart object's addSeries() method with response (JSON array). here for a while i am using two static data arrays. When addSeries method invocations, the charts get created with their commulative sum. That is not actual data of the graph. Here whats wrong with the addSeries method, not ploting the actual data.

hare the data array is:

var DataArr = new Array (   
                          [20, 30, 30, 30, 30, 45, 50, 0, 30, 119.2, 47.04, 0],
                          [20, 30, 30, 64, 20, 50, 10, 60, 0, 19, 87.04, 50]
                        );

var LegendArr = new Array("one", "two");

var colorArr = new Array("red","blue");

and the addSeries method is as:

for(var i = 0;i<2; i++){
        chart.addSeries(LegendArr[i],DataArr[i], {color:colorArr[i]});
   //   DataArr = [0,0,0,0,0,0,0,0,0,0,0,0];
        alert(DataArr[i]);
      }

the alert result is here, it is correct.

Graph image is as:

Here the second line with Blue Legend is not showing the actual data passed in the Array(showing commulative sum). whereas alert message showing the correct data. here what modification in the addSeries method is required to obtain the correct data line.

Thanks in ADVANCE.


回答1:


That's how the dojo StackLine plot is designed. It is accumulating the data of the previous series to display them. If you want a different behavior (i.e. no accumulation of values) I guess you can just use a regular Line plot?



来源:https://stackoverflow.com/questions/21250642/dojo-addseries-method-in-a-loop-ploting-a-graph-with-commulative-sum

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!