Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Read WaveformPlot plot increment?

hey

i am trying to read off the plot increment of a WaveformPlot, is this possible?

ie i plotted a graph using:

WaveformGraph.PlotY(double[] data, double start, double increment)

and now i wish to retrieve the increment value.

any ideas?

while i am here, why can i not clone a waveformplot?

WaveformPlot testPlot = (WaveformPlot)waveformPlotTimeHistory.Clone();

gives me an error message about array being out of bounds.
0 Kudos
Message 1 of 4
(3,883 Views)
Hi Kreuters,

There is no property that stores this increment so you will have preserve the value in a variable (in your case increment) in order to reference it later.

As for the clone method, I'll need to know the exact error to help resolve that.  Does the following code give you the same error?

            XAxis myXAxis1 = new XAxis();
            YAxis myYAxis1 = new YAxis();

            WaveformPlot myClone = new WaveformPlot(myXAxis1, myYAxis1);
            WaveformPlot testPlot = (WaveformPlot) myClone.Clone();

If that works, then you may want to post how you created the waveformPlotTimeHistory object.

Have a great day,

Ecleamus R.
National Instruments
0 Kudos
Message 2 of 4
(3,847 Views)
hey

using the given code, the empty plot clones itself with no error message. to create the waveformPlotTimeHistory i simply called:

waveformGraph.PlotYMultiple(plotBuffer, DataOrientation.DataInRows, xMin, plotIncrement);

i have set up the first plot for the graph as waveformPlotTimeHistory. occasionally there are more than one plot, hence plot y multiple, but usually not.

any ideas why cloning this would cause an error?

the exact error message is:

System.ArgumentException was unhandled
  Message="Destination array was not long enough. Check destIndex and length, and the array's lower bounds."
  Source="mscorlib"
  ParamName=""
  StackTrace:
       at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
       at System.Array.CopyTo(Array array, Int32 index)
       at NationalInstruments.UI.Internal.ce.b(a8 A_0)
       at NationalInstruments.UI.Internal.a8.a(ControlElement A_0)
       at NationalInstruments.UI.Internal.ay.a(ControlElement A_0)
       at NationalInstruments.UI.WaveformPlot.Clone()
       at SubAnalysis.MainForm.SaveTimeHistoryToPNG() in C:\Documents and Settings\Dikkie\My Documents\Visual Studio 2005\Projects\SubAnalysis\SubAnalysis\MainForm.cs:line 366
       at SubAnalysis.MainForm.saveAsPNG_Click(Object sender, EventArgs e) in C:\Documents and Settings\Dikkie\My Documents\Visual Studio 2005\Projects\SubAnalysis\SubAnalysis\MainForm.cs:line 455
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at SubAnalysis.Program.Main() in C:\Documents and Settings\Dikkie\My Documents\Visual Studio 2005\Projects\SubAnalysis\SubAnalysis\Program.cs:line 17
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

0 Kudos
Message 3 of 4
(3,842 Views)
Hey Kreuters,

The likely cause for this error is that your plot History Capacity is smaller than the actual number of points on your plot.  Increase your History Capacity to a number greater than your data buffer and this should resolve the error.  Please let me know.

Have a great day,

Ecleamus R.
National Instruments
0 Kudos
Message 4 of 4
(3,833 Views)