Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveform Graph auto pan past axis range maximum

Solved!
Go to solution

Hi,

 

I am working on a VB.NET program for a client which has a form with four individual Waveform Graphs on it. Each graph only displays one plot in which real-time data is appended to using the PlotYAppend() method of each Waveform Graph. These Y-values are plotted against a "Time" labeled x-axis which represents minutes from 0 - 60. 

 

My question is if there is a property of the Waveform Graphs or any suggested way to make the graph x-axis pan along with the graph as it is plotted past the maximum x-axis range value(60 in this case) so that the x-axis would continue to display incremented ticks, ie. 60, 70, 80, etc... as the plotted data continued past this range? Ideally, I would like the user to then be able to pan manually left and right to view the past data starting at zero as well, but my main focus is the ability to continue to show the data being appended. Currently, when the data reaches the 60 minute tick at the end of the graph, it begins erasing data from the beginning of the plot (at zero) and does not plot the new appended data points. 

 

My only current thought for this after looking through the graph properties would be to check for when the 60 minute data point is plotted and then programatically change the range of the x-axis to be the next 60 minutes and then start plotting from the first point on the graph again. 

 

Please let me know if there is any further information needed or any questions. I appreciate all replies in advance. 

 

Thanks,

Jared@DEDesign

0 Kudos
Message 1 of 11
(4,157 Views)

Hi Jared, 

 

Are you using the Measurement Studio waveform graph? It is unclear whether you are using the Measurement Studio version or the one that comes with visual studio. 

 

Have you seen the following KB: 

 

http://digital.ni.com/public.nsf/allkb/29353B4D8E4CC95C86256B9F007D1AD2

 

 

0 Kudos
Message 2 of 11
(4,131 Views)

Hi Roxana,

 

Yes, I am using the Measurement Studio Waveform Graph. I apologize for not making that clear initially. 

 

I have actually tried using both Strip Chart and Scope Chart modes with the graphs and neither option gave different results than described above. I unfortunately do not have this computer in front of me at the moment and cannot remember the exact name of this mode property. I will give these a try again tomorrow morning when I get the pc back, as they sound like the exact desired behavior I am looking for. 

 

Do you know of any axis or plot properties that if set would cause these modes to not function as described? Some of the auto properties set to fixed, etc...? 

 

Thank you,

Jared

0 Kudos
Message 3 of 11
(4,128 Views)

Okay, I have tried a few different things and here is where I am at:

 

For the Waveform Graph control, there is a property of the "X Axis" Member(NationalInstruments.UI.Axis) of the XAxes collection which is "Mode"(NationalInstruments.UI.AxisMode). This property has options for both StripChart and ScopeChart. The StripChart seems to be exactly what I would want as I would like the x-axis to move along with the plot as the StripChart summary describes. 

 

When I choose either ScopeChart or StripChart, the behavior of the axis remains the same as the Fixed mode. The Mode of the Y Axis is AutoScaleLoose. This axis changes to scale the range to the points being plotted, as desired. 

 

I have tried looking through the other properties of the Axes, Plots, and graph itself to see if there was anything that potentially was set which would cause the x axis range to remain constant, but I was unable to find anything which produced a different result. I am able to Pan back and forth on the  x axis via the InteractionMode property of the Waveform Graph having the PanX member checked, but this is only by manual control by the user. 

 

I have the computer with me permanently now, so I am happy to provide any further information requested. I think I will try creating a new project and add a new waveformgraph control(this is an analog waveformgraph by the way) with default setttings and properties. If I can get the StripChart to work with that graph, then it must be another property preventing the StripChart mode from working correctly.

 

I will post any updates, and appreciate any suggestions or comments.

 

Thanks,

Jared 

0 Kudos
Message 4 of 11
(4,112 Views)

Hi Jared, 

 

Would you be able to include your code so that I can see what you are doing or how you are programming it? 

0 Kudos
Message 5 of 11
(4,110 Views)

I cannot attach all of the code because it is for a commercial product for a client. But I will show you some of the code which is interacting with the graphs. Although really the only thing being done in the code is appending the data to the plots. All other properties of the graph control are set via the designer and are not changed at run-time. 

 

The following is how the data is appended to the graph plots(4 total):

Public Sub RefreshTestCtrlChart(ByRef InData() As Single)

With FrmMain
.CtrlIDDryGrph.Plots.Item(0).PlotYAppend(InData(AINamed.RTD.RtdIDInletDry1.ChnNum), 0.05)
.CtrlIDWetGrph.PlotYAppend(InData(AINamed.RTD.RtdIDInletWet1.ChnNum), 0.05)
.CtrlODDryGrph.PlotYAppend(InData(AINamed.RTD.RtdODInletDry3.ChnNum), 0.05)
.CtrlODWetGrph.PlotYAppend(InData(AINamed.RTD.RtdODInletWet3.ChnNum), 0.05)
End With

End Sub

 

Where InData() is an array of Singles of size 350 passed in as an argument. The ChnNum member is just an integer which represents the corresponding analog channel for the RTD value to be plotted. The increment is 0.05 because this function is called every 3 seconds when new data comes in and the x-axis is in minutes (20 updates(3sec. each) of 0.05increment per 60 seconds). This way the data plotted is "real time" and every 3 second update represents 3 seconds passed on the graph, etc...

 

The first plot append is different(.Plots..Item(0).PlotYAppend()) because I had previously tried this method of appending data, but I found that it produces the same result as the other three graph appends(.PlotYAppend()).

 

I also attached some of the Desginer.vb code for the form which the graphs are on. This code is for one of the graphs only (CtrlIDDryGrph). The [...] represents that there was other code between the code shown. 

 

Let me know if there is anything else I can provide you. 

 

Thanks,

Jared

0 Kudos
Message 6 of 11
(4,095 Views)

Jared,

 

This is Ali from National Instrument's applications engineering. I will be helping you with your issue today. Just to make sure I have a clear understanding of the issue, you are trying to consistently move your x axis automatically and not with a pan function.

 

Secondly, you have tested with ScopeChart or StripChart and gotten no options that would help accomplish your task.

 

If this is the case, I have a few thoughts. The StripChart seems to not be following expected behavior as said by the resource article. I'd be interested if the same behavior occurs in non "real time" if a set of values are just passed to a StripChart.

 

Secondly, I'd be curious if you could run test examples and if they showcase the same expected behavior or if we can narrow down this to your computer. This is the general update modes and this is the Sweep chart which is not your preferred behavior but it would be good to know if it's acting normally.

 

 

 

 

Regards,

Ali S.
Applications Engineering
National Instruments
0 Kudos
Message 7 of 11
(4,062 Views)

Hi Ali,

 

You are correct in your analysis of my problem. I will try and see if I can create a new project to test the sweep chart on its own. Is there a different way than using PlotYAppend() that you would like me to try for appending data to the plot? 

 

As for the two examples you gave me, one was a LabView program and the other a VB6 program. I am using VB.NET with Measurement Studio 2015 for Visual Studio 2012. Is there a similar example program as these for VB.NET? If so, I can try that one. 

 

Thanks for the help. 

- Jared

0 Kudos
Message 8 of 11
(4,025 Views)

Ali,

 

I have created a test project which has one graph with default settings, except the x-axis mode has been set to ScopeChart. I have also tested it with StripChart. Both seem to function correctly. 

 

The second graph, "Test", is a copy of the graph from my program. The button does the same thing (adds a random integer), but the ScopeChart and StripChart do not work on this one. I will keep looking at it, but I figured it wouldn't hurt to have another set of eyes looking it over. 

 

Thanks,

Jared

0 Kudos
Message 9 of 11
(4,022 Views)

Hi Jared,

If you have a working version of the graph, is it not possible to start from the working one and make the changes that you need for your application? 

I tried going through the settings of both graph and was not able to determine what was different either. 

I think it would be faster to just change the configurations of the working graph. 

T. Le
Vision Product Support Engineer
National Instruments
0 Kudos
Message 10 of 11
(3,995 Views)