0

我想从 csv 中过滤记录以创建堆叠图表。我正在使用“开放缺陷”和“总计”列来堆叠组件。

//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
4

0 回答 0