A simple Zoom on the X-Axis??

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

A simple Zoom on the X-Axis??

Post by Dave » Sun May 04, 2014 9:21 am

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!!

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

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

Post by Christopher » Mon May 05, 2014 9:55 am

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;
    }
?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

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

Post by Dave » Mon May 05, 2014 2:48 pm

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?
Attachments
chart1.PNG
chart1.PNG (17.5 KiB) Viewed 9673 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

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

Post by Christopher » Mon May 05, 2014 2:53 pm

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);
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

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

Post by Dave » Tue May 06, 2014 8:45 am

Sensational!

Thanks Christopher.

Post Reply