Page 1 of 1

How to get the previous asix data before OnZoom?

Posted: Wed Jun 21, 2006 8:16 am
by 9529132
Hi,

I would like to realize gradual unzoom function, so I have to save the axis data. In which function should I use
m_chart1.GetAxis().GetBottom().GetMaximum();
m_chart1.GetAxis().GetBottom().GetMinimum();
m_chart1.GetAxis().GetLeft().GetMaximum();
m_chart1.GetAxis().GetLeft().GetMinimum();
to get the axis data before OnZoom?

Thank you very much,
David

Posted: Wed Jun 21, 2006 11:15 am
by narcis
Hi David,

You could try retrieving the values in TeeChart's OnAfterDraw event.

BTW: Have you tried animated zoom?

Code: Select all

	m_Chart1.GetZoom().SetAnimated(true);
	m_Chart1.GetZoom().SetAnimatedSteps(100);

Posted: Thu Jun 22, 2006 1:00 am
by 9529132
Hi,

If I retreve the axis values in OnAfterDraw, the values will be for the zoomed chart, not the original chart, so if I push these values into stack and read them in OnUndoZoom, the undozoom will never happen because the values are the same as current axis range.
narcis wrote:

Code: Select all

	m_Chart1.GetZoom().SetAnimated(true);
	m_Chart1.GetZoom().SetAnimatedSteps(100);
This method can only animate the zoom procedure, but if I undo zoom, the axis values will directly return to the very beginning values, not the values in the last step zoom.

I am not sure if I made myself clear. This is what I want to do: if I zoom in once, twice, and third times, when I undo the zoom, I want to the axis values to be 2nd zoom values, 1st zoomed values and back to original, instead of jumping directly back to original values. So I have to retrieve the old axis values before OnZoom event is handled.

Thank you very much,
David

Posted: Thu Jun 22, 2006 8:56 am
by narcis
Hi David,

Ok, now I understand better what you are trying to achieve.

Then I would store axes settings in an array every time OnAfterDraw is fired. The first time would be just after the chart is drawn for the very first time, before zooming, then it would fire after each zooming.

If necessary, use:

Code: Select all

	m_Chart1.GetEnvironment().InternalRepaint();
after initializing the chart so that it fully repaints and goes through OnAfterDraw event.