ChartInteractionController
public class ChartInteractionControllerTurns a host's pointer stream into chart interaction: hover tracking and highlight, tap selection, double tap,
drag selection, viewport pan and zoom for 2D charts, orbit for 3D charts, two-finger pinch and the chart's
custom ChartGesture.
Remarks
Section titled “Remarks”Every host (ChartGraphic, ChartGuruElement and world-space charts) translates its native
pointer events into ChartPointer values and calls ChartInteractionController.Process(in ChartPointer), so all hosts behave alike
and the runtime reads no input API. A press becomes a drag once it moves farther than
ChartInteractionController.DragThreshold; otherwise releasing it is a tap.
Constructors
Section titled “Constructors”
ChartInteractionController()
Section titled “ChartInteractionController()”public ChartInteractionController()Creates an unbound controller; call ChartInteractionController.Bind(Chart, ChartProxy) before feeding pointers.
Methods
Section titled “Methods”
Bind(Chart, ChartProxy)
Section titled “Bind(Chart, ChartProxy)”public void Bind(Chart chart, ChartProxy proxy)Associates the controller with a chart and proxy, and creates the chart’s custom gesture. Passing null
detaches. Any press in progress is cancelled.
Parameters
| Name | Type |
|---|---|
chart | ChartGuru.Chart |
proxy | ChartGuru.ChartProxy |
Process(in ChartPointer)
Section titled “Process(in ChartPointer)”public void Process(in ChartPointer pointer)Feeds one pointer event.
Parameters
| Name | Type |
|---|---|
pointer | ChartGuru.ChartPointer |
TryProcess(in ChartPointer)
Section titled “TryProcess(in ChartPointer)”public bool TryProcess(in ChartPointer pointer)Feeds one pointer event and reports whether the chart handled it. Hosts can pass an unhandled wheel event to a parent scroll view. A custom gesture consumes wheel input only when it is a magnification gesture.
Parameters
| Name | Type |
|---|---|
pointer | ChartGuru.ChartPointer |
Returns
System.Boolean
Tick(float)
Section titled “Tick(float)”public void Tick(float timestamp)Advances time-based gestures such as a long press. Hosts call it every frame while ChartInteractionController.IsPressed.
Parameters
| Name | Type |
|---|---|
timestamp | System.Single |
CancelAll()
Section titled “CancelAll()”public void CancelAll()Stops every press without a tap, for example when the host is disabled during a drag.
Properties
Section titled “Properties”
EnableSelection
Section titled “EnableSelection”public bool EnableSelection { get; set; }Allow built-in tap and axis selection, and configured ChartGesture.SelectionGesture(ChartProxy) input.
Returns
System.Boolean
EnableHoverHighlight
Section titled “EnableHoverHighlight”public bool EnableHoverHighlight { get; set; }Allow the controller to update Chart.HoveredIndex during pointer move.
Returns
System.Boolean
EnableHoverTracking
Section titled “EnableHoverTracking”public bool EnableHoverTracking { get; set; }Allow hit tracking for overlays even when visual hover highlighting is disabled.
Returns
System.Boolean
EnableDragSelection
Section titled “EnableDragSelection”public bool EnableDragSelection { get; set; }Allow rubber-band selection, or press and drag selection with ChartGesture.SelectionGesture(ChartProxy).
Returns
System.Boolean
BrushAxes
Section titled “BrushAxes”public ChartBrushAxes BrushAxes { get; set; }Axes captured as continuous ranges during drag selection. The default
ChartBrushAxes.None retains nearest-X point selection.
Returns
ChartGuru.ChartBrushAxes
EnableViewportDrag
Section titled “EnableViewportDrag”public bool EnableViewportDrag { get; set; }Allow drag gestures to scroll the viewport.
Returns
System.Boolean
EnableViewportZoom
Section titled “EnableViewportZoom”public bool EnableViewportZoom { get; set; }Allow the scroll wheel and pinch to zoom the viewport.
Returns
System.Boolean
ZoomSensitivity
Section titled “ZoomSensitivity”public float ZoomSensitivity { get; set; }Zoom change per wheel step, as a fraction of the visible span.
Returns
System.Single
DragThreshold
Section titled “DragThreshold”public float DragThreshold { get; set; }Surface pixels a press may move before it becomes a drag instead of a tap.
Returns
System.Single
DoubleTapInterval
Section titled “DoubleTapInterval”public float DoubleTapInterval { get; set; }Longest time between two taps that count as a double tap, in seconds.
Returns
System.Single
LongPressDuration
Section titled “LongPressDuration”public float LongPressDuration { get; set; }How long a press is held for a long-press gesture that sets no duration of its own, in seconds.
Returns
System.Single
Gesture
Section titled “Gesture”public ChartGesture Gesture { get; }The chart’s custom gesture, which replaces the built-in drag, zoom and orbit handling.
Returns
ChartGuru.ChartGesture
IsPressed
Section titled “IsPressed”public bool IsPressed { get; }True while a press, drag or pinch is in progress.
Returns
System.Boolean
IsDragging
Section titled “IsDragging”public bool IsDragging { get; }True while a press has turned into a drag or pinch.
Returns
System.Boolean
CurrentHit
Section titled “CurrentHit”public ChartHitResult CurrentHit { get; }The most recent shape-aware hover hit.
Returns
ChartGuru.ChartHitResult
Events
Section titled “Events”
DataPointClicked
Section titled “DataPointClicked”public event Action<int, DataPoint> DataPointClickedRaised when the user clicks on a mark and selection is enabled.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
DataPointSelected
Section titled “DataPointSelected”public event Action<int, DataPoint> DataPointSelectedRaised when a tap or configured selection gesture changes the selected mark.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
DataPointHovered
Section titled “DataPointHovered”public event Action<int, DataPoint> DataPointHoveredRaised when tracked hover moves to a different mark, independently of visual highlighting.
Returns
System.Action{System.Int32,ChartGuru.DataPoint}
SelectionCleared
Section titled “SelectionCleared”public event Action SelectionClearedRaised when a tap clears the current point selection.
Returns
System.Action
HoverChanged
Section titled “HoverChanged”public event Action<int> HoverChangedRaised whenever the hovered-index changes. -1 when no hover.
Returns
System.Action{System.Int32}
PointerHitMoved
Section titled “PointerHitMoved”public event Action<ChartHitResult, Vector2> PointerHitMovedRaised on every tracked pointer move with the current shape-aware hit and surface position.
Returns
System.Action{ChartGuru.ChartHitResult,UnityEngine.Vector2}
PointerTapped
Section titled “PointerTapped”public event Action<ChartHitResult, Vector2> PointerTappedRaised for every tap, including taps that do not hit a mark.
Returns
System.Action{ChartGuru.ChartHitResult,UnityEngine.Vector2}
DoubleTapped
Section titled “DoubleTapped”public event Action<Vector2> DoubleTappedRaised for the second tap of a double tap, after the view returned to where the user started.
Returns
System.Action{UnityEngine.Vector2}
PointerExited
Section titled “PointerExited”public event Action PointerExitedRaised when the pointer leaves the chart surface.
Returns
System.Action
RenderRequested
Section titled “RenderRequested”public event Action RenderRequestedRaised by the controller when the chart needs to be re-rendered. Hosts should invalidate their surface.
Returns
System.Action