DOJO addSeries方法在循环中创建带有计算和的图形 [英] DOJO addSeries method in a loop ploting a graph with commulative sum

查看:228
本文介绍了DOJO addSeries方法在循环中创建带有计算和的图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Dojo中创建动态堆叠折线图时,我使用Chart对象的addSeries()方法与响应(JSON数组)。这里有一段时间,我使用两个静态数据数组。当addSeries方法调用时,将使用它们的汇总和创建图表。这不是图的实际数据。
这里的addSeries方法有什么问题,而不是ploting的实际数据。

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数据数组是:

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");

,addSeries方法如下:

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:

这里,蓝色图例的第二行并不显示在数组中传递的实际数据(显示计数和)。而警报消息显示正确的数据。这里需要在addSeries方法中修改以获得正确的数据行。

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.

感谢ADVANCE。

推荐答案

这就是dojo StackLine图的设计方式。它正在累积前一系列的数据以显示它们。如果你想要一个不同的行为(即没有值的积累)我想你可以只使用一个常规的线图?

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?

这篇关于DOJO addSeries方法在循环中创建带有计算和的图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆