iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x

The SCIYAxisDragModifier

SciChart iOS provides scale or pan an Y Axis via the SCIYAxisDragModifier, available out of the box.

Besides common features which are inherited from the SCIChartModifierBase class, the SCIYAxisDragModifier allows to control its specific features via the following properties:

Adding a SCIYAxisDragModifier to a Chart

Any Chart Modifier can be added to a SCIChartSurface via the ISCIChartSurface.chartModifiers property and SCIYAxisDragModifier is no difference:

// Assume a surface has been created and configured somewhere id<ISCIChartSurface> surface; // Create a Modifier SCIYAxisDragModifier *yAxisDragModifier = [SCIYAxisDragModifier new]; yAxisDragModifier.dragMode = SCIAxisDragMode_Pan; // Add the modifier to the surface [self.surface.chartModifiers add:yAxisDragModifier];
// Assume a surface has been created and configured somewhere let surface: ISCIChartSurface // Create a Modifier let yAxisDragModifier = SCIYAxisDragModifier() yAxisDragModifier.dragMode = .pan // Add the modifier to the surface self.surface.chartModifiers.add(yAxisDragModifier)
// Assume a surface has been created and configured somewhere IISCIChartSurface surface; // Create a Modifier var yAxisDragModifier = new SCIYAxisDragModifier(); yAxisDragModifier.dragMode = SCIAxisDragMode.Pan; // Add the modifier to the surface Surface.ChartModifiers.Add(yAxisDragModifier);

Include/Exclude Certain Axis

The SCIYAxisDragModifier allows you to include or exclude certain axis from the axis drag operation. This feature is especially useful in multiple-axis charts, where you may want to zoom/pan only selected axes while keeping others fixed. By default all axis are included, to exclude one or more Y axis, set the following property:

// Exclude a specific axis from the pan zoom operation [yAxisDragModifier includeYAxis:yAxis isIncluded:NO]; // Include a specific axis from the pan zoom operation [yAxisDragModifier includeYAxis:yAxis isIncluded:YES]; // Reset flags [yAxisDragModifier includeAll]; [yAxisDragModifier excludeAll];
// Exclude a specific axis from the pan zoom operation yAxisDragModifier.includeYAxis(yAxis, isIncluded: false) // Include a specific axis from the pan zoom operation yAxisDragModifier.includeYAxis(yAxis, isIncluded: true) // Reset flags yAxisDragModifier.includeAll() yAxisDragModifier.excludeAll()

NOTE: To learn more about features available, please visit the Chart Modifier APIs article.

SCIAxisDragModifier

SciChart has introduced a new modifier, SCIAxisDragModifier, which combines the functionality of both SCIXAxisDragModifier and SCIYAxisDragModifier. This unified modifier allows you to configure drag behavior for the X-axis, Y-axis, or both axes simultaneously, eliminating the need to declare two separate modifiers.

Why Use SCIAxisDragModifier?

Previously, to enable drag interactions on both axes, you needed to add:

With the new SCIAxisDragModifier, you can now accomplish the same behavior plus combined-axis dragging with one modifier.

SCIAxisDragModifier *axisDragModifier = [SCIAxisDragModifier new]; // Choose the drag behavior: zoom (SCIDragMode_Scale) or pan (SCIDragMode_Pan) axisDragModifier.dragMode = SCIDragMode_Scale; // or SCIDragMode_Pan // Choose affected axis/axes axisDragModifier.direction = SCIDirection_YDirection; // Y axis //axisDragModifier.direction = SCIDirection_XDirection; // X axis // axisDragModifier.direction = SCIDirection_XYDirection; // Both axes together
let axisDragModifier = SCIAxisDragModifier() // Choose the drag behavior: zoom (.scale) or pan (.pan) axisDragModifier.dragMode = .scale // or .pan // Choose affected axis/axes axisDragModifier.direction = .yDirection // Y axis // axisDragModifier.direction = .xDirection // X axis // axisDragModifier.direction = .xyDirection // Both axes together

NOTE: For new projects, SciChart recommends using SCIAxisDragModifier as the preferred, modern, and more flexible approach to axis dragging.