Start and End when zooming
I have a line chart with values on the Y-Axis and Time on the X-Axis.
When I zoom in on the X-Axis, I would like to know start time and end time on the X-Axis.
I suspect this can be obtained from "PrimaryXAxis.VisibleRange" or "PrimaryXAxis.ZoomedRange"
The problem is that I don't know how to convert the number from these into a date/time.
Any suggestions?
SIGN IN To post a reply.
3 Replies
BP
Baby Palanidurai
Syncfusion Team
May 20, 2019 08:34 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:
Sample link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/chartRange-1887357911
Kindly revert us, if you have any concerns.
Regards,
Baby.
OM
Ola Mallaug
May 23, 2019 01:55 AM UTC
Thank you very much. The best part of Syncfusion is good service always!
BP
Baby Palanidurai
Syncfusion Team
May 23, 2019 05:33 AM UTC
Hi Ola,
Most welcome. Kindly revert us, if you need further assistance. We are always happy in assisting you.
Regards,
Baby.
Most welcome. Kindly revert us, if you need further assistance. We are always happy in assisting you.
Regards,
Baby.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
OM Ola Mallaug
- May 17, 2019 04:06 PM UTC
- May 23, 2019 05:33 AM UTC