-
Notifications
You must be signed in to change notification settings - Fork 983
Description
The purpose of this issue is to explore the use use of data objects to make it easier to display "live" plots where the data is frequently updated. This mostly applies to Scatter plots, Signal plots, and Finance plots. Scatter plots will be explored first, and this new implementation may replace ScatterPlotList. This topic was initially explored in #815
Rationale
ScottPlot users frequently encounter difficulty when trying to figure-out how to update/add data in live plots. Live plots are possible using tricks as described on the FAQ: Live Data page. However, this task is difficult because the primary plot types store data in fixed-length arrays and do not have control over when renders occur. Use of a data object would abstract the task of data storage and array management from the user, simplifying this task. It would also improve encapsulation for data management (validation, axis limit detection, min/max detection, and tree management) and separation of concerns (data objects would manage data, plottables would manage style and rendering).
Data Object Responsibilities
- Store data in private arrays
Add(),AddRange(), andClear()methods update/resize/replace arrays as needed- Data validation (e.g., ensuring data does not contain
double.NaN) - Axis limit detection
- Range min/max detection for Signal plottables
- Tree management for SignalConst plottables
Example Use
// user stores and interacts with the data object, not the plottable
readonly ScatterData myData = new ScatterData();
void Init()
{
formsPlot1.Plot.AddScatter(myData);
}
void OnNewData()
{
myData.AddRange(newXs, newYs);
formsPlot1.Render();
}