Skip to content

DataPoint

StructChartGuruChartGuru
public struct DataPoint

A single data point for chart rendering. Blittable struct optimized for GPU upload. Size: 32 bytes for cache-line friendly layout.

public float X

X-axis Value (primary axis).

Returns

System.Single

public float Y

Y-axis Value (value axis).

Returns

System.Single

public float XEnd

Optional X-end for range data (Gantt charts, range bars).

Returns

System.Single

public float YEnd

Optional Y-end for range data.

Returns

System.Single

public int SeriesIndex

Series index for multi-series charts (assigned during grouping).

Returns

System.Int32

public int Id

Value identity used by DataPoint.Equals(DataPoint), derived deterministically from the values unless given. An id given to the id constructor also names the mark for transitions and selection through MarkKey, like Swift’s ForEach(data, id:).

Returns

System.Int32

public int CategoryIndex

Category index for categorical X values.

Returns

System.Int32

public DataPoint(float x, float y)

Creates a scalar XY point whose end coordinates match its start and whose stable identity is derived from both values.

Parameters

NameType
xSystem.Single
ySystem.Single
public DataPoint(float x, float y, int id)

Creates a scalar XY point with a caller-chosen value identity.

Parameters

NameType
xSystem.Single
ySystem.Single
idSystem.Int32
public DataPoint(float x, float y, float xEnd, float yEnd)

Creates a two-dimensional range point and derives its stable identity from all four boundaries.

Parameters

NameType
xSystem.Single
ySystem.Single
xEndSystem.Single
yEndSystem.Single

public readonly bool Equals(DataPoint other)

Parameters

NameType
otherChartGuru.DataPoint

Returns

System.Boolean

public override readonly bool Equals(object obj)

Parameters

NameType
objSystem.Object

Returns

System.Boolean

public override readonly int GetHashCode()

Returns

System.Int32

public static DataPoint Lerp(DataPoint a, DataPoint b, float t)

Linearly interpolates between two data points.

Parameters

NameType
aChartGuru.DataPoint
bChartGuru.DataPoint
tSystem.Single

Returns

ChartGuru.DataPoint

public override readonly string ToString()

Returns

System.String

public static bool operator ==(DataPoint left, DataPoint right)

Reports whether both points have the same stable identity hash.

Parameters

NameType
leftChartGuru.DataPoint
rightChartGuru.DataPoint

Returns

System.Boolean

public static bool operator !=(DataPoint left, DataPoint right)

Reports whether the points have different stable identity hashes.

Parameters

NameType
leftChartGuru.DataPoint
rightChartGuru.DataPoint

Returns

System.Boolean

public readonly bool IsRange { get; }

Whether this point represents a range (has different start/end).

Returns

System.Boolean

public readonly float2 Position { get; }

Gets the position as a float2 (X, Y).

Returns

Unity.Mathematics.float2

public readonly float2 EndPosition { get; }

Gets the end position for range data as a float2.

Returns

Unity.Mathematics.float2

public readonly float2 CenterPosition { get; }

Gets the center position for range data.

Returns

Unity.Mathematics.float2

public readonly float Width { get; }

Gets the width of the range (XEnd - X).

Returns

System.Single

public readonly float Height { get; }

Gets the height of the range (YEnd - Y).

Returns

System.Single