Chartjs-ASP.NET Core Razor Pages โ€“ Get List Data to Display on Chart.js Graph

0๐Ÿ‘

โœ…

I was able to get this working using the @Html.Raw and String.Join on the commas. I also added ticks to surround the Month string like 'Jan'.

Below is a sample of what I did.

data: {
      labels: [@Html.Raw("'" + String.Join("','", (Model.lstObjects.Select(x => x.RecordMonth).ToList())) + "'")],

Leave a comment