Skip to content

Introduce type parameter for plot points #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bircni
Copy link
Contributor

@bircni bircni commented Feb 8, 2025

This pull request introduces a new "Userdata" demo panel to the plot demo, showcasing how custom per-point user data can be attached and accessed during label formatting. It also refactors the plot item geometry to include an optional Id, allowing label formatters to receive both the item identifier and point index for richer tooltip customization. Several snapshot images are updated to reflect these demo and API changes.

Userdata demo and API enhancements:

  • Added a new Userdata demo panel to PlotDemo, demonstrating how to associate custom information with each plotted point and display it in tooltips using the label formatter.
  • Refactored PlotGeometry::Points to carry an optional Id, enabling identification of the plot item during hover interactions.
  • Updated the label formatter API to receive an optional tuple of (Id, index), allowing tooltips to display custom per-point data.
  • Modified all plot item implementations (Line, Polygon, Points, Arrows) to provide their Id in the geometry for correct user data association.

These changes make it easier to build interactive plots with custom per-point data and tooltips, and provide a clear demo for users to follow.

Reopening emilk/egui#4719

@bircni
Copy link
Contributor Author

bircni commented May 4, 2025

@lucasmerlin @emilk could you have a look at it?
The issue has several upvotes

@bircni bircni force-pushed the plot-point-userdata branch 2 times, most recently from fffbf1d to 472cf91 Compare August 8, 2025 19:04
@bircni
Copy link
Contributor Author

bircni commented Aug 8, 2025

@emilk Could you have a look at it again - I think I fixed everything now :-)

@bircni bircni force-pushed the plot-point-userdata branch from 472cf91 to 7d168be Compare August 8, 2025 19:09
@bircni bircni requested a review from emilk August 10, 2025 14:40
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.

custom data for hover label
2 participants