Skip to content

live incoming Signal plot with DateTime axis demo #565

@swharden

Description

@swharden

JR emailed code that doesn't work as expected. Fixing this code, or creating a demo which makes this easier to figure out, may be useful.

public double[] data = new double[10000];
public double[] timedata = new double[10000];

void Init() {
signalPlot = wpfPlot1.plt.PlotScatter(data, timedata);
             wpfPlot1.plt.YLabel("Value");
             wpfPlot1.plt.XLabel("Sample Number");
             wpfPlot1.plt.Ticks(dateTimeX: true, dateTimeFormatStringX: "HH:mm:ss");
}
void UpdateData() {
            double randomValue = Math.Round(rand.NextDouble() - .5, 3);
            double latestValue = data[nextDataIndex - 1] + randomValue;
            data[nextDataIndex] = latestValue;            
            timedata[nextDataIndex] = DateTime.Now.ToOADate();
            nextDataIndex += 1;
}

image

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