Skip to content

Legend: detach and toggle visibility of plottables (WinForms)#1589

Merged
swharden merged 33 commits intoScottPlot:masterfrom
BambOoxX:control-plotlegendviewer
Jan 26, 2022
Merged

Legend: detach and toggle visibility of plottables (WinForms)#1589
swharden merged 33 commits intoScottPlot:masterfrom
BambOoxX:control-plotlegendviewer

Conversation

@BambOoxX
Copy link
Contributor

@BambOoxX BambOoxX commented Jan 22, 2022

This PR is a WIP, it implements some ideas about interactive legends discussed in #1573 for WinForms :

  • Possibility to detach a legend and display it in another window
  • Possibility to hide/show plottables from a detached legend
  • Added a demo example to help illustrate the behavior

screenshot-detached-legend

BambOoxX and others added 8 commits January 21, 2022 18:17
…ded `Legend` property

- `Plot` alone does not have a `Refresh` method
- If a plottable is set to invisible using the detached legend, it remains plotted in the detached legend, but with a dimming overlay to reflect the sattus change
- Requires access to visibility status of the plottables. Example of modification with `Scatter` by adding `plottableVisible` property to `LegendItem`
- `UpdateLegendItems` can optionally show all plots whether they have a label or not (probably not very stable at the moment)
@BambOoxX
Copy link
Contributor Author

@swharden Did you manage to get a quick look to the FormsPlotLegendViewer I think it is a pretty cool interactive feature. Also, it could be used to modify other properties of the plottables than the visibility alone.

@swharden
Copy link
Member

swharden commented Jan 23, 2022

@swharden Did you manage to get a quick look to the FormsPlotLegendViewer I think it is a pretty cool interactive feature. Also, it could be used to modify other properties of the plottables than the visibility alone.

Hi @BambOoxX! I hadn't looked at it until now - I've been totally lost in spline land this weekend #1577 #1593 🤪

I edited your original comment to include a demonstration of what this PR does. It's looking great! I'll do a line-by-line review now and offer suggestions if I see any.

One issue is that this PR is causing the Test_Legend_RendersWithoutRenderingPlotFirst() to fail... but hopefully that will be an easy fix! EDIT: see code review comments

Copy link
Member

@swharden swharden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great @BambOoxX! I added more comments than some of your other PRs because there are so many changed files here (I don't want you to think I'm being overly critical)

Let me know if you have any questions about any of these! If you go through and resolve these points best you can I'd be happy to pick it up from there and we can merge it in soon 👍🚀

- `includeall` replaced with `includeInvisibleOrEmptyLabels`
- Added a help section to describe the optionalbehavior
@BambOoxX
Copy link
Contributor Author

@swharden Could you tell me if you see something you don't want to be modified. I really don't want to ruin something here ^^

@swharden
Copy link
Member

Hi @BambOoxX, thanks again for all this work! It took me a while to get back to you because my work on #1606 / #1593 took more time than I expected 😅

I'll start to review it now and make some commits to this PR branch then merge it in hopefully later tonight (I'm in EST time zone). I recommend that you not make changes or push commits to this PR branch while I'm actively working on it to avoid merge conflicts. Thanks for resolving so many of those issues! I'll do my best to resolve the remaining open issues myself and get this merged. After this gets merged we can still improve this system at any time with new PRs 👍

@swharden
Copy link
Member

oh, and thanks again for your work on #1422 - it's what inspired me to go back and work on spline interpolation! Those draggable points are awesome

https://swharden.com/blog/2022-01-22-spline-interpolation

screenshot (1)

@swharden swharden enabled auto-merge January 26, 2022 04:34
@swharden
Copy link
Member

Wow, that was complicated! Lots of sticky little edge cases with this one. I think I got all of them worked-out, but if you have ideas for improvements feel free to open a new PR. Thanks again for all your excellent work on this @BambOoxX! 🚀

@swharden swharden merged commit af561e3 into ScottPlot:master Jan 26, 2022
@swharden swharden changed the title New Legend rendering capabilities Legend: detach and toggle visibility of plottables (WinForms) Jan 26, 2022
@BambOoxX
Copy link
Contributor Author

oh, and thanks again for your work on #1422 - it's what inspired me to go back and work on spline interpolation! Those draggable points are awesome

https://swharden.com/blog/2022-01-22-spline-interpolation

screenshot (1)

That looks reaaaaaaaally nice !

@BambOoxX
Copy link
Contributor Author

@swharden You did an awesome job improving my proposal, I couldn't have brought it so far ! Well done !

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.

Feature: click legend items to toggle visibility

2 participants