Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the XPosition of a XyCursor

Hello,

 

in the attached example I try to set the XPosition of an XYCursor. The SnapMode is ToPlot. When I set the XPosition on an valid x-value, the cursor is automatically set to an other x-value in the near of the point. When I zoom in the graph and there are not so many points on the screen, it works fine.

 

Best regards

 

Gerald

0 Kudos
Message 1 of 3
(4,734 Views)

Hi, Gerald

 

I believe the behavior you are reporting is a bug, and I have filed bug ID 537212 to address it. I've also been able to work around the issue as follows:

 

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
    var xValue = ( double )numericUpDown1.Value;
    var xData = this.scatterPlot1.GetXData(  );
    int xIndex = Array.FindIndex( xData, val => val == xValue );

    // A value of -1 indicates the xValue was not found in xData.
// You may want to handle a value of -1 by finding a close match to xValue. if ( xIndex != -1 ) this.xyCursor1.MoveCursor( xIndex ); }

Please let me know if you have any questions or if this work around doesn't fit your requirements.

 

 

Daniel Dorroh
National Instruments
0 Kudos
Message 2 of 3
(4,680 Views)

Hello,

 

thank you for the fast answer. The workaround is perfect for me.

 

Best regards

 

Gerald

0 Kudos
Message 3 of 3
(4,668 Views)