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

Toggle series visibility #5

Open
tbreloff opened this issue Sep 15, 2015 · 2 comments
Open

Toggle series visibility #5

tbreloff opened this issue Sep 15, 2015 · 2 comments

Comments

@tbreloff
Copy link
Member

Can you pick up mouse-clicks on a Gadfly legend? If so it would be great to implement the feature of clicking on an item in the legend to hide/show the series in the underlying plot using the setproperty!((hfig,:line), true, :visible) command.

@timholy
Copy link
Member

timholy commented Sep 15, 2015

Ooh, like that idea!

Not a problem in principle. I've got to shift to other things now, but I can look into this later. If you want to dig into this yourself, here's how I'd go about it:

# render your figure
julia> showcompact(f.cc)

(EDIT: that was unreadable. This is better.)

Now look at the output and figure out which Context contains the legend. For example, the main plot area is "labeled" with an svgc(plotpanel). Hopefully legends get an svgc label too.

Assuming you find something, we can modify drawpart to report the coordinates of the legend, just as it does the plotpanel.

One last step will be to do coordinate transformations sort of like here to determine which one the user clicked on.

@timholy
Copy link
Member

timholy commented Sep 15, 2015

(Obviously, checking the Gadfly source for how it renders legends might be informative 😄)

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

No branches or pull requests

2 participants