We have a chart with a logaritmic scale. We would like to limit the smallest and the largest value for each axis, i.e. not letting the user scroll or zoom to see values smaller than 0.1 or larger than 10,000,000 (Our logaritmic base is 10).
We have managed to limit scrolling by listening to the Chart.Scroll event and manually setting the Axis.Minium or Axis.Maximum if the user scoll past the limits. But trying to do the same thing with pinch-n-zoom doesn't work since the Chart.Zoomed event isn't raised until the user lift their fingers.
Is there a way to either set limits on the axes themselves or only allow zooming in from default view (showing a subset of what was originally displayed) but not zooming out (showing more than was originally displayed)?
How to limit pinch-and-zoom in Xamarin
Re: How to limit pinch-and-zoom in Xamarin
Hello Robert,
which TeeChart Xamarin version are you using (Xamarin.Forms, Xamarin.iOS or Xamarin.Android) ?
which TeeChart Xamarin version are you using (Xamarin.Forms, Xamarin.iOS or Xamarin.Android) ?
Pep Jorge
http://support.steema.com
http://support.steema.com
Re: How to limit pinch-and-zoom in Xamarin
We're using Xamarin.Forms and are targeting both Android and iOS.
Re: How to limit pinch-and-zoom in Xamarin
Hello Robert,
we've already added a new OnPinch event for Xamarin.Forms. It'll be available for the next maintenance release which will be published very soon.
But, in meantime you could use the OnBeforeDrawAxes event in order to check the minimum and maximum axis values and force a setMinMax for axis.
Here the code :
we've already added a new OnPinch event for Xamarin.Forms. It'll be available for the next maintenance release which will be published very soon.
But, in meantime you could use the OnBeforeDrawAxes event in order to check the minimum and maximum axis values and force a setMinMax for axis.
Here the code :
Code: Select all
tChart1.BeforeDrawAxes += TChart1_BeforeDrawAxes;
private void TChart1_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1.Axes.Bottom.Minimum < 0)
{
tChart1.Axes.Bottom.SetMinMax(line.XValues.MinValue,line.XValues.MaxValue);
tChart1.Draw();
}
else
tChart1.Axes.Bottom.Automatic = true;
}
Pep Jorge
http://support.steema.com
http://support.steema.com