Skip to content

SP4 ScatterPlotDraggable: Bug after Update() #2969

@SasKayDE

Description

@SasKayDE

Bug Report

Issue:
After updating the X and Y values of a ScatterPlotDraggable object programmatically by calling the Update(Xnew, Ynew) and Refresh(), the plot is visualized correctly, considering the updated Xnew and Ynew values, but the draggable point coordinates are not updated and remain at the previous positions Xold, Yold, indicated by the DragCursor still appearing at the positions Xold, Yold.

Reproducing:

Correct/expected behavior after initialization:

// Initialization with initial dataX, dataY
myScatterPlotDraggable = new ScatterPlotDraggable( dataX, dataY ) { DragEnabled = true, DragCursor = ScottPlot.Cursor.Hand };
myFormsPlot.Plot.Add( myScatterPlotDraggable );
myFormsPlot.Refresh();

Change of the X and Y data programmatically results in the described/unexpected behavior:

// change of X and Y values (keeping the array sizes)
myScatterPlotDraggable.Update( Xnew, Ynew );
myFormsPlot.Refresh();

While debugging it has been observed that the changed values (in this example Ys[1]) are not updated consistently in the attributes "Ys (ScottPlot.Plottable.ScatterPlot)" and "Ys" of the myScatterPlotDraggable object after calling myScatterPlotDraggable.Update( Xnew, Ynew );

image

The result is a plotted point at 1800 (Ynew[1]) and a draggable point at 1024 (Yold[1]).

System Details

  • ScottPlot Version: 4.1.68
  • Operating System: Windows 10
  • Application Type: WinForms
  • .NET Version: .NET 6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behaviorHelp WantedScott won't do this soon, but PRs from the community are welcome!⚠️ HIGH PRIORITY

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions