Issue when graphing horizontal line

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Issue when graphing horizontal line

Post by LibDundas » Mon Dec 07, 2009 6:39 pm

I am experiencing an issue with zooming on a graph. I execute a custom zoom function that is based on the values on a specific line graph (MinXValue(); MaxXValue(); ...)

I have uploaded a Test project that will demonstrate this (DragPoint_FlatLine.zip). If you click on Show Graph and then "Generate Line with Zero Points" to get a flat line at y=2. Ignore the button name "..with zero points".

If you then click the "Line 1" and "Line 2" buttons back and forth, the graph zooming eventually gets way out of wack and you don't see any lines. If you still continue clicking, you will eventually see both lines on top of each other at the zero position OR the program will freeze up on the line:

Code: Select all

tChart1.Zoom.ZoomRect(rect);
Have you seen this before?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue when graphing horizontal line

Post by Sandra » Wed Dec 09, 2009 11:09 am

Hello LibDundas,

We are not sure what problem is and nor what the sequence of buttons that must follow what is sequence of buttons we must follow for reproduce the issue.
Please, you could say what is the exactly sequence of buttons we must use, because we can reproduce the issue here.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Issue when graphing horizontal line

Post by LibDundas » Wed Dec 09, 2009 4:55 pm

Hi Sandra, sorry I should have made it more clear in my first post. Using the sample program that I uploaded (DragPoint_FlatLine.zip), you can do the following to reproduce the error:

Click the following buttons in this order:

"Generate Line with Zero Points"
"Line 1"
"Line 2"
"Line 1"
"Line 2" at this point, you will probably see it zoom into some random y-axis position
"Line 1"
"Line 2"
...
Continue licking Line 1 and Line 2 buttons until either the program will stop responding or you will see a graph like this:
Image

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Issue when graphing horizontal line

Post by Sandra » Thu Dec 10, 2009 12:46 pm

Hello LibDundas,

I could reproduce your problem and I think that problem occurs when you call method
AutoZoomToActiveLineGraph(int lineToZoom) and concretely when you calculate positions to use for create zoomRect(rect), because we understand, zoomRect(rect) is accessing to axes areas where series there aren't represented and there comes a moment, that can not calculate correctly the position of two series. Therefore, I recommend that debug your code for see exactly what happens and change your code for next that use SetMinMax():

Code: Select all

  private void AutoZoomToActiveLineGraph(int lineToZoom)
        {
            tChart1.Zoom.Undo(); // this was added to prevent a bug that occurs when going from one zoomed param (that has all zero values) to a different param

            origChartBoundaries.Reset();
            origChartBoundaries.horizMin = Math.Ceiling(tChart1.Series[lineToZoom].MinXValue());
            origChartBoundaries.horizMax = Math.Ceiling(tChart1.Series[lineToZoom].MaxXValue() * 1.03);
            origChartBoundaries.vertMin = Math.Ceiling(tChart1.Series[lineToZoom].MinYValue());
            origChartBoundaries.vertMax = Math.Ceiling(tChart1.Series[lineToZoom].MaxYValue() * 1.1);    // add 10% so the top mark doesn't get cut off

            tChart1.Axes.Bottom.SetMinMax(origChartBoundaries.horizMin, origChartBoundaries.horizMax);
            tChart1.Axes.Left.SetMinMax(origChartBoundaries.vertMin, origChartBoundaries.vertMax);
           
        }
        #endregion
I hope will help.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Issue when graphing horizontal line

Post by LibDundas » Thu Dec 10, 2009 3:19 pm

Thank you Sandra, that works great. The only trade-off is that the animated zoom effect is not visible since we are not zooming any more. This is only visual, so I will have to run it by the graphics people.

Is there any way to achieve the zoom effect when using the SetMinMax?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Issue when graphing horizontal line

Post by Narcís » Thu Dec 10, 2009 3:47 pm

Hi LibDundas,
Is there any way to achieve the zoom effect when using the SetMinMax?
The only solution I can think of is performing intermediate SetMinMax operations. For example, for zooming from 0 to 100 do it at: 10, 20, 30, 40, ..., 90 and 100; to get an animation effect.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Issue when graphing horizontal line

Post by LibDundas » Fri Dec 11, 2009 2:54 pm

Hi Narcís, that makes sense. It might be a lot of work in my actual application so I will leave it out for now and hopefully no misses the effect :)

Thanks!

Post Reply