Closed mkopara closed 4 years ago
This is not a bug. Currently it's impossible to use value types for the datasets that implement the covariant IMixableDataset
(because covariance only works for reference types).
You have to use the wrappers in the ChartJs.Blazor.ChartJS.Common.Wrappers
namespace. There are also extension methods for enumerables of those types (Wrap
) which wraps all of the elements in the corresponding wrapper.
This limitation is known and I'd love to get rid of it in a feature version. I'm sorry but currently there is no other way than to use the wrappers.
Hello is it possible to make something this working:
LineDataset<DoubleWrapper> _lineset = new LineDataset<DoubleWrapper>();
_lineset.Label = "Earnings";
_lineset.BackgroundColor = ColorUtil.FromDrawingColor(System.Drawing.Color.Blue);
_lineset.BorderColor = ColorUtil.FromDrawingColor(System.Drawing.Color.Blue);
_lineset.Fill = false;
_lineset.AddRange(new double[] { 100, 500, 150, 1000, 2000, 1500 }.Wrap());
_lineConfig.Data.Datasets.Add(_lineset);
_lineConfig.Data.Labels = new List<string>();
_lineConfig.Data.Labels.AddRange(new[] { "January", "February", "March", "April", "May", "June", "July" });
The only way i can plot some data on my graph is by using Points
What's the error you get? @schuttea
No errors just no plotting of the data.
By making my example a bit more complex with the XAxes having a TimeAxis and the right Format And the plots with a TimeTuple it works perfect. But I think it could be simpeler. Thx for responding
I'm sorry, I don't understand your question. Could you open a new issue with some more detail? By that I mean all the code (not just the dataset), screenshots and the expected result. Without more explanation, it's really hard for us to help you.
Thank you.
Describe the bug
It is impossible to declare dataset with object such as decimal, integer etc. I only managed to successfully created a chart if TData is of Type TimeTuple
for example LineDataset<TimeTuple> where TData is always a class according to this.
public class LineDataset : BaseMixableDataset where TData : class
Which Blazor project type is your bug related to?
Which charts does this bug apply to?
LineChart