jsuarezruiz / AlohaKit.Controls

A set of .NET MAUI drawn controls.
MIT License
410 stars 46 forks source link

BarChartView if all chartitem.value = 0 will crash #59

Open xufeitt opened 1 year ago

xufeitt commented 1 year ago

like sample set all chartitem.value = 0 , app will crash ObservableCollection _chartCollection = new ObservableCollection() { {new ChartItem(){ Value= 0, Label = "a"}}, {new ChartItem(){ Value= 0, Label = "b"} }, {new ChartItem(){ Value= 0, Label = "c"} }, {new ChartItem(){ Value= 0, Label = "d"} }, {new ChartItem(){ Value= 0, Label = "e"} } };

xufeitt commented 1 year ago

Ok I had modified it.

protected virtual void DrawHorizontalStepLines

int maxEntryIndex = points.ToList().IndexOf(maxPoint);

if(maxEntryIndex == -1) maxEntryIndex = 0; thist line is added

var maxEntry = Entries.ElementAt(maxEntryIndex).Value;