RingBufferChartDataSource
[AddComponentMenu("")][DisallowMultipleComponent]public class RingBufferChartDataSource : ChartDataSourceBase, IChartDataSourceHigh-throughput live data source built around a fixed-capacity ring
buffer. Producers call ChartGuru.RingBufferChartDataSource.Push(System.Single) /
ChartGuru.RingBufferChartDataSource.Push(System.Single%2cSystem.Single) from anywhere (including hot game-loop
code or a background thread), and the buffer flushes to the chart once
per frame in ChartGuru.RingBufferChartDataSource.LateUpdate.
The component uses `ChartGuru.Chart.SetValues(System.Collections.Generic.IEnumerable%7bSystem.Single%7d)` when the chart's mark count already matches `ChartGuru.RingBufferChartDataSource.Capacity`, falling back to `ChartGuru.Chart.SetData(System.Collections.Generic.IEnumerable%7bChartGuru.IChartMark%7d)` when the shape changes. `ChartGuru.RingBufferChartDataSource.Push(System.Single)` itself is O(1) and allocation-free; the per-frame flush reuses ordered sample buffers when the target chart shape is stable.
Properties
Section titled “Properties”
Capacity
Section titled “Capacity”public int Capacity { get; set; }Maximum number of samples retained.
Returns
System.Int32 — No return description is available.
SeriesName
Section titled “SeriesName”public string SeriesName { get; set; }Series key used by emitted marks.
Returns
System.String — No return description is available.
public int Count { get; }Number of samples currently in the buffer.
Returns
System.Int32 — No return description is available.
Methods
Section titled “Methods”
Push(float)
Section titled “Push(float)”public void Push(float y)Push a Y-only sample. The X axis becomes the running sample index. Thread-safe; lock-protected on a per-component lock.
Parameters
| Name | Type | Description |
|---|---|---|
y |
System.Single | |
Push(float, float)
Section titled “Push(float, float)”public void Push(float x, float y)Push an (X, Y) sample. The first call to this overload switches the buffer into “explicit X” mode for all subsequent reads.
Parameters
| Name | Type | Description |
|---|---|---|
x |
System.Single | |
y |
System.Single | |
Clear()
Section titled “Clear()”public void Clear()Drop every sample.
SetData(float[])
Section titled “SetData(float[])”public void SetData(float[] values)Replace the buffer contents with an array of Y values.
If the array is larger than ChartGuru.RingBufferChartDataSource.Capacity, only the
last Capacity elements are kept.
Parameters
| Name | Type | Description |
|---|---|---|
values |
System.Single[] | |
SetData(float[], float[])
Section titled “SetData(float[], float[])”public void SetData(float[] xValues, float[] yValues)Replace the buffer contents with paired X and Y arrays of equal length.
If the arrays are larger than ChartGuru.RingBufferChartDataSource.Capacity, only the
last Capacity elements are kept.
Parameters
| Name | Type | Description |
|---|---|---|
xValues |
System.Single[] | |
yValues |
System.Single[] | |
ApplyData()
Section titled “ApplyData()”public override void ApplyData()Apply the configured data to the target chart. Subclasses must implement this to provide their specific data.
BuildMarksForChartType(ChartType, ChartAuthoringStyleOptions)
Section titled “BuildMarksForChartType(ChartType, ChartAuthoringStyleOptions)”public override List<IChartMark> BuildMarksForChartType(ChartType chartType, ChartAuthoringStyleOptions style)Build marks shaped for the requested chartType and
style. Default implementation returns an empty
list; subclasses override to provide their data. The base class sets
ChartGuru.ChartDataSourceBase._activeStyleOverride for the duration of the call so
existing Get* helpers transparently pick up the UITK style.
Parameters
| Name | Type | Description |
|---|---|---|
chartType |
ChartGuru.ChartType | |
style |
ChartGuru.ChartAuthoringStyleOptions |
Returns
System.Collections.Generic.List{ChartGuru.IChartMark} — No return description is available.
OnEnable()
Section titled “OnEnable()”protected override void OnEnable()No description is available for this member.