panel icon indicating copy to clipboard operation
panel copied to clipboard

Not able to responsively resize `Gauge` widget

Open nenb opened this issue 1 year ago • 0 comments

ALL software version info

pn.__version__ = '1.3.8'

Description of expected behavior and the observed behavior

I want to have a pn.indicators.Gauge widget that responsively resizes. I would like to set a minimum/maximum width. The current defaults prevent me from doing this. For example, the default width (300) is passed to the ECharts Gauge object, and I end up with a widget that overflows the surrounding container (see screenshot).

I'm not entirely sure if this is an issue with panel or the Apache ECharts library.

Complete, minimal, self-contained example code that reproduces the issue

g = pn.indicators.Gauge(min_width=100, max_width=250, sizing_mode="scale_both")

g.get_root().width  # 300, from defaults, this is what is passed to ECharts
g.get_root().min_width  # 100, limit for container
g.get_root().max_width  # 250, limit for container

Other

I'm not sure why all the widgets seem to have default values set for their width/height and sizing_mode=fixed. It seems like it would be more useful to have None as their default. This could be ignorance on my part though, and perhaps it's needed for some other reason.

A separate issue that I noticed when trying to configure this widget is that if width is present, and sizing_mode is None, then min_width is automatically changed to width. This confused me for a while until I saw this piece of code. What's the rationale for this - is it necessary?

  • [x] I may be interested in making a pull request to address this

Screenshots

Screenshot 2024-01-28 at 15 23 05

nenb avatar Jan 28 '24 18:01 nenb