D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
malcolm-decuire
Full window
Github gist
d3 csv nest simple example
<html> <head> <title>D3 Simple Nest and CSV Example</title> <script src="https://d3js.org/d3.v2.js"></script> </head> <body> <script> var csv_data="group, date, time\none, 2012-01-01, 4\none, 2012-01-01,6\ntwo, 2012-01-06,3\nthree, 2012-01-01, 4\nthree, 20120-01-05, 3\n"; var array_data = d3.csv.parse(csv_data); var nested_data = d3.nest() .key(function(d) { return d.group; }) .entries(array_data); console.debug(nested_data); alert(JSON.stringify(nested_data)); /* expect [{"key":"one", "values":[{"group":"one"," date":" 2012-01-01"," time":" 4"}, {"group":"one"," date":" 2012-01-01"," time":"6"}]}, {"key":"two", "values":[{"group":"two"," date":" 2012-01-06"," time":"3"}]}, {"key":"three", "values":[{"group":"three"," date":" 2012-01-01"," time":" 4"}, {"group":"three"," date":" 20120-01-05"," time":" 3"}]}] */ </script> </body> </html>
Modified
http://d3js.org/d3.v2.js
to a secure url
https://d3js.org/d3.v2.js