question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Graph(style='height=100%') fails when reducing window size on Firefox

See original GitHub issue

PIP

dash (1.0.2)
dash-bootstrap-components (0.7.0)
dash-core-components (1.0.0)
dash-daq (0.1.7)
dash-html-components (1.0.0)
dash-renderer (1.0.0)
dash-table (4.0.2)

Describe the bug

Writing: Graph(..., style=dict(height='100%'))

Expected behavior

The graph should fill the full height of the div, which will obey normal CSS rules, that is, span all the available space in the layout. It should not cause any overflow, and respond to window resize (also on Firefox 😉.

Actual behavior

  • A scrollbar appears for a small amount of overflow (both Chrome and Firefox). Since the amount is small, it is possible to work around this with overflow=hidden, but it may cause clipping (e.g. if using long labels for the X axis, etc.).

  • Reducing window size does not cause graph resize (Firefox only). That is strange, one would expect that any resize event is handled the same way, regardless if the new size is higher or lower than the original size.

Edit

The following example almost works, except for the two issues above. This threw me off, originally I thought that the feature does not work at all. I edited the issue title and content accordingly.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
Marc-Andre-Rivetcommented, Nov 19, 2019

@antoinerg Too fast! I updated the comment above with responsive=True 😀

2reactions
wbrgsscommented, Aug 22, 2019

@orenbenkiki I too have experienced some frustrations using Flexbox layouts with dcc.Graph — there is more work to be done on complex flex layouts. For your simple example, I think this may work:

...
        dcc.Graph(
            figure=dict(layout=dict(autosize=True)),
            config=dict(responsive=True),
            style={
                'height': '100%',
            },
        ),

Behaviour on Firefox without my suggestion (cut-off x-axis)

x-axis-cutoff

With my suggestion (responsive=True)

x-axis-visible

That is, add responsive=True to the config argument in dcc.Graph(). You can thank @antoinerg for that. Related issue plotly/plotly.js#3034 and PR: plotly/plotly.js#3056

Does that solve your problem? The documentation for this could probably be higher-profile, sorry about that. There is a section on it here.

I also want to echo @alexcjohnson that we appreciate your clear and well-defined issues with examples!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Graph(style='height=100%') fails when reducing ...
Reducing window size does not cause graph resize (Firefox only). That is strange, one would expect that any resize event is handled the...
Read more >
Changes to toolbars and window sizes are not saved | Firefox ...
If Firefox doesn't remember changes you've made to toolbar customizations or to browser window size or position, this article has solutions.
Read more >
Improving Firefox stability with this one weird trick
Poorly behaving web pages and apps are no longer capable of crashing the browser by exhausting memory, thanks to a simple trick.
Read more >
Firefox crashes when window size is increased beyond ...
I checked the size with "xwininfo". It seems, the bug is triggered if I resize the window to be larger than 2729 pixel...
Read more >
Bug Writing Guidelines - Mozilla
Bug Writing Guidelines. This page assumes you'd like to contribute to the Mozilla project by collecting enough information to enter a useful bug...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found