AlohaKit.Controls icon indicating copy to clipboard operation
AlohaKit.Controls copied to clipboard

BarChartView if all chartitem.value = 0 will crash

Open xufeitt opened this issue 2 years ago • 1 comments

like sample set all chartitem.value = 0 , app will crash ObservableCollection<ChartItem> _chartCollection = new ObservableCollection<ChartItem>() { {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 avatar Jun 09 '23 17:06 xufeitt

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;

xufeitt avatar Jun 11 '23 17:06 xufeitt