Profile Picture

How to Update X-axis DateTimeScale on Zoom and on Scroll

Posted By Bhumi Patel 12 Years Ago

How to Update X-axis DateTimeScale on Zoom and on Scroll

Author
Message
Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1

Hi,

I have X-axis configured for as a DateTimeScale. I have also added DataPanTool and DataZoomTool in my chart controller. Now, when user zoom in/out or scroll threw chart, I would like to change my X-axis range. Below is my code to configure NDataZoomTool:

nChartControl1.ServerSettings.EnableTiledZoom = true;
nChartControl1.ServerSettings.TileCacheSize = 3000;
NChart chart1 = nChartControl1.Charts[0];

NDataZoomTool dzt = (NDataZoomTool)nChartControl1.Controller.Tools.FindToolOfType(typeof(NDataZoomTool));
dzt.ZoomOutResetsAxes = true;
dzt.Exclusive = true;
dzt.Enabled = false;
dzt.AllowYAxisZoom = false;
dzt.AllowXAxisZoom = true;
dzt.XAxisId = (int)StandardAxis.PrimaryX;

chart1.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
chart1.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = false;

How can I change my X-axis range on zoom in/out OR on scroll change?

Thanks,
Bhumi


Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Bhumi,

What do you mean by "my X range"? Please elaborate...



Best Regards,
Nevron Support Team



Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1
Thank you for your reply!!

I would like to update X-axis values on zoom. Please check attached images: "BeforeZoom.png" is an image before zoom and "AfterZoom.png" is an after zoom image. I would like to display updated datetimescale values on X-axis after zoom. For example, if I zoom in for one day data then, I would like to change the X-axis values and display the datetimescale value in hours instead of just date.

Currently the datetimescale values are not changing on zoom.

Attachments
BeforeZoom.png (129 views, 35.00 KB)
AfterZoom.png (113 views, 33.00 KB)
Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Bhumi,

Check out the Data panning example - it shows how to intercept the scroll / pan callbacks, recalculate the control and obtain correct X / Y ranges. The only difference is that in your case you'll need to implement the DataZoomCallback. The documentation also shows how to implement this callback.



Best Regards,
Nevron Support Team



Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1
Thank you for your reply!!

I have added a logic for ScrollBackTool and its still not updating X-axis DateTime values on scroll. Here is my code for the ScrollBackTool:

nChartControl1.ScrollCallback = new MyScrollCallback();


[Serializable]
public class MyScrollCallback : INScrollbarCallback
{
#region INScrollbarCallback Members
void INScrollbarCallback.OnScroll(NThinChartControl control, NCartesianChart chart, NAxis axis)
{
control.RecalcLayout();

NAxis horzAxis = chart.Axis(StandardAxis.PrimaryX);
NAxis vertAxis = chart.Axis(StandardAxis.PrimaryY);

DateTime startDate = DateTime.FromOADate(horzAxis.Scale.RulerRange.Begin);
DateTime endDate = DateTime.FromOADate(horzAxis.Scale.RulerRange.End);

chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(startDate.ToOADate(), endDate.ToOADate()));
chart.Refresh();
}

#endregion
}


Thanks!!


Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Bhumi,

Most likely the code that configured the axis on the first place specifies static ticks. The code you execute on scroll will not change anything - it will simply reassign the current range. Please submit the full case with support ticket to support@nevron.com for further investigation.



Best Regards,
Nevron Support Team



Bhumi Patel
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)Forum Member (34 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 33, Visits: 1
Thank you for your reply!! I will contact support team for further assistance.



Similar Topics


Reading This Topic