Hi,
I have .csv file with following content:
11/13/2017 00:10:00,0,69.8,1.53,0,0.0,0.0,
11/13/2017 00:20:00,0,69.8,1.43,0,0.0,0.0,
11/13/2017 00:30:00,0,69.8,1.50,0,0.0,0.0,
11/13/2017 00:40:00,0,69.7,1.53,0,0.0,0.0,
11/13/2017 00:50:00,0,69.7,1.50,0,0.0,0.0,
11/13/2017 01:00:00,0,69.6,1.46,0,0.0,0.0,
11/13/2017 01:10:00,0,69.6,1.54,0,0.0,0.0,
How has this part of the code to be modified to get between 4 and 8 lines?
var dataPoints = [];
function getDataPointsFromCSV(csv) {
var dataPoints = csvLines = points = [];
csvLines = csv.split(/[\r?\n|\r|\n]+/);
for (var i = 0; i < csvLines.length; i++)
if (csvLines[i].length > 0) {
points = csvLines[i].split(“,”);
dataPoints.push({
x: parseFloat(points[0]),
y: parseFloat(points[1])
});
}
return dataPoints;
}
Thank you for any help!
-
This topic was modified 7 years, 1 month ago by James. Reason: added notify
-
This topic was modified 7 years, 1 month ago by Vishwas R.