Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Why are my Waveform Charts Disappearing?

I have been managing a software solution for three years now that has one waveform chart.  I recently decided that it would be good to allow the users to use several different charts, but I didn't have any more real estate so I placed them on top of each other.  Through a numeric control, I set it up so that the chart and legend would become visible when selected, and the others would become invisible.  I did this after first trying Chart.SendToBack() but that method caused the chart to blink and layered plots to show.  Now the charts disappear when I click on them.  The only ones that don't disappear are the ones that I have not added plots to.  My selection routine is shown below, and there is no other function or line of code that makes these charts invisible.

 

[code]

Try

 Select Case numChart.Value
Case 0

wfgTemperature.Visible = True

wfg1.Visible = False

wfg2.Visible = False

wfg3.Visible = False

wfg4.Visible = False

legPlotsA(0).Visible = True

legPlotsB(0).Visible = True

legPlotsA(1).Visible = False

legPlotsB(1).Visible = False

legPlotsA(2).Visible = False

legPlotsB(2).Visible = False

legPlotsA(3).Visible = False

legPlotsB(3).Visible = False

legPlotsA(4).Visible = False

legPlotsB(4).Visible = False

 Case 1

wfgTemperature.Visible = False

wfg1.Visible = True

wfg2.Visible = False

wfg3.Visible = False

wfg4.Visible = False

legPlotsA(0).Visible = False

legPlotsB(0).Visible = False

legPlotsA(1).Visible = True

legPlotsB(1).Visible = True

legPlotsA(2).Visible = False

legPlotsB(2).Visible = False

legPlotsA(3).Visible = False

legPlotsB(3).Visible = False

legPlotsA(4).Visible = False

legPlotsB(4).Visible = False

 Case 2

wfgTemperature.Visible = False

wfg1.Visible = False

wfg2.Visible = True

wfg3.Visible = False

wfg4.Visible = False

legPlotsA(0).Visible = False

legPlotsB(0).Visible = False

legPlotsA(1).Visible = False

legPlotsB(1).Visible = False

legPlotsA(2).Visible = True

legPlotsB(2).Visible = True

legPlotsA(3).Visible = False

legPlotsB(3).Visible = False

legPlotsA(4).Visible = False

legPlotsB(4).Visible = False

 

 

End Select 

Catch ex As Exception

MsgBox(ex.ToString)

End Try

[/code] 

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 1 of 16
(5,548 Views)

SCXI,

 

I have made an example that shows/hides two waveformgraphs either using a numeric edit control or a listbox. You can put the graphs one ontop of another and the program works as expected. Please try this example on our community site How To Show/Hide Waveform Graphs Using Listbox or NumericEdit with VB .NET 2003 & Measurement Studi... if you have problems getting this code to perform as expected, please let me know. Another option could be to use the TabControl to show and hide the waveforms you want to.

 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 16
(5,521 Views)

Yours behaves as it should, but mine is a little different.  I am appending data to the charts every second.  I commented out all but the first chart and it would not disappear when I clicked on it.  Then I uncommented the second chart plotyappend and the first would disappear but not the second.  The trend continued.  This is the update I am using:

 

[code]

            Try
                .wfgTemperature.PlotYAppendMultiple(ChartData)
                .wfg1.PlotYAppendMultiple(ChartData1)
                .wfg2.PlotYAppendMultiple(ChartData2)
                '.wfg3.PlotYAppendMultiple(ChartData3)
                'If (Now.Second Mod 5 = 0) Then .wfg4.PlotYAppendMultiple(ChartData)
            Catch ex As Exception
                Try
                    swError = New StreamWriter(Application.StartupPath & "\Errors\" & RunNumber & "_" & "Error Log.txt", True)
                    swError.WriteLine(TimeString & vbTab & "DisplayData  - Chart" & vbNewLine & ex.ToString & vbNewLine & vbNewLine)
                    swError.Close()
                Catch ex1 As Exception
                End Try
            End Try

[/code]

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 3 of 16
(5,503 Views)

Michael,

 

Try this modified example that appends the plot every second as well as hides and shows two of the plots. It works on my computer, if this still is not the behavior you are experiencing, could you either modify this example or post a simplified version of your graphing application, without any data acquision so i can run it without hardware? One thing i had to do after setting visability was to call update on the graph. 

 

wfg1.visible = false

wfg2.visible = true

wfg1.update()

wfg2.update()

 

 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 16
(5,501 Views)

I have revisited this issue as the feature would be so useful for us, but I am having the same problem regardless of the 1 Hz update call.  When the charts are not on top of each other they work exactly as expected.  When they are on top of each other only the fourth chart works.  All others will disappear when I click on them.  I've attached a small project that doesn't have any DAQ in it.

 

Thanks!

 

 

Message Edited by SCXI and MS 2k3-VB.NET on 12-29-2009 10:53 AM
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 5 of 16
(4,948 Views)
I should also mention that using the fifth chart and the first chart only works as I'd expect it to.  I only write to the fifth chart once every 5 seconds as sort of a wider view of the chart history.  The fifth chart also always ends up on top not matter when order I stack them before running the application.
Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 6 of 16
(4,942 Views)

What version of visual studio and measurement studio are you using? I get errors when I try to open this vb form.

 

 

2009-06-09_142824.png

 

 

 

 From what I understand you are experiencing correct behavior except for when you click on a graph, at that time the graph will disapear unless it is graph number four. Is this correct? If so, when you run my example do you experience the same behavior with only two graphs?

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 7 of 16
(4,921 Views)

The latest, and that error is very annoying.  I have to comment on the lines that set those values on the designer (although that is bad practice).  You can change the color settings on the plots for each chart to get rid of that error, but I'd like to know why it happens and how to fix it.  I'm trying to specify the color of the plots and it gets mad.

 

I did not have the problem with your application, but from what I remember it was not writing to the charts at 1 Hz.  That was the only difference I could find.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 8 of 16
(4,918 Views)

Michael,

 

I modified my example to demonstrate multithreading patterns with visual basic and posted a new copy to the Community. http://decibel.ni.com/content/docs/DOC-8738  . This should demonstrate how to update the UI from a seperate thread as well as how to make up to four graphs show and hide at a rate of 1hz (using a windows timer control). If you're still having problems getting yours to work, feel free to download and modify my example to meet your own needs. 

 

I would recommend starting a new form thread for your question on changing color settings, that way anyone with the same question in the future can easily find the solution. 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 9 of 16
(4,870 Views)

I don't really understand what you are doing differently that I am, other than that you are appending a waveform and I am appending a single point.  I added a timer to your example and appended a waveform at 1 Hz and it worked fine.  Then I moved my plotting command to an unthreaded timer in my program and the charts still disappear.  I only need to plot points at 1 Hz, so plotting a waveform is not useful for me.  Is there any chance you can reset the plot colors on my project to auto generation and then try it out?

 

Thanks.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 10 of 16
(4,852 Views)