Nevron Forum

How to add zoom functionality on chart when finger pinch to zoom

https://www.nevron.com/Forum/Topic13123.aspx

By shweta jain - Sunday, November 8, 2020

Hello,

Is Nevron chart support finger touch interactivity ?.
I want to add zoom functionality on finger pinch to zoom. Is it possible?
Please suggest some idea for How can I implement this zoom on finger pinch on Nevron chart.
By Nevron Support - Tuesday, November 10, 2020

Hi Sweta,

The control does not have touch support for interactivity operations yet. You generally have to implement custom zooming in response to touch events.
By shweta jain - Thursday, November 12, 2020

Hello,
 Is it possible to control zoom control like by passing zoom in percentage on specified value?
Can u Please provide some code/reference related to how to implement custom zoom on chart?
By Nevron Support - Monday, November 16, 2020

Hi Shweta,
The following code shows how to zoom in to a specified range on a particular axis:
NChart chart = nChartControl1.Charts[0];

NBarSeries bar = new NBarSeries();
chart.Series.Add(bar);

bar.DataLabelStyle.Visible = false;

bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);

// make sure all internal values are updated
nChartControl1.RecalcLayout();

// zoom in
NNumericAxisPagingView view = new NNumericAxisPagingView();
chart.Axis(StandardAxis.PrimaryX).PagingView = view;
view.ZoomIn(new NRange1DD(0.5, 1.5), 0);

Zooming this way (instead of using the NRangeAxisView) ensures you can also activate scrolling/panning later. We hope this helps - let us know if you have any questions.