Skip to content

DataSeries<TKey>

ClassChartGuruChartGuru
public class DataSeries<TKey>

Ordered numeric series with an optional display name and source values for plot construction.

public DataSeries()

public DataSeries(TKey key)

Creates an empty series and derives its initial display name from the series key.

Parameters

Name Type
key {TKey}
public DataSeries(TKey key, IEnumerable<DataPoint> points)

Creates a keyed series and imports points in enumeration order, assigning series metadata and missing identities.

Parameters

Name Type
key {TKey}
points System.Collections.Generic.IEnumerable{ChartGuru.DataPoint}
public DataSeries(TKey key, Color color)

Creates an empty keyed series with an explicit mark color.

Parameters

Name Type
key {TKey}
color UnityEngine.Color

public void Add(DataPoint point)

Appends a point, assigns this series index and a missing identity, updates bounds, and raises collection and data notifications.

Parameters

Name Type
point ChartGuru.DataPoint
public void Add(float x, float y)

Creates and appends a point at the supplied coordinates using the normal identity and notification behavior.

Parameters

Name Type
x System.Single
y System.Single
public void AddRange(IEnumerable<DataPoint> points)

Appends points in enumeration order, assigns series metadata and missing identities, then raises one reset notification.

Parameters

Name Type
points System.Collections.Generic.IEnumerable{ChartGuru.DataPoint}
public void AddRange(IEnumerable<(float x, float y)> points)

Creates and appends one point for each coordinate pair in enumeration order.

Parameters

Name Type
points System.Collections.Generic.IEnumerable{System.ValueTuple{System.Single,System.Single}}
public void RemoveAt(int index)

Removes the entry at the supplied index, updates series indices, and raises change notifications.

Parameters

Name Type
index System.Int32
public void Clear()

Removes all points, resets cached bounds, and raises reset and data-change notifications.

public NativeList<DataPoint> GetNativeData(Allocator allocator = 3)

Returns the series-owned native point buffer, allocating it with the requested allocator on first use and synchronizing it after managed data changes. Callers must not dispose the returned buffer; dispose the series to release it.

Parameters

Name Type
allocator Unity.Collections.Allocator

Returns

Unity.Collections.NativeList{ChartGuru.DataPoint}

public void CopyToNative(ref NativeList<DataPoint> destination)

Copies current numeric values into a caller-owned native array without changing series state.

Parameters

Name Type
destination Unity.Collections.NativeList{ChartGuru.DataPoint}
public void ClearDirty()

Clears dirty from this Data Series without changing unrelated configuration.

public IEnumerator<DataPoint> GetEnumerator()

Enumerates points in insertion order without copying the series.

Returns

System.Collections.Generic.IEnumerator{ChartGuru.DataPoint}

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Section titled “OnCollectionChanged(NotifyCollectionChangedEventArgs)”
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)

Forwards collection changes as series data changes after maintaining entry indices.

Parameters

Name Type
e System.Collections.Specialized.NotifyCollectionChangedEventArgs
public void Dispose()

Releases resources owned by this Data Series; callers should not use the instance afterward.

public TKey Key { get; set; }

Returns

{TKey}

public string Name { get; set; }

Returns

System.String

public Color Color { get; set; }

Returns

UnityEngine.Color

public bool Visible { get; set; }

Returns

System.Boolean

public int SeriesIndex { get; }

Returns

System.Int32

public int Count { get; }

Returns

System.Int32

public bool IsDirty { get; }

Returns

System.Boolean

public float MinY { get; }

Returns

System.Single

public float MaxY { get; }

Returns

System.Single

public float MinX { get; }

Returns

System.Single

public float MaxX { get; }

Returns

System.Single

public DataPoint this[int index] { get; set; }

Parameters

Name Type
index System.Int32

Returns

ChartGuru.DataPoint

public event NotifyCollectionChangedEventHandler CollectionChanged

Raised after entries are inserted, removed, replaced, or reset.

Returns

System.Collections.Specialized.NotifyCollectionChangedEventHandler

public event Action<DataSeries<TKey>> DataChanged

Raised after series values or metadata change and attached charts should refresh.

Returns

System.Action{ChartGuru.DataSeries`1}