I am using Measurement Studio 2013 with VS 2012.
I am fetching data from NI PXI 5122 which I want to plot on the graph. I can clearly see the records when printed in console or even on the gridview but I am unable to plot it on the WaveformGraph. Here is my code:
static void PlotWaveformsOnGraph(AnalogWaveformCollection<double> waveforms)
{
List<AnalogWaveform<double>> waveformList = new List <AnalogWaveform<double>>(waveforms);
MainWindow main = new MainWindow();
main.waveformGraph.PlotWaveforms(waveformList.ToArray());
}
there is no error in the above code, also the data is present in WaveformList but not plotting on the graph.
Are you creating a MainWindow instance dynamically in your PlotWaveformsOnGraph method because you cannot reach the waveformGraph object from context of the method? If so, you might consider the following:
PlotWaveformsOnGraph method. This way, you can access the PlotWaveformsAppend method on the waveformGraph from within your static method.This might look like:
static void PlotWaveformsOnGraph(AnalogWaveformCollection<double> waveforms,
WaveformGraph graph)
{
var waveformList = new List<AnalogWaveform<double>>(waveforms);
graph.PlotWaveforms(waveformList.ToArray());
}
PlotWaveformsOnGraph method. Assuming PlotWaveformsOnGraph is a member of your MainWindow class, and your window has a WaveformGraph control on it, you can access the waveformGraph from within your method. Do you have a specific reason for making this method static?It looks like more progress on this issue is being made here.