You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui_plot/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo f or a new
example.
* Do NOT open PR:s from your `master` or `main` branch, as that makes it
hard for maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! We will review your PR, but our time is limited!
-->
label_formatter only provides the name of the plot and the position of
the point,
but that makes identifying the exact data point unnecessarily
complicated,
when the index of the data point is available internally.
To change that, I wanted to add some more generic functionality, which
either requires an interface break or adding a new function - I decided
for the ~~latter~~ former.
I changed the label_formatter interface to introduce three improvements:
1. Instead of passing an empty string "" for the plot name when no data
point is selected, we pass an enum
2. Instead of returning a String, we return an Option<String>, which
allows hiding the label when we don't need it, e.g. when not hovering
over a data point.
3. Instead of taking just the position and plot name, we take the
position, data point index and plot name.
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
0 commit comments