Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

More CWGraph / Array Questions

I have a two dimensional array of Y values, lg_measurement(0 to 10, 0 to 5). In real life these are 6 different sets of 11 channels of A2D readings -- which are sampled periodically. The array is overwritten with new data with each periodic sample. I would like to be able to make a scrolling chart that of these values in a CWGraph. I would like to control which channels are displayed with 11 checkboxes and from which dataset to display with a drop-down selection list. Hhow do I pass the array to the cwgraph control so that have control over what is displayed in the way described?
0 Kudos
Message 1 of 5
(6,549 Views)
To chart the two dimensional array, pass the array to the CWGraph.ChartY method.

To control which channels are displayed via CheckBoxes, you can create a control array of CheckBoxes, add a Click event handler for the control array, then retrieve the plot at the associated control array and set its Visible property accordingly. For example, add a checkbox, select it and press Ctrl+C to copy it, and then paste it. Visual Basic will prompt you with a message that says "You already have a control named 'Check1'. Do you want to create a control array?" Click Yes, then keep pasting CheckBoxes until you have your 11 CheckBoxes. Double-click on one of the CheckBoxes to create an event handler for the control array, then add the following code:


Private Sub Check1_Click(Index As Integer)
' Get the plot at the corresponding control array index and set its
' Visible property to the value of the CheckBox.
CWGraph1.Plots(Index + 1).Visible = Check1(Index).Value
End Sub


I'm not 100% sure what you're trying to do with the drop-down selection list, but if I'm understanding it correctly, I think you'll have to keep track of what set of data is associated with each item in the list and when a different item is selected, you'll have to replot the data that's associated with that item.

- Elton
0 Kudos
Message 2 of 5
(6,543 Views)


@Elton Wells wrote:
To chart the two dimensional array, pass the array to the CWGraph.ChartY method.

To control which channels are displayed via CheckBoxes, you can create a control array of CheckBoxes, add a Click event handler for the control array, then retrieve the plot at the associated control array and set its Visible property accordingly. For example, add a checkbox, select it and press Ctrl+C to copy it, and then paste it. Visual Basic will prompt you with a message that says "You already have a control named 'Check1'. Do you want to create a control array?" Click Yes, then keep pasting CheckBoxes until you have your 11 CheckBoxes. Double-click on one of the CheckBoxes to create an event handler for the control array, then add the following code:


Private Sub Check1_Click(Index As Integer)
' Get the plot at the corresponding control array index and set its
' Visible property to the value of the CheckBox.
CWGraph1.Plots(Index + 1).Visible = Check1(Index).Value
End Sub


I'm not 100% sure what you're trying to do with the drop-down selection list, but if I'm understanding it correctly, I think you'll have to keep track of what set of data is associated with each item in the list and when a different item is selected, you'll have to replot the data that's associated with that item.

- Elton




OK, the checkbox array makes sense. To claify what I am trying to do: from this two dimensional array I have 66 datapoints that are charted -- 11 channels in 6 sets. I want to have controls to make individual plots visible or invisible, by channel and by set. So I would like the check boxes to control which channels are visible, and have a dropdown combo selector to control which set is visible. The data is all 'Y' data -- the CWGraph is run in strip chart mode with a history of several hundred data points.
0 Kudos
Message 3 of 5
(6,535 Views)
Unfortunately, there is not an easy way to do this. You'll have to implement something to explicitly handle this case, such as replotting data as I briefly described in the previous post.

- Elton
0 Kudos
Message 4 of 5
(6,526 Views)
OK, Thanks for your help!
0 Kudos
Message 5 of 5
(6,524 Views)