d3.js - How to use CSV data in d3 -
what want do
my csv looks this
,,name,first names,s,r,nat,born,starting point,starting date,arrival date,days,km,assist,support,style,note,arrival date 2 1,1,kagge,erling,,,nor,1/15/1963,berkner island,11/18/1992,1/7/1993,50,appr. 1300,n,n,solo,first solo unassisted, 2,2,arnesen,liv,f,,nor,6/1/1953,hercules inlet,11/4/1994,12/24/1994,50,1130,n,n,solo,first woman unassisted, 3,3,hauge,odd harald,,,nor,1956,berkner island,11/4/1994,12/27/1994,54,appr. 1300,n,n,,,
how should import csv able access data such as
.text(function(d) { return d['starting point']; });
what i've tried
i have tried nesting data
d3.csv("data.csv", function(csv_data) { var data = d3.nest() .key(function(d) { return d.name; }) .entries(csv_data) console.log(data);
which in console looks this:
0: object key: " dickinson" values: array[2] 0: object assist: "n" first names: "conrad" name: " dickinson" nat: "uk" starting point: "hercules inlet" 1:object 2:object ....
however able return d.key
.text(function(d) { return d.key; });
i have asked question before code examples think question confusing. if me data grateful!
don't nest it.
d3.csv("data.csv", function(csv_data) { select("body") .append("div") .selectall('p') .data(csv_data) .enter() .append('p') .text(function(d) { d.name + ', ' + d.location...}) });
Comments
Post a Comment