I have a chart that shows percent. I would like the Y axis to show 0 through 100 if the maximum value in the series is less than 100. If the maximum value is greater than 100 then I would like the chart to automaticaly scale the Y axis.
I thought that I could use Telerik.Charting.ChartSeriesCollection.GetMaxYValue() method, however it is not working as I expect. The value it returns is Infinity, not the maximum value. This is how I am trying to achomplish.
(chart.Series.GetMaxYValue() <= 100)
chart.PlotArea.YAxis.MaxValue = 100;
chart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = Color.Black;
chart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = Color.Red;
However when the maximum value is less than 100, I never get inside the IF startment, it always bounces to the ELSE.
To diagnose, I put the following line of code in so I can se the value returned by GetMaxYValue().
var x = chart.Series.GetMaxYValue();
Inside the debugger I can see the value of x is Infinity.
Any thoughts on what I'm doing wrong? Is there a better way to achomplish this?