I'm pretty new to D3 and json files so apologies if this is a somewhat elementary question. I have a dataset with four fields organized in columns, say:
Name Time Value
X t1 v1
X t2 v2
X t3 v3
Y t1 V1
Y t2 V2
Z t1 V1
Z t2 V2
Z t3 V3
Z t4 V4
As you notice, these data are basically time series of V for various names all in the same file. I want to transfer this to a json file to be read by d3 and plotted. It strikes me that the most efficient way would be if I can somehow organize it in a way where I can have members in the json file such that
Option 1 -
{name:'X',time:[t1 t2...],value:[V1 V2...]} for each name
Option 2 - Another alternative would be:
{name:'X',time:'t1',value:'v1'},{name:'X',time:'t2',value:'v2'} and so on for each name
I'm aware that option 2 is possible but it seems a little inefficient with repeatedly storing the name. Is option 1 possible to store in json and plot using d3?
I don't seem to be able to find any examples for option 2 and how I could go about plotting data like that.
Thanks for your help!