This widget could not be displayed.

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?

Ok, it's good you have found it. But, according to your post I can advice to you, and all MS Visual Studio users at general to do the following:
Configure this great tool to break at ALL exceptions. I don't know why it is not configured so by default. But generally, we have an option to ignore exception of any kind. If you are writing an application that relies on some driver that is constantly throwing OutOfMemory exception, then you might want to disable this exception for your solution. That is a good opportunity to save time, but first you have to see this exception thrown, understand it and take care of it as a best thing.
So, everybody, open your current solution, go to Debug menu and ckick Exceptions menu item. Take your time to investigate and enable absolute majoruty of those exceptions. It will make your code better and save your time finding the problem. This thread is just another proove 🙂
Regards

0 Kudos
Message 21 of 23
(1,779 Views)

I actually do have my settings set to break at all exceptions, but it did not pick this one up for some reason.  Thanks for the advice, though.

0 Kudos
Message 22 of 23
(1,776 Views)

I did not see that anyone posted a solution so I will share my findings. I was using a "Complex graph" based on a NI sample for VB. If either term of the complex data was zero, I would get the "red X". It would not throw a capture-able exception. So here is my code fix showing a hack to set any zero argument to a value very close to zero. Problem solved.

 

Sub PlotMagPhase(ByVal magval As Double, ByVal Phaseval As Double)

Try

' do this hack otherwise graph will show red x and will not generate an exception
If magval = 0 Then magval = 0.0001
If Phaseval = 0 Then Phaseval = 0.0001

 

' radians compensation
Phaseval = Math.PI * Phaseval / 180.0

Dim tempReal As Double = magval * Math.Cos(Phaseval)
Dim tempImag As Double = magval * Math.Sin(Phaseval)

complexPlot.ClearData()

Dim complexData() As ComplexDouble = New ComplexDouble((1)) {}

complexData(0).Real = tempReal
complexData(0).Imaginary = tempImag

complexPlot.PlotComplex(complexData)

Catch ex As Exception
MsgBox("PlotMagPhase error: " & Err.Description)
End Try

End Sub

0 Kudos
Message 23 of 23
(558 Views)