Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why Does my Waveform Graph Turn to a Big Red X?


Public Sub BuildCharts() Try Dim ChartCount, ThisChartWaveformCount, seriesCount, TempCounter As Int16 Dim ParsedName() As String For ChartCount = 0 To 9 ' ********* Build Legends ********** LoadColors() frmD.legPlotsA(ChartCount) = New Legend frmD.legPlotsB(ChartCount) = New Legend With frmD.legPlotsA(ChartCount) .Name = "legPlotsA" & ChartCount .Location = New Point(599, 4) .Size = New Point(151, 145) frmD.Controls.Add(frmD.legPlotsA(ChartCount)) frmD.legPlotsA(ChartCount).SendToBack() End With With frmD.legPlotsB(ChartCount) .Name = "legPlotsB" & ChartCount .Location = New Point(750, 4) ' <- Changed to 750 from 599. .Size = New Point(151, 145) frmD.Controls.Add(frmD.legPlotsB(ChartCount)) frmD.legPlotsB(ChartCount).SendToBack() End With If ChartCount > 0 Then frmD.legPlotsA(ChartCount).Visible = False frmD.legPlotsB(ChartCount).Visible = False End If ' ********* Build Charts ********** frmD.WaveformGraph(ChartCount) = New WaveformGraph With frmD.WaveformGraph(ChartCount) .Name = "wfg" & ChartCount .Location = New Point(3, 3) .Size = New Point(652, 307) frmD.WaveformXAxis(ChartCount) = New XAxis frmD.WaveformY0Axis(ChartCount) = New YAxis frmD.WaveformY1Axis(ChartCount) = New YAxis frmD.WaveformY1Axis(ChartCount).Position = NationalInstruments.UI.YAxisPosition.Right If Charts(ChartCount).Y0Min < Charts(ChartCount).Y0Max Then frmD.WaveformY0Axis(ChartCount).Range = New NationalInstruments.UI.Range(Charts(ChartCount).Y0Min, Charts(ChartCount).Y0Max) If Charts(ChartCount).Y1Min < Charts(ChartCount).Y1Max Then frmD.WaveformY1Axis(ChartCount).Range = New NationalInstruments.UI.Range(Charts(ChartCount).Y1Min, Charts(ChartCount).Y1Max) If Charts(ChartCount).LeftAxisType = "Fixed Range" Then frmD.WaveformY0Axis(ChartCount).Mode = NationalInstruments.UI.AxisMode.Fixed If Charts(ChartCount).RightAxisType = "Fixed Range" Then frmD.WaveformY1Axis(ChartCount).Mode = NationalInstruments.UI.AxisMode.Fixed frmD.WaveformGraph(ChartCount).XAxes.AddRange(New NationalInstruments.UI.XAxis() {frmD.WaveformXAxis(ChartCount)}) frmD.WaveformGraph(ChartCount).YAxes.AddRange(New NationalInstruments.UI.YAxis() {frmD.WaveformY0Axis(ChartCount), frmD.WaveformY1Axis(ChartCount)}) frmD.WaveformGraph(ChartCount).InteractionMode = CType((((((((NationalInstruments.UI.GraphInteractionModes.ZoomX Or NationalInstruments.UI.GraphInteractionModes.ZoomY) _ Or NationalInstruments.UI.GraphInteractionModes.ZoomAroundPoint) _ Or NationalInstruments.UI.GraphInteractionModes.PanX) _ Or NationalInstruments.UI.GraphInteractionModes.PanY) _ Or NationalInstruments.UI.GraphInteractionModes.DragCursor) _ Or NationalInstruments.UI.GraphInteractionModes.DragAnnotationCaption) _ Or NationalInstruments.UI.GraphInteractionModes.EditRange), NationalInstruments.UI.GraphInteractionModes) Select Case ChartCount Case 0 frmD.TabPage1.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 1 frmD.TabPage2.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 2 frmD.TabPage3.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 3 frmD.TabPage4.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 4 frmD.TabPage5.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 5 frmD.TabPage7.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 6 frmD.TabPage8.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 7 frmD.TabPage9.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 8 frmD.TabPage10.Controls.Add(frmD.WaveformGraph(ChartCount)) Case 9 frmD.TabPage11.Controls.Add(frmD.WaveformGraph(ChartCount)) End Select End With ' ********** Add Waveforms ********** TempCounter = 0 For ThisChartWaveformCount = 0 To Charts(ChartCount).ChartChannels.Length - 1 If Charts(ChartCount).ChartChannels(ThisChartWaveformCount) <> "" Then frmD.Waveform(seriesCount) = New WaveformPlot frmD.WaveformGraph(ChartCount).Plots.AddRange(New NationalInstruments.UI.WaveformPlot() {frmD.Waveform(seriesCount)}) frmD.Waveform(seriesCount).LineColor = SeriesColors(ThisChartWaveformCount) If Charts(ChartCount).RightYAxis(ThisChartWaveformCount) = False then frmD.Waveform(seriesCount).YAxis = frmD.WaveformGraph(ChartCount).YAxes(0) Else frmD.Waveform(seriesCount).YAxis = frmD.WaveformGraph(ChartCount).YAxes(1) End If frmD.Legend(seriesCount) = New LegendItem ParsedName = Split(Charts(ChartCount).ChartChannels(ThisChartWaveformCount), ":") frmD.Legend(seriesCount).Text = ParsedName(1) frmD.Legend(seriesCount).Source = frmD.Waveform(seriesCount) Select Case ThisChartWaveformCount Case Is < 4 frmD.legPlotsA(ChartCount).Items.Add(frmD.Legend(seriesCount)) Case Is < 8 frmD.legPlotsB(ChartCount).Items.Add(frmD.Legend(seriesCount)) End Select TempCounter += 1 seriesCount += 1 Else Exit For End If Next 'MsgBox(frmD.WaveformGraph(ChartCount).Plots.Count) Next Catch ex As Exception MsgBox(ex.ToString) End Try End Sub

 This is the code used to create the charts.  The code used to write to the charts is shown above.  Nothing else interfaces with the charts.

 

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 11 of 23
(4,797 Views)

Hmmm,   Let me look further into the code.   I am starting to think it might have a problem with system resources.   Can you verify that there is plenty of RAM left to hold the desired data.

0 Kudos
Message 12 of 23
(4,787 Views)

See the attached picture.  Thanks for your help.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 13 of 23
(4,785 Views)

Just wondering if this issue was ever resolved?  I am having the same problem.  My scattergraph was working fine with one program, but now that I'm trying to add it to production software, using all the same methods, I'm randomly getting this "big red X".  Not always, though.  Sometimes, it's totally blank, but then in the next update/frame, the graph reappears.  Thanks for any help you can offer.

0 Kudos
Message 14 of 23
(4,716 Views)

Still happens, but seems to happen only on computers that don't have any DAQ devices plugged into them.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 15 of 23
(4,711 Views)

Oh, thanks.  I found another discussion in the forums that may be more relevant to my case.  Something having to do with threads in the software calls when updating the graph.

0 Kudos
Message 16 of 23
(4,709 Views)

Please post a link because I used threads as well.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 17 of 23
(4,704 Views)

I just read a few of these other complaints, and it looks like they're pointing to which thread is updating the graph (I'm not too solid on 'threads' yet, myself).

 

http://forums.ni.com/t5/Measurement-Studio-for-NET/Waveform-Graph-X-Error/m-p/217817/highlight/true#...

 

Or, out of memory?

 

http://forums.ni.com/t5/Measurement-Studio-for-NET/Very-large-scattergraph-out-of-memory-exception/m...

 

http://forums.ni.com/t5/Measurement-Studio-for-NET/Out-of-Memory-Exception-thrown-System-OutOfMemory...

 

Mine is working fine in one application, but I'm getting the white and red X in the other application, so I'm not sure what's going on with mine, yet.  Good luck figuring it out!

 

Here's the search I performed:

http://forums.ni.com/t5/forums/searchpage/tab/message?filter=location&location=forum-board%3A232&q=g...

 

I hope you can view all those links! 

0 Kudos
Message 18 of 23
(4,701 Views)

Guys, I have strong believe, that you just have got some exception unhandled during graph lifecycle. I have seen this red cross, and in my application every time there was some unhandled exception in graph related code. So, surround your code with try-catch and enable all exceptions in your Visual Studio. Even if it is some lack of memory (which is i think not the case) you will see out-of-memory exception thrown. If your application behaves unexpectedly - try to catch exception, it will guide you.

Good luck!

Message 19 of 23
(4,677 Views)

You are correct about the unhandled exception, which I finally found, but the Try...Catch statement does not catch it.  I had to step through my code to see it.  My problem was corrected using the links I posted above.  I had to use an Invoke statement to updated my graphs because of my multi-thread program.

0 Kudos
Message 20 of 23
(4,661 Views)