Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with CWGraph annotations

I find that if I exceed 500 data points(x axis) annotation plots are no longer visible.

Here is my code:

Function PlotAnotationAltLimit() As Boolean

On Error GoTo errhand

ReDim tempx(1 To TotalSeconds)
ReDim tempy(1 To TotalSeconds)

Dim i As Long

For i = 1 To (TotalSeconds) - 1
tempx(i) = i ' time base
tempy(i) = (MasterArray(i).Altval)
Next

PlotLimit tempx, tempy, vbRed

PlotAnotationAltLimit = True

Exit Function

errhand:

PlotAnotationAltLimit = False

End Function

Sub PlotLimit(xarray() As Long, yarray() As Long, tracecolor As Long)

' setup annotation object
Dim annotation As CWAnnotation
Set annotation = FrmMain.CWGraph1(0).Annotations.Add

' define style
annotation.SetBuiltinSt
yle (cwAnnotationStyleLine)
annotation.CoordinateType = cwAxesCoordinates

' do the work
annotation.Shape.LineColor = vbRed
annotation.Shape.SetCoordinates xarray, yarray


End Sub

Comments???

Also..how does one clear an annotaion plot?

Thanks,
Bart Johnson
0 Kudos
Message 1 of 8
(7,065 Views)

Hello

This was an issue reported with the 6.0 version of the CWGraph control. You can download the updated version of the Measurement Studio controls. You would want the Measurement Studio 6.0 updater.

To clear an annotation, remove it from annotations collection

CWGraph1.Annotations.Remove 1 ' where one is the index of the annotation. You can also use the name. Refer to the documentation for more information.

Bilal Durrani
NI

Bilal Durrani
NI
0 Kudos
Message 2 of 8
(7,065 Views)
Suggested use of the "updater" does not fix the problem with anotations only working up to 500 data points.

Any other suggestions?

Bart Johnson
bartj@seitzassoc.com
0 Kudos
Message 3 of 8
(7,065 Views)
Installing the updater should have provided you with 7.0.0(343)(602) version of the CWGraph control. You can check the version of the CWGraph by going to the property pages and clicking on the about tab.
I can display annotation points upto 999 points ( the limit is set to 1000 points) correcty. Try it with the attached VB program.

Bilal
Bilal Durrani
NI
0 Kudos
Message 4 of 8
(7,065 Views)
Bilal,

I will check if I have the newer version. I need to have up to 30,000 points...

My aplication is thus:

The user creates a "profile" which defines a function that gets ploted on the graph. The horizontal axis is seconds. Then the actual data is generated and the display is updated at a 1 second rate. The operator is then able to observe the desired vs actual data. Note that this operation typically takes many hours. Operator needs to "see" the entire "profile" at all times.

Suggestions:

Bart Johnson
0 Kudos
Message 5 of 8
(7,065 Views)
Bart,

If you are tracking this many points, you might want to try plotting the points instead of drawing them using annotations. The main purpose for having annotations is to highlight data that was plotted on the graph. It was not meant to be a replacement of the plotting/charting functionality of the CWGraph.
Check out the ChartY and PlotY methods of the graph control. If you need XY plotting, you can useChartXY and PlotXY. You can display and configure multiple plots in a single graph.

I hope this helps

Bilal
Bilal Durrani
NI
0 Kudos
Message 6 of 8
(7,065 Views)
Bilal,

Thanks for your suggestions. However I am unable to find a method that does not start scrolling the display once I have plotted my "profile".

I need to first show a "profile" with up to 30,000 points(x and y). Then I need to start plotting data beginning at data point 1.

At present I plot my data as follows:

' setup plot data
DisplayArray_Chan0(1, 0) = currentaltitude

' plot data
frmmain.CWGraph1(0).ChartY DisplayArray_Chan0, 1

Can you suggest a method for plotting the data without scrolling the data?

Thanks,
Bart Johnson
0 Kudos
Message 7 of 8
(7,065 Views)
Bilal,

Have found a way to accomplish the task....

Thanks for all your help!

Bart Johnson
0 Kudos
Message 8 of 8
(7,065 Views)