Page 1 of 1

Custom Horizontal Axis zooming

Posted: Mon Apr 08, 2013 1:25 pm
by 15663510
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.

Re: Custom Horizontal Axis zooming

Posted: Mon Apr 08, 2013 2:55 pm
by Marc
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