Implement zooming, panning and axis scrolling in Nevron Chart for .NET

Applies to: Nevron Chart for .NET

How to implement zooming, panning and axis scrolling in Nevron Chart for .NET?

Nevron Chart for .NET provides support for mouse events and a number of interactivity tools like: Tooltip Tool, Cursor Tool, Zoom Tool, Trackball Tool, Data Zoom Tool, Data Pan Tool, Data Point Drag Tool, Data Cursor Tool and Axis Scroll Tool.

The following code shows how to implement zooming (zoom-in and zoom-out), panning and axis scrolling in a 2D point chart:

using System;
using System.Windows.Forms;
using Nevron.Chart;
using Nevron.Chart.WinForm;
using Nevron.GraphicsCore;
NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
chart.RangeSelections.Add(new NRangeSelection());
chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true;
chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
chart.BoundsMode = BoundsMode.Stretch;
NPointSeries point = new NPointSeries();
point.UseXValues = true;
point.DataLabelStyle.Visible = false;
point.PointShape = PointShape.Ellipse;
Random rand = new Random();
for (int i = 0; i < 100; i++)
nChartControl1.Controller.Tools.Add(new NSelectorTool());
nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
nChartControl1.Controller.Tools.Add(new NDataZoomTool());
NDataPanTool dpt = new NDataPanTool();

Imports Nevron.Chart
Imports Nevron.GraphicsCore
Imports Nevron.Chart.WinForm
Dim chart As NCartesianChart = DirectCast(NChartControl1.Charts(0), NCartesianChart)
chart.RangeSelections.Add(New NRangeSelection())
chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = True
chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = True
chart.BoundsMode = BoundsMode.Stretch
Dim point As New NPointSeries()
point.UseXValues = True
point.DataLabelStyle.Visible = False
point.PointShape = PointShape.Ellipse
Dim rand As New Random()
For i As Integer = 0 To 99
NChartControl1.Controller.Tools.Add(New NSelectorTool())
NChartControl1.Controller.Tools.Add(New NAxisScrollTool())
NChartControl1.Controller.Tools.Add(New NDataZoomTool())
Dim dpt As New NDataPanTool()

Please note that axis scrolling is not yet supported in 3D charts and some interactivity features are not supported in ASP.NET.

Related WinForms Examples:
Nevron Chart for .NET: All Examples > Interactivity

For more details, take a look at the Online Documentation
Chart for .NET > User's Guide > Interactivity

Article ID: 185, Created On: 3/29/2011, Modified: 3/29/2011