Passing arbitrary column values to D3 visualization when reading data file

后端 未结 1 1692
暗喜
暗喜 2021-01-28 07:04

I am using the D3 histogram visualization and want to pass headers in that are not necessarily named \"letter\" or \"frequency.\" If I attempt to change the column attributes i

1条回答
  •  清酒与你
    2021-01-28 07:45

    Square brackets allow the passing of variables.

    d3.tsv(datapath, type, function(error, data) {
    x.domain(data.map(function(d) { return d[columnname1]; }));
    y.domain([0, d3.max(data, function(d) { return d[columnname2]; })]);
    

    0 讨论(0)
提交回复
热议问题