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 2 commits into
base: main
Choose a base branch
from

Conversation

bircni
Copy link
Contributor

@bircni bircni commented Feb 8, 2025

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

Comment on lines +1131 to +1132
std::sync::Arc::new(egui::mutex::Mutex::new(std::collections::HashMap::<
Id,
Copy link
Owner

Choose a reason for hiding this comment

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

Nit: this could use egui::IdMap (much faster)

.collect::<Vec<_>>();

let custom_things =
std::sync::Arc::new(egui::mutex::Mutex::new(std::collections::HashMap::<
Copy link
Owner

Choose a reason for hiding this comment

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

Add some use statements to the top of this file so this becomes easier to read

@@ -1101,6 +1107,61 @@ impl ChartsDemo {
}
}

#[derive(PartialEq, serde::Deserialize, serde::Serialize, Default)]
struct UserdataDemo {}
Copy link
Owner

Choose a reason for hiding this comment

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

It's soon time to break up this file into several smaller files (not in this PR though!)

@@ -409,7 +409,7 @@ impl<'a> Plot<'a> {
/// ```
pub fn label_formatter(
mut self,
label_formatter: impl Fn(&str, &PlotPoint) -> String + 'a,
label_formatter: impl Fn(&str, &PlotPoint, Option<(Id, usize)>) -> String + 'a,
Copy link
Owner

Choose a reason for hiding this comment

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

The docstring should explain what the third parameter is here

struct DemoPoint {
x: f64,
y: f64,
custom_thing: bool,
Copy link
Owner

Choose a reason for hiding this comment

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

This makes it sounds like some demo points has a custom thing, other don't. I think this feature deserves a more realistic example

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