RingBufferChartDataSource
public class RingBufferChartDataSource : ChartDataSourceFixed-capacity streaming source for live values such as frame times or sensor readings. Pushing is
thread-safe and O(1); the buffer publishes at most once per frame in LateUpdate. Once the
buffer is full the published frame is updated in place, so steady streaming allocates nothing.
Remarks
Section titled “Remarks”The frame has a value column named after RingBufferChartDataSource.SeriesName, plus an X column when
samples were pushed with explicit X values; otherwise charts use the sample index.
Fields
Section titled “Fields”
XColumnName
Section titled “XColumnName”public const string XColumnName = "X"Name of the explicit X column.
Returns
System.String
Methods
Section titled “Methods”
Push(float)
Section titled “Push(float)”public void Push(float y)Appends a value; the X position is the sample index.
Parameters
| Name | Type |
|---|---|
y | System.Single |
Push(float, float)
Section titled “Push(float, float)”public void Push(float x, float y)Appends a sample with an explicit X value.
Parameters
| Name | Type |
|---|---|
x | System.Single |
y | System.Single |
ClearData()
Section titled “ClearData()”public void ClearData()Removes every sample; the next publish hands bound charts an empty frame.
SetData(float[])
Section titled “SetData(float[])”public void SetData(float[] values)Replaces the buffer with the given values; X is the sample index.
Parameters
| Name | Type |
|---|---|
values | System.Single[] |
SetData(float[], float[])
Section titled “SetData(float[], float[])”public void SetData(float[] xValues, float[] yValues)Replaces the buffer with explicit X and Y values.
Parameters
| Name | Type |
|---|---|
xValues | System.Single[] |
yValues | System.Single[] |
Refresh()
Section titled “Refresh()”public override void Refresh()Publishes the current samples immediately.
Constructors
Section titled “Constructors”
RingBufferChartDataSource()
Section titled “RingBufferChartDataSource()”public RingBufferChartDataSource()Properties
Section titled “Properties”
Capacity
Section titled “Capacity”public int Capacity { get; set; }Maximum number of retained samples.
Returns
System.Int32
SeriesName
Section titled “SeriesName”public string SeriesName { get; set; }Name of the value column.
Returns
System.String
public int Count { get; }Number of samples currently in the buffer.
Returns
System.Int32