Actually, there is, but not fully automatically with single line of code. All you have to do is:Is there a way to make my custom Y-axis automatically change the the Max and Min values based on the zoom?
a) Calculate visible points local minimum and maximum values,
b) adjust vertical axis scale acording to these two values. This can be done in chart Zoomed event.
The following code will calculate series (local) extreme values:
Code: Select all
public void LocalMinMax(Steema.TeeChart.Styles.Series series, int first, int last, ref double min, ref double max)
{
min = series.YValues[first];
max = series.YValues[first];
for (int i=first; i<=last; i++)
{
if (series.YValues[i] < min) min = series.YValues[i];
if (series.YValues[i] > max) max = series.YValues[i];
}
}