mattosaurus / ChartJSCore

Implementation of Chart.js for use with .NET Core.
GNU General Public License v3.0
116 stars 34 forks source link

Bug in JSON with Title model #74

Closed jfcontart closed 2 years ago

jfcontart commented 2 years ago

hello, I found a bug with title and I solved it

I just tried chart.Options.Plugins = new Plugins { Title = new Title() { Display = true, Text = "Burndown Chart", } }; result => exec bad ... app crash

I resolved it with this trick

in Title.cs line 47 ... remove [JsonConverter(typeof(SingleOrArrayConverter))] string must be linearize as string

Can you confirm?

thank you

mattosaurus commented 2 years ago

Hi, thanks for spotting that.

Looks like title can either be a string or an array of strings so I've updated Text to be an IList<string>.

You can use it like so.

chart.Options.Plugins = new Plugins { Title = new Title() { Display = true, Text = new List<string>() { "Burndown Chart" } } };

jfcontart commented 2 years ago

Hi, tested! it fixed the issue! thank you! :-)