0

I have to do data manipulation so I can draw a line plot in plotlyjs. Basically a line chart with 6 trends.

I have three csv data files:

overall.csv
overall with state.csv
overall with school and state.csv

overall.csv looks like this:

date, admission, dropout

overall with state.csv looks like:

date, state, admission, dropouts

overall with school and state.csv looks like:

date, school, state, admission dropouts

I have to do data manipulation so I can draw a line plot in plotlyjs. So the plot of data that I need to do is:

Plot 6 different trends:

  1. Overall admission (overall.csv)

  2. Overall dropouts (overall.csv)

  3. 'X' state admissions (overall with state.csv)

  4. 'X' state dropouts (overall with state.csv)

  5. 'Y' school admissions (overall with school and state.csv)

  6. 'Y' School dropouts (overall with school and state.csv)

Overall 6 different trends over time.

I put up a code but am confused as I don't have a background in javascript, but it the code doesn't work, I keep getting an empty array.

var test = [];

d3.csv('overall.csv')
  .then(data => {
  data.map(function(d) {
  //console.log(d.admissions);
  test.push(d.admissions)
})});

console.log(test);

I keep getting an empty array.

afternoon
  • 67
  • 1
  • 4

0 Answers0