Skip to content
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

Add Plot::hover_indexes & Plot::items::group to retrieve indexes of the source #2628

Closed
wants to merge 10 commits into from

Conversation

haricot
Copy link
Contributor

@haricot haricot commented Jan 25, 2023

In the plot when the hover function is used, I notice that we can retrieve the indexes from the source without additional cost (without iterating twice).

Once we have the indexes, given that the items of the plot are presented in the order in which they were pushed, if one of them is hidden in the plot via the legend then the order of the items shifts and it is therefore difficult to know what source items it is. (or else we rely on hidden_item to update the indexes but if they don't have a name we can't know, they won't appear in hidden_items).
Hence the addition of groups which allows this to be overloaded via SourceIndex.

This allows to find the indexes and the source of the item in the following cases:
if the group has not been defined, we can still recover but is retain items.
if the group is defined and sub_index is true and it is a line for example.
if group is defined and sub_index is false and it is points in a vector that nests others.
if multiple groups are defined and they represent a graph.

This can allow to select the element with which we can interact and it would not necessarily need the PR allow_hover #2558.

With groups this leaves enough flexibility to be able to present the data as desired.

Alternative would be another way to generate the hidden_items so that one is not lag if one becomes hidden.
it wouldn't need retain items, but such a visible filter.
This would involve keeping track of the index when initializing the plot and then we would only need the optional sub_index but it seems to me that we would not have the point indices indexes embedded in several vectors for example .

@haricot haricot force-pushed the hovered_src_indexes branch from 43dbd45 to 52f65e2 Compare February 14, 2023 11:42
@haricot haricot marked this pull request as ready for review February 14, 2023 14:29
@haricot haricot changed the title Add plot_hover_indexes & Plot::items::group to retrieve src index Add Plot::hover_indexes & Plot::items::group to retrieve src index Feb 14, 2023
@haricot haricot changed the title Add Plot::hover_indexes & Plot::items::group to retrieve src index Add Plot::hover_indexes & Plot::items::group to retrieve the indexes and the source Feb 14, 2023
@haricot haricot changed the title Add Plot::hover_indexes & Plot::items::group to retrieve the indexes and the source Add Plot::hover_indexes & Plot::items::group to retrieve indexes of the source Feb 15, 2023
@haricot haricot marked this pull request as draft February 18, 2023 11:04
@icanwalkonwater
Copy link

icanwalkonwater commented Jan 19, 2024

Hi, is there any news on the status of this PR ?

There is still interest in it as evidenced by myself and several others (#1778, #3028, #3784) asking for a similar thing.

The current workaround of using the label_formatter is not exactly satisfactory lets say.

@haricot
Copy link
Contributor Author

haricot commented Jan 22, 2024

I think I have something more concise but I've gotten a little confused with other features that seem to me to take precedence. I think the principle is there.
I've had a lot of setbacks lately, I can't guarantee anything about the progress of this pull request yet. In any case, I would like to get back to it.

@emilk
Copy link
Owner

emilk commented Jul 15, 2024

egui_plot has recently been moved to its own repository, at https://github.com/emilk/egui_plot

This will hopefully speed up its development by having more reviewers and maintainers.

Please re-open this PR at https://github.com/emilk/egui_plot/pulls

See also:

@emilk emilk closed this Jul 15, 2024
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.

3 participants