d3.js - 过滤堆积图表的数据

时间:2013-07-05 15:54:12

标签: d3.js

我想过滤csv中的记录以创建堆积图表。我正在使用“open defect”和“total”列来堆叠组件。

//now read from the csv file. the param being criteriamap 
d3.csv("data_src/CompOpenDefect.csv", function(criteriamap) 
{



    // Transpose the data into layers by codecoverage/defects.We call it tasks.
    var tasks = d3.layout.stack()(["open", "total"].map(function(cause) 
    {
            return criteriamap.map(function(d) 
        {
            return {x:d.Component, y: +d[cause]};
        });
  }));


});

这将返回csv中的所有行。我想过滤记录。

我使用以下内容过滤(临时变量),但它不起作用。我尝试将d3.csv函数调用放入其中,反之亦然

d3.text("data_src/CompOpenDefect.csv", function(datasetText) 
            {
                parsedCSV = d3.csv.parseRows(datasetText);
                filteredData= parsedCSV.filter(function(row) 
                    {

                            return row[0] == temp 

                    })




            });

csv数据是:

Component,open,total,Week
Mastersaf DF-e - Integration,10,50,Week1
Unified Admin Portal Web Service - Integration,3,5,Week1
Mastersaf DF-e - Messaging,3,5,Week1

0 个答案:

没有答案