-
-
Notifications
You must be signed in to change notification settings - Fork 404
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 a zoom tool per subcoordinate_y group #6122
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6122 +/- ##
==========================================
- Coverage 88.70% 88.69% -0.01%
==========================================
Files 316 316
Lines 66121 66129 +8
==========================================
+ Hits 58650 58654 +4
- Misses 7471 7475 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
I made the normalization per group a separate issue. I think it could probably go into your postprocessing step. |
If not all the curves are assigned a group, then none of the group-wise zooming takes effect. We should either issue a warning/error to assign all curves to a group, or just group any that aren't already assigned into a new group. Probably the former is good enough and the simpler approach. For example, in the code below, not including a group arg for the B group breaks all the intended grouping behavior. import numpy as np
import panel as pn
import holoviews as hv
hv.extension('bokeh')
x = np.linspace(0, 10*np.pi)
curves = {}
j = 0.5
for i, group in enumerate(['A', 'B', 'C']):
for i in range(2):
yvals = j * np.sin(x)
label = f'{group}{i}'
if group == "B":
curve = hv.Curve((x + i*np.pi/2, yvals), label=label, group=group).opts(
subcoordinate_y=True, tools=['zoom_in', 'zoom_out', 'hover']
)
else:
curve = hv.Curve((x + i*np.pi/2, yvals), label=label).opts(
subcoordinate_y=True, tools=['zoom_in', 'zoom_out', 'hover']
)
curves[(group, label)] = curve
j += 1
pn.Row(hv.Overlay(curves, kdims=['group', 'label']).opts(show_legend=False, width=600, height=500)).servable() |
We decided yesterday not to try to depend on bokeh/bokeh#13826 for now, since it may take a little while until this is refined and released, and may need more upstream changes in Panel (to adapt to Bokeh 3.5) before we can even start using the new Bokeh feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
closes #5901
When users assign a
group
to an Element withsubcoordinate_y
enabled, a dedicatedwheel_zoom
is created per group. The order of the zoom tools matches how the groups are displayed, i.e. the top tool controls the group displayed at the top of the chart. Each tool has a custom tooltip that contains the group name.Users can add extra
zoom_in
andzoom_out
tools. The UX isn't great but we agreed not to spend too much time trying to improve it (I've seen worse!).When overlaid with other non subcoordinate_y elements, the default zoom tool is displayed.
Implementation-wise, I opted for adding a post-processing step, instead of having to changing the structure of the zoom handle directory (accounting for groups) as it required changes in various places that are hard to follow. In the end, the implementation isn't so complex.