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.
Unzoom not correctly displaying the min max values
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi histry,
For this to work you just need to make a call to the Refresh method before updating the labels:
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 |
Instructions - How to post in this forum |
Unzoom not correctly displaying the min max values
That corrects the issue
Thanks
Thanks