Home forums Using CanvasJS Charts from .csv on/off values Reply To: Charts from .csv on/off values

#17922

James
Member

Last question:

How can I combine your code with this one:

function getDataPointsFromCSV(csv) {
var dataPoints, csvLines, points;
dataPoints = csvLines = points = [];

csvLines = csv.split(/[\r?\n|\r|\n]+/);
for (var i = {param_chartStart}; i < csvLines.length; i++)
if (csvLines[i].length > 0) {
points = csvLines[i].split(“,”);

chart.options.data[0].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[1])});
chart.options.data[1].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[2])});
chart.options.data[2].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[3])});
chart.options.data[3].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[4])});
chart.options.data[4].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[5])});
chart.options.data[5].dataPoints.push({x: new Date(points[0]), y: parseFloat(points[6])});
}
}

Thanks!