ChartInteractionController
public class ChartInteractionControllerBackend-neutral interaction controller shared by every chart host component
(ChartGuru.ChartComponent, ChartGuru.ChartGraphic,
ChartGuruElement). Consumes chart-space pointer positions (pixels,
bottom-left origin) and forwards them to a ChartGuru.ChartProxy, driving
the same selection, hover, drag-scroll and wheel-zoom behaviour that previously
lived inline in ChartGuru.ChartGraphic.
Hosts translate their native pointer types (uGUI PointerEventData, UI Toolkit
PointerDownEvent, etc.) into Vector2 chartPos + phase and call the
methods below. The controller stays UI-framework agnostic so the same logic is
reused across the three backends.
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 + proxy pair. Passing null detaches.
Parameters
| Name | Type |
|---|---|
chart |
ChartGuru.Chart |
proxy |
ChartGuru.ChartProxy |
Tap(Vector2)
Section titled “Tap(Vector2)”public void Tap(Vector2 chartPos)Handle a click / tap at the given chart-space position. Toggles selection
at the mark containing the pointer when ChartGuru.ChartInteractionController.EnableSelection is true.
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
HoverMove(Vector2)
Section titled “HoverMove(Vector2)”public void HoverMove(Vector2 chartPos)Handle hover-move at the given chart-space position. Updates
ChartGuru.Chart.HoveredIndex and raises ChartGuru.ChartInteractionController.HoverChanged /
ChartGuru.ChartInteractionController.DataPointHovered when the hovered mark changes.
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
HoverExit()
Section titled “HoverExit()”public void HoverExit()Clears the hover state, e.g. when the pointer leaves the chart surface.
DragBegin(Vector2)
Section titled “DragBegin(Vector2)”public void DragBegin(Vector2 chartPos)Start a drag gesture. Records chartPos as the anchor for subsequent updates.
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
DragUpdate(Vector2)
Section titled “DragUpdate(Vector2)”public void DragUpdate(Vector2 chartPos)Update an in-flight drag. Routes to viewport scrolling (when
ChartGuru.ChartInteractionController.EnableViewportDrag is enabled and the chart is scrollable) or
drag-selection (when ChartGuru.ChartInteractionController.EnableDragSelection is enabled).
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
DragEnd(Vector2)
Section titled “DragEnd(Vector2)”public void DragEnd(Vector2 chartPos)End a drag gesture.
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
Wheel(Vector2, float)
Section titled “Wheel(Vector2, float)”public void Wheel(Vector2 chartPos, float scrollDelta)Handle a scroll-wheel / pinch gesture. Zooms around the cursor by a factor
derived from scrollDelta and ChartGuru.ChartInteractionController.ViewportZoomSensitivity.
Parameters
| Name | Type |
|---|---|
chartPos |
UnityEngine.Vector2 |
scrollDelta |
System.Single |
Constructors
Section titled “Constructors”
ChartInteractionController()
Section titled “ChartInteractionController()”public ChartInteractionController()Properties
Section titled “Properties”
EnableSelection
Section titled “EnableSelection”public bool EnableSelection { get; set; }Allow the controller to toggle selection on pointer tap.
Returns
System.Boolean
EnableHoverHighlight
Section titled “EnableHoverHighlight”public bool EnableHoverHighlight { get; set; }Allow the controller to update ChartGuru.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 drag gestures inside the plot area to run a rubber-band selection.
Returns
System.Boolean
BrushAxes
Section titled “BrushAxes”public ChartBrushAxes BrushAxes { get; set; }Axes captured as continuous ranges during drag selection. The default
ChartGuru.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 to zoom the viewport.
Returns
System.Boolean
ViewportZoomSensitivity
Section titled “ViewportZoomSensitivity”public float ViewportZoomSensitivity { get; set; }Multiplier applied to scroll delta when computing zoom factor.
Returns
System.Single
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 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 chart-space pointer 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}
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