Skip to content

New plottables - DraggableMarkerPlot and DraggableMarkerPlotInVector#1558

Merged
swharden merged 15 commits intoScottPlot:masterfrom
BambOoxX:plottable-draggable-marker-plot
Jan 18, 2022
Merged

New plottables - DraggableMarkerPlot and DraggableMarkerPlotInVector#1558
swharden merged 15 commits intoScottPlot:masterfrom
BambOoxX:plottable-draggable-marker-plot

Conversation

@BambOoxX
Copy link
Contributor

  • DraggableMarkerPlot is a MarkerPlot that can be dragged through a Plot. This can serve as a static way to pinpoint a location on the axes. By static I mean that does not move with the mouse unless dragged
  • DraggableMarkerPlotInVector behaves somewhat similar to as ScatterPlot that in addition has a draggable point. When you drag the point, it goes to the coordinates in the vector closest to the mouse position.

- `DraggableMarkerPlot` is a `MarkerPlot` that can be dragged through a `Plot`. This can serve as a *static* way to pinpoint a location on the axes. By *static* I mean that does not move with the mouse unless dragged
- `DraggableMarkerPlotInVector` behaves somewhat similar to as `ScatterPlot` that in addition has a draggable point. When you drag the point, it goes to the coordinates in the vector closest to the mouse position.
@swharden
Copy link
Member

swharden commented Jan 16, 2022

Hi @BambOoxX, thank you for this interesting PR! I'll begin working on it after #1556 and #1557

I haven't read the code in detail yet but I'm curious - would it be possible to inherit MarkerPlot and IDraggable to reduce a little bit of code duplication? This technique is exactly what I suggested for @anose001 in #1555 when this exact topic was raised in a discussion question earlier today.

EDIT: #1422 (comment) could use inheritance too

Now the movable marker in `DraggableMarkerPlotInVector` isn't drawn though the selection cursor moves correctly.
Color and dimensions of the cursor have been hardcoded temporarily.
New properties would be nice, in order to set only the color / size of this specific marker.
@BambOoxX
Copy link
Contributor Author

BambOoxX commented Jan 16, 2022

@swharden I just tried to use some inheritance, but for DraggableMarkerPlotInVector the draggable marker isn't plot anymore. This feels like the new Render is not taken into account.

@swharden
Copy link
Member

swharden commented Jan 16, 2022

Hi @BambOoxX, related to #1558 I got you started here by adding a cookbook example

screenshot-drag3

I was confused at first because the default marker color is white and I thought it was a rendering failure but it turns out it was just white on white, but all looks good now!

I changed the marker type to Hand but if you want the user to be able to make it a Crosshair you could make it {get;set;} and default to Hand

Can you add a similar cookbook example to demonstrate DraggableMarkerPlotInVector? That use case is a little more complex but I'd like to see how you choose to showcase it. Thanks! 🚀

@BambOoxX
Copy link
Contributor Author

Can you add a similar cookbook example to demonstrate DraggableMarkerPlotInVector? That use case is a little more complex but I'd like to see how you choose to showcase it. Thanks! 🚀

I will try and do an example, I have in mind something close to ShowValueOnHover but with something draggable.

However, I can't understand why the marker is not plotted now in DraggableMarkerPlotInVector. Could you have a look at the Render method ? Is it the correct way to inherit from ScatterPlot ?

@swharden
Copy link
Member

Hi @BambOoxX, thanks for this PR! It looks like you figured everything out and this is ready to merge. These new plot types will be available in the next release 👍 😎 🚀

@swharden swharden enabled auto-merge January 18, 2022 03:06
@swharden swharden merged commit 4375f71 into ScottPlot:master Jan 18, 2022
@BambOoxX BambOoxX deleted the plottable-draggable-marker-plot branch January 18, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants