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

Axis rescaled when legend item visibility changed [FEATURE] #9144

Closed
MikeWoodward opened this issue Aug 5, 2019 · 4 comments · Fixed by #9250
Closed

Axis rescaled when legend item visibility changed [FEATURE] #9144

MikeWoodward opened this issue Aug 5, 2019 · 4 comments · Fixed by #9250

Comments

@MikeWoodward
Copy link

@MikeWoodward MikeWoodward commented Aug 5, 2019

Currently, if legend click_policy = "hide" the legend item is hidden but the axes are not rescaled. This is fine most of the time, but there are circumstances where you'd like the axes to be rescaled, for example, if the hidden item (e.g. line) is much greater than the other items.

Here's a view of the current behavior. Chart 1 shows the full chart, chart 2 shows what's shown when Y3 is hidden.

Chart 1
bokeh_plot (1)

Chart 2
bokeh_plot (2)

Here's what I would like to happen if the appropriate setting is made:
Chart 3
bokeh_plot (3)

I don't think this should be the default behavior. I suggest a new attribute something like: hide_rescale which is False by default (current behavior). If hide_rescale is set to True, the chart axes would be rescaled.

This has been discussed on the Discourse group: https://discourse.bokeh.org/t/bokeh-update-zoom-plot-or-axis-rescaling-when-hide-series-on-legend/2708/4

@mattpap
Copy link
Contributor

@mattpap mattpap commented Aug 5, 2019

I think will have to implement more fine grained hiding policies. Currently click_policy = "hide" only affects rendering and hit testing but nothing else, e.g. data ranges computation, which is the reason for the lack of rescaling.

@MikeWoodward
Copy link
Author

@MikeWoodward MikeWoodward commented Aug 5, 2019

I've had some issues implementing the workaround which leads me to suggest some tests for when this is implemented.

I suggest whatever solution is chosen is tested for a chart nested within in a Panel in a multi-tab display or some equivalent. The point is, the chart is not the top level object in the Bokeh hierarchy. Further, I suggest the solution is tested in a Bokeh app running on the Bokeh server.

@MikeWoodward
Copy link
Author

@MikeWoodward MikeWoodward commented Aug 7, 2019

I've just bumped into another use case here.

My initial discussion focused on rescaling the y axis, but the x axis should be rescaled too.

@mattpap
Copy link
Contributor

@mattpap mattpap commented Aug 7, 2019

My initial discussion focused on rescaling the y axis, but the x axis should be rescaled too.

Whether an axis will be rescaled or not, depends on the type of ranges there are in use. If both axes have data ranges assigned, then both will be updated. So, this feature boils down to making sure that data ranges know which renderers are visible/active/enabled (whatever we are going to name that) and update when state changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants