Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

digitalwaveformgraph mouse position

Hello,

 

I have been able to determine the X and Y position (graph xaxis and yaxis coordinates) of the mouse when a button is pressed using the 'WaveFormGraph' control.

 

My question is: How can this be done using the 'DigitalWaveFormGraph' control?

 

Thanks,

 

Chris

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

Hey Chris,

I checked the two graphs side-by-side and it looks like all of the Mouse events listed for the DigitalWaveformGraph are also listed for a normal WaveFormGraph. Have you tried following the same method? If you have and it isn't working then describe the behavior and I'll see what I can do.

 

Lars

0 Kudos
Message 2 of 6
(4,140 Views)

Hi Lars,

 

Yes, of course I tried the same method.

 

I used the 'InverseMapDataPoint' method for the WaveForm Graph as follows (in the 'PlotAreaMouseUp' event) to obtain the Xaxis/Yaxis coordinates:

 

 Dim p As Point = New Point(e.X, e.Y)

WaveFormGraph1.Plots(0).InverseMapDataPoint(WaveFormGraph1.PlotAreaBounds, p, x, y)

 

However this method is not available for the 'DigitalWaveFormGraph'

 

Is there another way that this can be accomplished?

 

Thanks,

 

Chris

0 Kudos
Message 3 of 6
(4,138 Views)

Hey Chris,

 

While it doesn't exactly give xAxis and yAxis coordinates (although I'm not exactly sure what yAxis data you are looking for on the digital graph), you could try the following:

 

        private void sampleDigitalWaveformGraph_PlotAreaMouseDown(object sender, MouseEventArgs e)
        {
            DigitalState digState;
            int waveformIndex;
            int sampleIndex;
            int signalIndex;

            if (sampleDigitalWaveformGraph.HitTest(e.X, e.Y) == DigitalWaveformGraphHitTestInfo.SignalPlot)
            {
                sampleDigitalWaveformGraph.GetSignalPlotAt(e.X, e.Y, out digState, out waveformIndex, out sampleIndex, out signalIndex);
            }
        }

 

This will return to you the digital state of the signal (presumably the yAxis information you want) and the sampleIndex (presumably the xAxis information you want).  Please let me know if this does not meet your needs.

 

NickB

National Instruments

0 Kudos
Message 4 of 6
(4,132 Views)

Doh!  Sorry... I forgot you were a VB guy...  This should be pretty straightforward to transfer, but let me know if there is any confusion. 

 

NickB

National Instruments

0 Kudos
Message 5 of 6
(4,129 Views)

Hi Again Nick,

 

Thank you for the assistance.

 

Basically, I am using the DigitalWaveFormGraph to display 24 hours of 32 status bits at a rate of one per second. All I want to do here is 'Left Click' in the plot area to show a vertical cursor indicating the time of day (sampleindex from your example). I have used the function you suggested 'GetSignalPlotAt' and passed a constant y value to avoid clicking in between signals.

 

I works perfectly, thanks again,

 

Chris

0 Kudos
Message 6 of 6
(4,102 Views)