I have a simple CSV (imported using JQuery's $.ajax
from the /data/league.csv
on the same site) with three lines in this exact format:
"Kimberlin Library","Queen's Building","Innovation Centre","etc etc"
8,2,0,-2
1,0,-1,0
which I'd like to get into this format (to use building
and percent
as data for the x-y axes in Highcharts, and also to populate a list with all three):
var leaguetable = {
building: ["Kimberlin Library","Queen's Building","Innovation Centre","etc etc"],
percent: [8,2,0,-2],
change: [1,0,-1,0]
};
embarrassingly trivial, but I keep drawing a blank, despite trying other people's methods (including split(/\r\n|\n|r/)
, searching for /^(.*)$/m
), and this question), so prepared to start from scratch. I need something as simple as possible, either JQuery or pure Javascript. For a similar problem I ended up converting the file to JSON, but I'd like to avoid that if possible.