Home › Forums › Chart Support › line graph with multiple series from csv › Reply To: line graph with multiple series from csv
script is updated but still graph did not generated and no error in console.
<script type="text/javascript"> $(document).ready(function () { $.ajax( { type: "GET", url: "Data.csv", dataType: "text", success: function (data) { processData(data); } }); function processData(allText) { var allLinesArray = allText.split('\n'); if (allLinesArray.length > 0) { var cpu0 = []; var cpu1 = []; var cpu2 = []; var cpu3 = []; for (var i = 0; i <= allLinesArray.length - 1; i++) { var rowData = allLinesArray[i].split(';'); if (rowData && rowData.length > 1) { if (i != 0) { cpu0.push({ x: rowData[1], y: rowData[2] }); cpu1.push({ x: rowData[1], y: rowData[3] }); cpu2.push({ x: rowData[1], y: rowData[4] }); cpu3.push({ x: rowData[1], y: rowData[5] }); } } } console.log(cpu0); var chart = new CanvasJS.Chart("chartContainer", { title: { text: "CPU Usage" }, data: [ { type: "Line", dataPoints: cpu0 }, { type: "Line", dataPoints: cpu0 }, { type: "Line", dataPoints: cpu0 }, { type: "Line", dataPoints: cpu0 } ] }); chart.render(); } } }); </script>
Console output