javascript - How should I structure my nested data for this D3.js chart? -
after reading quite few d3.js tutorials, i'm still uncertain best way structure data when there several nested levels. example, have bunch of categories. each category, have 2 years worth of data, aggregated monthly. so, this:
{"cat1": {"2012":[{"start_data":[1,2,3,...]},{"end_data":[4,5,6,...]}], "2013":[{"start_data":[1,2,3,...]},{"end_data":[4,5,6,...]}]}, "cat2": {"2012":[{"start_data":[1,2,3,...]},{"end_data":[4,5,6,...]}], "2013":[{"start_data":[1,2,3,...]},{"end_data":[4,5,6,...]}]}, ... }
every array start_data
or end_data
has 12 items -- 1 each month.
i create interactive chart looks this:
since mockup terrible... going on want user able select year (or aggregate), whether viewing start_data
values or end_data
values (or aggregate, neglected put on mockup), , category.
the structure shown above meant show nesting, explanatory purposes. can export database whatever structure best d3.
how should structure data use d3 , how access data elements within d3 code?
Comments
Post a Comment