
iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x
Custom Modifiers - the SCIChartModifierBase API
The SCIChartModifierBase
API is by far the most powerful API in the SciChart library.
The SCIChartModifierBase
provides an abstract base class for all of the 2D ChartModifiers within SciChart, all of our built-in 2D modifiers inherit from it.
Using this API, you can create behaviours which you can attach to a chart to perform custom Zooming, Panning, Annotation & Markers, Legend output and much much more.
Any time you want to do something to alter the behaviour of a SCIChartSurface
you should be thinking about creating a custom modifier to do it.
Custom Chart Rotation Modifier
A simple example below shows how you can use SCIChartModifierBase
API to create a chart rotation modifier.
Add it onto your chart like any other modifier to see how it works.
Let’s get to the code:
NOTE: It’s highly recommended to inherit from
SCIChartModifierBase
since it gives you some of the base implementation for free.
The modifier above allows to rotate a chart when added to its SCIChartModifierCollection
.
The common methods that are currently implemented and are not likely to be replaced can be found in the Chart Modifier APIs article.
For more information - please read the ISCIChartModifier
API documentation.
NOTE: If you want to handle gestures in your custom ChartModifier, you could derive it from the
SCIGestureModifierBase
class, which provides base infrastructure forUIGestureRecognizer
usage.
The SCIModifierEventArgs Type
If your custom ChartModifier requires to handle touch events or gestures, you might need to override the -[ISCIReceiveEvents onEvent:]
method.
It receive the only parameter of the SCIModifierEventArgs
type. This type exposes the following information about an event that occurred:
Field | Description |
---|---|
SCIModifierEventArgs.source |
Provides the source of the event, of the ISCIReceiveEvents type. |
SCIModifierEventArgs.isMaster |
Gets whether the event occurred on the ParentSurface or was propagated through EventGroup. |
SCIModifierEventArgs.isInSourceBounds |
Reports whether the event occurred within the Source. |
SCIModifierEventArgs.isHandled |
Reports whether the event has been already passed to any other modifier and handled by it. |
SCIModifierEventArgs.e |
Returns the ISCIEvent instance. |
NOTE: To receive handled events, set
ISCIReceiveEvents.receiveHandledEvents
on a modifier toYES
.