blazorbootstrap
blazorbootstrap copied to clipboard
ChartDataset.Data generics
In the latest version, the base ChartDataset.Data field was changed to object, then derived classes declared it as new List<double?>?. I understand this change was made to support the ScatterChart, but it was giving me problems with inheritance, so I changed it to use generics and avoid the shadowing.
@mhspelt Thank you for the PR. Can you share at least one scenario for an inheritance issue, just for my understanding?
@mhspelt Thank you for the PR. Can you share at least one scenario for an inheritance issue, just for my understanding?
Hi @gvreddy04, here's a very simple example of a code snippet that shows two problems: https://dotnetfiddle.net/1tO4pg
- Hiding requires casting the ChartDataset to access the data at all
- Casting the ChartDataset edits the wrong field
Both of these behaviors are, to me as a client of the library, unexpected and are IMHO elegantly fixed by this PR.
[edit]I wrote "dumps 0" in the example, should have been "dumps null"[/edit]