Creating a table linked to a csv file

后端 未结 4 1749
暖寄归人
暖寄归人 2020-11-28 02:39

I am trying to create a table linked to a *.csv file using d3, but all I get is a blank webpage. Even with the example Crimea I get a blank page.
I would be

4条回答
  •  感动是毒
    2020-11-28 03:21

    I'm sorry to add this in as a new answer but I don't have enough points to add it in as a comment. Just a slight tweak to the end of the code of @Shawn_Allen. I believe that this works too.

    //create a cell in each row for each column
    var cells = rows.selectAll("td")
        .data(function(row) {
            return columns.map(function(column) {
                return row[column];
            });
        })
        .enter()
        .append("td")
            .text(function(d) { return d; });
    

    });

    There was no need to create that JSON with column, value.

提交回复
热议问题