-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
43dbd45
to
52f65e2
Compare
plot_hover_indexes
& Plot::items::group
to retrieve src indexPlot::hover_indexes
& Plot::items::group
to retrieve src index
Plot::hover_indexes
& Plot::items::group
to retrieve src indexPlot::hover_indexes
& Plot::items::group
to retrieve the indexes and the source
Plot::hover_indexes
& Plot::items::group
to retrieve the indexes and the sourcePlot::hover_indexes
& Plot::items::group
to retrieve indexes of the source
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. |
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: |
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 .