Chartjs-How to implement chart js using viewbag in mvc razor

0👍

This is because your serialization does not produce a valid javascript array.
First remove the square brackets from @Html.Raw(ViewBag.ProductSalesCountName)
And in the controller use Newtonsoft.Json for the serialization.

ViewBag.ProductSalesCountName= 
        Newtonsoft.Json.JsonConvert.SerializeObject(list);

Leave a comment