High-performance chart control LightningChart cursor movement marker does not work properly

LightningChart.NET is fully GPU accelerated and optimized for performance, which can be used to display massive amounts of data in real time-over 1 billion data points. LightningChart includes a wide range of 2D, advanced 3D, Polar, Smith, 3D pie/donuts, geographic maps and GIS charts, as well as volume rendering functions suitable for science, engineering, medicine, aviation, trade, energy and other fields.

Click to download the latest trial version of LightningChart.NET

Problem: The marker for cursor movement does not work properly

Although this is a very simple task, I have a piece of code that does not work properly.

After moving the red crossaim marker, can you please help me to force the marker to the correct position?

After moving the marker, I call "SolveNearestSampleByCoord" to get the most recent sample: the value is correct. As you can see in the text box.
But the cursor stays at the mouse location instead of moving to the desired location.

This is the simple code I am using.
private void Cl1_MovedByMouse(object sender, MouseEventArgs e)
{ SeriesEventMarker marker = (SeriesEventMarker)sender; selectedCursor = marker.Tag.ToString(); cursorSelected = true;


        double dXValue, dYValue;
        int iNearestIndex;
        int a = 0;
        m_chart.BeginUpdate();
        if (m_chart.ViewXY.SampleDataSeries[0].SolveNearestSampleByCoord(e.X, e.Y, out dXValue, out dYValue, out iNearestIndex)) ;
        {
            marker.VerticalPosition = SeriesEventMarkerVerticalPosition.AtYValue;
            marker.HorizontalPosition = SeriesEventMarkerHorizontalPosition.AtXValue;               
            marker.Symbol.Shape = Shape.CrossAim;
            marker.XValue = dXValue;
            marker.YValue = dYValue;
            XXX = dXValue;
            YYY = dYValue;

            txtX.Text = XXX.ToString(); // Just to make sure it is the right values
            txtY.Text = YYY.ToString();
        }
        m_chart.EndUpdate(); ;

}
Insert picture description here

Reply: The marker for cursor movement is invalid.
You must add a MouseUp handler after the MovedbyMouse handler to force the marker to be placed in place.
private void Cl1_MouseUp(object sender, MouseEventArgs e)
{ SeriesEventMarker marker = (SeriesEventMarker)sender; selectedCursor = marker.Tag.ToString(); cursorSelected = true; { m_chart.BeginUpdate(); marker.VerticalPosition = SeriesEventMarkerVerticalPosition.AtYValue; marker. HorizontalPosition = SeriesEventMarkerHorizontalPosition.AtXValue; marker.XValue = XXX; marker.YValue = YYY; m_chart.EndUpdate();; m_chart.Refresh(); } }












If you want to buy a genuine license for LightningChart, or for more product information, please click [Consult Huidu Online Customer Service]

Guess you like

Origin blog.csdn.net/RoffeyYang/article/details/113739381