Skip to content

SignalXY: Create a data source to support List<T> #4746

@JoeStoneAT

Description

@JoeStoneAT

Problem:
For a visualisation of data from a DAQ-system I have my data in some classes doing the daq, calculation, datahandling, saving,... There my data are in List<double> as this is for me much easier than using double[] and increasing and copying the array from time to time. I had it this way, before I found the possibility to use List<double> in Scottplot5.
The lists for X and in the case of not equidistant signal sources timestamp Ys are growing by time. Existing data are not changed.

And then I'm using a SignalPlot for displaying
thePlot = plot.Add.Signal(ys:dHandler.data[fqVarName].valList, period: ((clsDataPeriodic)dHandler.data[fqVarName]).dt);

Now I wanted to extend my possibilities with SignalXY for non-equidistant x-values but there as datasource only double[] or T[] is possible.
(SignalXYSourceDoubleArray and SignalXYSourceGenericArray)
I would need a
plot.Add.SignalXY(ys: dHandler.data[fqVarName].valList, xs: ((clsDataUnevenly)dHandler.data[fqVarName]).timestampList); to use my existing Lists of doubles.

Question:
Is there a way to use "external" List<double> as the x and y data of SignalXY? The effort to rework everything to double[] would be pretty high.

Possible Alternatives?
Doing a List<double>.toArray() 3-4 times a second before a plot refresh should work, but this will most probably bring me into performance issues I think. Depending of the measurement time and sample rate I have from 0 to some 100 Mio doubles in the List<double> per signal.

  1. mySignalXYPlot.Data = new SignalXYSourceDoubleArray(valueList.toArray(),timestampList.toArray())
  2. WpfPlot.Refresh()

DataLogger?
In some other small programs I use DataLogger. Would it work to store the public List<Coordinates> in my dataHandler? Until now I used only the Add() method of the data handler.

ScottPlot Version: 5.0.54

best regards
Josef

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions