Custom Horizontal Axis zooming

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Custom Horizontal Axis zooming

Post by diegoa » Mon Apr 08, 2013 1:25 pm

I have multiple pens on the same custom horizontal axis. when I zoom via mouse or via buttons I have created (Zoom In 110%, Zoom Out 90%, Zoom Home) I notice that the left axis updates but the custom horizontal axis doesn't update.

Could you provide an example of how to update my custom horizontal axis when I zoom in via mouse and via the buttons above? I am able to find an example of how to do this with the mouse but not when you do zooming via code on button click events.

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Custom Horizontal Axis zooming

Post by Marc » Mon Apr 08, 2013 2:55 pm

Hello,

Custom Axes could be zoomed/unzoomed by code in the following way:
private void btnZoomIn_Click(object sender, EventArgs e)
{

double percentZoom = 110;

Steema.TeeChart.Axis axis = tChart1.Axes.Custom[0];
double AMin = axis.CalcPosPoint(axis.IStartPos);
double AMax = axis.CalcPosPoint(axis.IEndPos);

double tmpDelta = (AMax - AMin) * ((percentZoom - 100.0) * 0.01);
axis.SetMinMax(AMin + tmpDelta,AMax - tmpDelta);

tChart1.Zoom.ZoomPercent(percentZoom);

}

private void btnZoomOut_Click(object sender, EventArgs e)
{
double percentZoom = 98;

Steema.TeeChart.Axis axis = tChart1.Axes.Custom[0];
double AMin = axis.CalcPosPoint(axis.IStartPos);
double AMax = axis.CalcPosPoint(axis.IEndPos);

double tmpDelta = (AMax - AMin) * ((percentZoom - 100.0) * 0.01);
axis.SetMinMax(AMin + tmpDelta, AMax - tmpDelta);

tChart1.Zoom.ZoomPercent(percentZoom);
}

//initialise these values at chart load if not automatic
double lMin, lMax, bMin, bMax;

private void btnZoomHome_Click(object sender, EventArgs e)
{
//lMin, lMax, bMin, bMax only needed if Axes not automatic by default
//if automatic reset Axis to automatic true
tChart1.Axes.Left.SetMinMax(lMin, lMax);
tChart1.Axes.Custom[0].SetMinMax(bMin, bMax);
}
regards,
Marc Meumann
Steema Support

Post Reply