12-15-2008 07:56 AM
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
12-16-2008 05:48 PM
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
12-16-2008 08:42 PM
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
12-16-2008 10:19 PM
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
12-16-2008 10:24 PM
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
12-17-2008 08:30 AM
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