在DOJOO中的堆积折线图上的点击事件上生成动态饼图

时间:2013-12-09 14:49:47

标签: dojo dojox.charting

我正在使用Dojo在上一个图表的点击事件中生成备用图表。

首先,我正在绘制堆积折线图(比如客户),并点击其中一条线,我需要绘制另一个饼图,以获取该客户的更多详细信息(比如该客户的收入)。所有这一切都发生在一个折线图上。

这里的问题是找到该特定行的id,现在我得到所有绘制行的id数组。 以下图表是针对三位客户绘制的。

enter image description here 以下我将介绍我的代码:

 var colorArray =["#2cabe2","#57E964","#736AFF","#B93B8F","#151B8D","#EE9A4D",...];
 for(var i =0 ; i<length ; i++)
        {
         chart.addSeries(response.legend + " "+ i,response.data[i],{color: colorArray[i]});
        } 

 chart.connectToPlot("default", function(evt) {
        var shape = evt.shape, type = evt.type;
        if (type == "onclick") {
          url="/ritl/chart/getProcessPieData.htm?customerId="+dijit.byId('customerId').get('value');   // url to the next (pie) chart in the same jsp.  
          processPie(url);         // calling function for pie Chart

        }
    });

数据响应采用JSONArray的形式。 JSON模式如下:

{"data":[[{"text":"January","value":1,"customerID":"RITL00013","y":0},{"text":"February","value":2,"customerID":"RITL00013","y":0},{"text":"March","value":3,"customerID":"RITL00013","y":0},{"text":"April","value":4,"customerID":"RITL00013","y":0},{"text":"May","value":5,"customerID":"RITL00013","y":0},{"text":"June","value":6,"customerID":"RITL00013","y":0},{"text":"July","value":7,"customerID":"RITL00013","y":0},{"text":"August","value":8,"customerID":"RITL00013","y":0},{"text":"September","value":9,"customerID":"RITL00013","y":0},{"text":"October","value":10,"customerID":"RITL00013","y":119951.2},{"text":"November","value":11,"customerID":"RITL00013","y":430827.04},{"text":"December","value":12,"customerID":"RITL00013","y":0}],[{"text":"January","value":1,"customerID":"RITL00002","y":0},{"text":"February","value":2,"customerID":"RITL00002","y":0},{"text":"March","value":3,"customerID":"RITL00002","y":0},{"text":"April","value":4,"customerID":"RITL00002","y":0},{"text":"May","value":5,"customerID":"RITL00002","y":0},{"text":"June","value":6,"customerID":"RITL00002","y":0},{"text":"July","value":7,"customerID":"RITL00002","y":0},{"text":"August","value":8,"customerID":"RITL00002","y":0},{"text":"September","value":9,"customerID":"RITL00002","y":0},{"text":"October","value":10,"customerID":"RITL00002","y":41996.52},{"text":"November","value":11,"customerID":"RITL00002","y":566353.8099999999},{"text":"December","value":12,"customerID":"RITL00002","y":0}],[{"text":"January","value":1,"customerID":"RITL00016","y":0},{"text":"February","value":2,"customerID":"RITL00016","y":0},{"text":"March","value":3,"customerID":"RITL00016","y":0},{"text":"April","value":4,"customerID":"RITL00016","y":0},{"text":"May","value":5,"customerID":"RITL00016","y":0},{"text":"June","value":6,"customerID":"RITL00016","y":0},{"text":"July","value":7,"customerID":"RITL00016","y":0},{"text":"August","value":8,"customerID":"RITL00016","y":0},{"text":"September","value":9,"customerID":"RITL00016","y":0},{"text":"October","value":10,"customerID":"RITL00016","y":132784.45},{"text":"November","value":11,"customerID":"RITL00016","y":571506.6},{"text":"December","value":12,"customerID":"RITL00016","y":0}]],"Success":true,"dataLength":3}

如何在上面的图表中找出该行的个人ID。建议我摆脱这种情况。提前感谢积极的建议..

1 个答案:

答案 0 :(得分:1)

如何在connectPlot回调中执行以下操作:

event.run.data[event.index].customerID