Skip to content

ChartInteractionController

ClassChartGuruChartGuru
public class ChartInteractionController

Turns 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.

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.

public ChartInteractionController()

Creates an unbound controller; call ChartInteractionController.Bind(Chart, ChartProxy) before feeding pointers.

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

NameType
chartChartGuru.Chart
proxyChartGuru.ChartProxy
public void Process(in ChartPointer pointer)

Feeds one pointer event.

Parameters

NameType
pointerChartGuru.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

NameType
pointerChartGuru.ChartPointer

Returns

System.Boolean

public void Tick(float timestamp)

Advances time-based gestures such as a long press. Hosts call it every frame while ChartInteractionController.IsPressed.

Parameters

NameType
timestampSystem.Single
public void CancelAll()

Stops every press without a tap, for example when the host is disabled during a drag.

public bool EnableSelection { get; set; }

Allow built-in tap and axis selection, and configured ChartGesture.SelectionGesture(ChartProxy) input.

Returns

System.Boolean

public bool EnableHoverHighlight { get; set; }

Allow the controller to update Chart.HoveredIndex during pointer move.

Returns

System.Boolean

public bool EnableHoverTracking { get; set; }

Allow hit tracking for overlays even when visual hover highlighting is disabled.

Returns

System.Boolean

public bool EnableDragSelection { get; set; }

Allow rubber-band selection, or press and drag selection with ChartGesture.SelectionGesture(ChartProxy).

Returns

System.Boolean

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

public bool EnableViewportDrag { get; set; }

Allow drag gestures to scroll the viewport.

Returns

System.Boolean

public bool EnableViewportZoom { get; set; }

Allow the scroll wheel and pinch to zoom the viewport.

Returns

System.Boolean

public float ZoomSensitivity { get; set; }

Zoom change per wheel step, as a fraction of the visible span.

Returns

System.Single

public float DragThreshold { get; set; }

Surface pixels a press may move before it becomes a drag instead of a tap.

Returns

System.Single

public float DoubleTapInterval { get; set; }

Longest time between two taps that count as a double tap, in seconds.

Returns

System.Single

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

public ChartGesture Gesture { get; }

The chart’s custom gesture, which replaces the built-in drag, zoom and orbit handling.

Returns

ChartGuru.ChartGesture

public bool IsPressed { get; }

True while a press, drag or pinch is in progress.

Returns

System.Boolean

public bool IsDragging { get; }

True while a press has turned into a drag or pinch.

Returns

System.Boolean

public ChartHitResult CurrentHit { get; }

The most recent shape-aware hover hit.

Returns

ChartGuru.ChartHitResult

public event Action<int, DataPoint> DataPointClicked

Raised when the user clicks on a mark and selection is enabled.

Returns

System.Action{System.Int32,ChartGuru.DataPoint}

public event Action<int, DataPoint> DataPointSelected

Raised when a tap or configured selection gesture changes the selected mark.

Returns

System.Action{System.Int32,ChartGuru.DataPoint}

public event Action<int, DataPoint> DataPointHovered

Raised when tracked hover moves to a different mark, independently of visual highlighting.

Returns

System.Action{System.Int32,ChartGuru.DataPoint}

public event Action SelectionCleared

Raised when a tap clears the current point selection.

Returns

System.Action

public event Action<int> HoverChanged

Raised whenever the hovered-index changes. -1 when no hover.

Returns

System.Action{System.Int32}

public event Action<ChartHitResult, Vector2> PointerHitMoved

Raised on every tracked pointer move with the current shape-aware hit and surface position.

Returns

System.Action{ChartGuru.ChartHitResult,UnityEngine.Vector2}

public event Action<ChartHitResult, Vector2> PointerTapped

Raised for every tap, including taps that do not hit a mark.

Returns

System.Action{ChartGuru.ChartHitResult,UnityEngine.Vector2}

public event Action<Vector2> DoubleTapped

Raised for the second tap of a double tap, after the view returned to where the user started.

Returns

System.Action{UnityEngine.Vector2}

public event Action PointerExited

Raised when the pointer leaves the chart surface.

Returns

System.Action

public event Action RenderRequested

Raised by the controller when the chart needs to be re-rendered. Hosts should invalidate their surface.

Returns

System.Action