Page 1 of 1

A simple Zoom on the X-Axis??

Posted: Sun May 04, 2014 9:21 am
by 13050364
Hi

We are using TeeChart version 3.5.3187.15585

Ive spent some time searching the forums for an example of how to do a simple zoom IN on the horizontal axis only. The vertical axis should not be zoomed. Is it possible to do this.

Simple example. If the chart has 100 points starting from x=1 to x=100 but I just want to display from points 10 to 90 then how do I do this? Ive been playing about with the ZoomPercent() function but that doesn't restrict the zoom to any axis, just seems to zoom in both axes (also I cant seem to zoom in only zoom out). There is a ZoomRect() function also which looks more promising but again not sure how to implement this and the zoom parameters appear to be in pixels.

A code snippet would be great or perhaps its been done before and a link would help also.

Thanks!!

Re: A simple Zoom on the X-Axis??

Posted: Mon May 05, 2014 9:55 am
by Christopher
Hello Dave,
Dave wrote:A code snippet would be great or perhaps its been done before and a link would help also.
Have you tried:

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      tChart1.Series.Add(typeof(Line)).FillSampleValues();
      tChart1.Zoom.Direction = ZoomDirections.Horizontal;
    }
?

Re: A simple Zoom on the X-Axis??

Posted: Mon May 05, 2014 2:48 pm
by 13050364
Hi Christopher
Thanks but thats not really helping. I dont think Ive explained it very well


Please see the chart I've attached. What I want is to really select a rectangle from X coords -15 to +15 and height 65,000 and then display. Only not drawing a rectangle but using code to replicate this.

Ive just tried the following code;

Rectangle r = new Rectangle(-15, 65000, 30, 65000);
spectrumChart.Zoom.ZoomRect(r);


However this doesn't work at all. I see nothing and it seems to have zoomed into a small area in my chart.

Am I on the right track?

Re: A simple Zoom on the X-Axis??

Posted: Mon May 05, 2014 2:53 pm
by Christopher
Hello Dave,
Dave wrote:Hi Christopher
Thanks but thats not really helping. I dont think Ive explained it very well

[...]

Am I on the right track?
Yes and no :)

Possibly the easiest way to do this would be to use the Axis.SetMinMax method, e.g.
tChart1.Axes.Bottom.SetMinMax(-15, 15);

Re: A simple Zoom on the X-Axis??

Posted: Tue May 06, 2014 8:45 am
by 13050364
Sensational!

Thanks Christopher.