Home forums Using CanvasJS Dynamic chart from SQL Server in MVC Reply To: Dynamic chart from SQL Server in MVC


Vishwas R


The issue is in updateChart function. It fails to enter for-loop as value of x (var x = i;) is same as the value of result.length. Read data from database, store it in another variable (lets say result1) and then push that to dataPoints as shown below.

var updateChart = function () {
    for(var y=0; y < result1.length; y++){
	dataPoints.push({label:result1[y].Date, y:result1[y].Value2});

Please check this updated project

Vishwas R