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

Plot::items::highlight set highlight in plot and in legend plot #2491

Closed
wants to merge 1 commit into from

Conversation

haricot
Copy link
Contributor

@haricot haricot commented Dec 20, 2022

While working on a proposal for feature additions for the Plot widget, I realized that the Plot: items were not reacting with the parameter highlight function.
I take this opportunity to propose BoolState which will make it a little clearer than the double boolean necessary for its operation, it seems to me. Also the same case repeats itself if we want to add this functionality with allow_hover , which I would like to propose soon among others.

@haricot
Copy link
Contributor Author

haricot commented Jan 8, 2023

otherwise I propose a branch with double booleans:
If the first boolean is true, it highlights
and the second boolean is its changing state.

@haricot haricot changed the title Plot::items: fix bool setting of highlight Plot::items fix bool setting of highlight Jan 8, 2023
@emilk
Copy link
Owner

emilk commented Jan 23, 2023

Can you expand a bit on the problem? I would expect .highlight(true) to highlight the given item this frame. What is the difference between init and state?

@haricot
Copy link
Contributor Author

haricot commented Jan 23, 2023

In fact, the highlight function doesn't seem to work without the two booleans.
in Plot::Items:

    pub fn highlight(mut self, highlight: bool) -> Self {
        self.highlight = highlight;
        self
    }

And personally, I don't see any point in disabling it (since PR #2558 allow_hover) , so another possibility is to remove those chunks if you don't want to give the option to enable or disable highlighting in setting.

@haricot
Copy link
Contributor Author

haricot commented Jan 23, 2023

What is the difference between init and state?

if init is false and highlight becomes true (state = true) then it will not be highlighted.
if init is true and highlight becomes true (state = true) then it will be highlighted.

@haricot
Copy link
Contributor Author

haricot commented Jan 26, 2023

I understood my mistake in what I expected from the highlight function.
what I was proposing here is to be able to authorize or not highlight in the plot and when hovering over the legend of the plot.
For example if a plot item has allow_hover = false we could expect it to also be in the plot legend.

@haricot haricot changed the title Plot::items fix bool setting of highlight Plot::items::highlight set highlight in plot and in legend plot Jan 26, 2023
@haricot
Copy link
Contributor Author

haricot commented Feb 10, 2023

I close this PR because it seems more necessary to me and should be named Default_highlight if necessary because it allows elements not to be highlighted when hovering in the legend of the plot.

@haricot haricot closed this Feb 10, 2023
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.

2 participants