Skip to content

ChartHitResult

StructChartGuruChartGuru
public readonly struct ChartHitResult

A shape-aware hit result. ChartHitResult.Position is in the host's surface pixels with a bottom-left origin; hits on 3D charts also carry the world point, the ray distance and the data value under the pointer.

ChartHitResult(int, ChartHitKind, Vector2, Rect, Color)

Section titled “ChartHitResult(int, ChartHitKind, Vector2, Rect, Color)”
public ChartHitResult(int markIndex, ChartHitKind kind, Vector2 position, Rect bounds, Color color)

Creates a shape-aware 2D hit result.

Parameters

NameType
markIndexSystem.Int32
kindChartGuru.ChartHitKind
positionUnityEngine.Vector2
boundsUnityEngine.Rect
colorUnityEngine.Color

ChartHitResult(int, ChartHitKind, Vector2, Rect, Color, Vector3, float, DataPoint3D)

Section titled “ChartHitResult(int, ChartHitKind, Vector2, Rect, Color, Vector3, float, DataPoint3D)”
public ChartHitResult(int markIndex, ChartHitKind kind, Vector2 position, Rect bounds, Color color, Vector3 worldPosition, float distance, DataPoint3D value)

Creates a 3D hit result with the world point, ray distance and data value under the pointer.

Parameters

NameType
markIndexSystem.Int32
kindChartGuru.ChartHitKind
positionUnityEngine.Vector2
boundsUnityEngine.Rect
colorUnityEngine.Color
worldPositionUnityEngine.Vector3
distanceSystem.Single
valueChartGuru.DataPoint3D

public static ChartHitResult None { get; }

A reusable invalid hit value.

Returns

ChartGuru.ChartHitResult

public int MarkIndex { get; }

Index of the hit mark in Chart.Marks; -1 for hits on the plot of a 3D chart.

Returns

System.Int32

public ChartHitKind Kind { get; }

Kind of rendered geometry that was hit.

Returns

ChartGuru.ChartHitKind

public Vector2 Position { get; }

Preferred tooltip anchor in the host’s surface pixels.

Returns

UnityEngine.Vector2

public Rect Bounds { get; }

Rendered mark bounds in surface pixels when known.

Returns

UnityEngine.Rect

public Color Color { get; }

Rendered mark color when known.

Returns

UnityEngine.Color

public Vector3 WorldPosition { get; }

World-space point that was hit on a 3D chart.

Returns

UnityEngine.Vector3

public float Distance { get; }

Distance from the pointer ray’s origin to ChartHitResult.WorldPosition.

Returns

System.Single

public DataPoint3D Value { get; }

Data value under the pointer on a 3D chart: the mark’s value, or the interpolated surface or plot value.

Returns

ChartGuru.DataPoint3D

public bool HasWorldPosition { get; }

True for hits on 3D charts, which carry ChartHitResult.WorldPosition, ChartHitResult.Distance and ChartHitResult.Value.

Returns

System.Boolean

public bool IsValid { get; }

True when this result refers to a rendered mark.

Returns

System.Boolean