We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Visible Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

145995 Jul 17,2019 02:29 AM UTC Jul 18,2019 04:52 AM UTC WinForms 3
loading
Tags: Chart
Ola Mallaug
Asked On July 17, 2019 02:29 AM UTC

I'm zooming in on a chart and want to know the start and end time.

I use chart.Series[0].XAxis.VisibleRange.Min, the value in my test is 43599.326504629629.

How can I translate this number to date/time?

Any suggestions?

Baby Palanidurai [Syncfusion]
Replied On July 17, 2019 06:55 AM UTC

Hi Ola, 

Greetings from Syncfusion. 

We have analyzed your query. Your requirement has been achieved by visibleRangeChanged event. This event will trigger whenever range is changed during the zooming. In this event, we can get the min and max range from the primary x axis VisibleRange object.  And you can convert it to the date time from the number in this event.  

For more information about visibleRangeChanged Event, kindly find the below documentation link, 

Please find the below code snippet to achieve this requirement, 

this.chart1.VisibleRangeChanged += Chart1_VisibleRangeChanged; 

private void Chart1_VisibleRangeChanged(object sender, EventArgs e) 
        { 
            //Maximum value of x axis while zooming 
            var maxValue = chart1.PrimaryXAxis.VisibleRange.Max; 
            //Mimimum value of x axis while zooming 
            var minValue = chart1.PrimaryXAxis.VisibleRange.Min; 
            //convert double value to DateTime value 
            DateTime max = DateTime.FromOADate(maxValue); 
            DateTime min = DateTime.FromOADate(minValue); 
            MessageBox.Show("Max:" + max + "\n" + "Min:" + min); 
        } 

Screenshot: 
 


Kindly revert us, if you have any concerns. 


Regards, 
Baby. 


Ola Mallaug
Replied On July 17, 2019 06:39 PM UTC

Perfect, that is what I was looking for.

Thanks!

Baby Palanidurai [Syncfusion]
Replied On July 18, 2019 04:52 AM UTC

Hi Ola, 


Most welcome. Kindly revert us, if you need any further assistance on this. We are always happy in assisting you.


Thanks,
Baby. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon