Home forums Using CanvasJS Graph a CSV file Reply To: Graph a CSV file

#9270

xcorex,

The issue seems to be an additional line at the end of file which has not been handled in #6371. You can handle this case by checking if a line is empty as shown below.

for (var i = 0; i <= allLinesArray.length - 1; i++) {
	var rowData = allLinesArray[i].split(',');
	if(rowData && rowData.length > 1)
	  dataPoints.push({ label: rowData[0], y: parseInt(rowData[1]) });
}

I’ll also update #6371 with this code


Naveen