Chartjs-How to bind data from Controler to chartjs line chart to create it as dynamic?

1👍

You will have to use some sort of for loop.

please note that the property case may differ on your side this is due to settings on the Json Serializer

var dataset1 = new array();
var dataset2 = new array();

for (var i = 0; i < list.length; i++) {
  dataset1.push(list[i].Amount);
  dataset2.push(list[i].NoOfTransaction);
}

dataset1 will now be :

[Amount1, Amount2, Amount3, Amount4, Amount5]

dataset2 will now be :

[NoOfTransaction1, NoOfTransaction2, NoOfTransaction3, NoOfTransaction4, NoOfTransaction5]

Leave a comment