Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
d3js to plot vector data from json file

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!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!