Unzoom not correctly displaying the min max values

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
histry
Newbie
Newbie
Posts: 79
Joined: Thu Aug 10, 2006 12:00 am

Unzoom not correctly displaying the min max values

Post by histry » Thu Oct 05, 2006 1:16 pm

Hi

I need to capture the min and max values of the axis when doing a zoom and unzoom. Attached to following code for the Zoom and UnZoom events

private void chart_Zoomed(object sender, EventArgs e)
{
lblMinAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(chart.Axes.Bottom.Minimum)).ToString("dd-MMM-yyyy HH:mm:ss");
lblMaxAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(chart.Axes.Bottom.Maximum)).ToString("dd-MMM-yyyy HH:mm:ss");
}

private void chart_UndoneZoom(object sender, EventArgs e)
{
lblMinAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(chart.Axes.Bottom.Minimum)).ToString("dd-MMM-yyyy HH:mm:ss");
lblMaxAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(chart.Axes.Bottom.Maximum)).ToString("dd-MMM-yyyy HH:mm:ss");

}

When a zoom occurs the labels will display the correct values. If I create a button an attach the following code

chart.Zoom.Undo();

The chart will correctly reset to the original display and the event will fire but the min and max will not change from the zoomed values. I wait a second and press the button again to do a chart.Zoom.Undo(); and the values will then display the correct unzoom values.

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

Post by Narcís » Thu Oct 05, 2006 2:02 pm

Hi histry,

For this to work you just need to make a call to the Refresh method before updating the labels:

Code: Select all

    private void tChart1_UndoneZoom(object sender, EventArgs e)
    {
      tChart1.Refresh();
      lblMinAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(tChart1.Axes.Bottom.Minimum)).ToString("dd-MMM-yyyy HH:mm:ss");
      lblMaxAbsTime.Text = System.TimeZone.CurrentTimeZone.ToLocalTime(DateTime.FromOADate(tChart1.Axes.Bottom.Maximum)).ToString("dd-MMM-yyyy HH:mm:ss"); 
    }
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

histry
Newbie
Newbie
Posts: 79
Joined: Thu Aug 10, 2006 12:00 am

Unzoom not correctly displaying the min max values

Post by histry » Thu Oct 05, 2006 2:23 pm

That corrects the issue

Thanks

Post Reply