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.

Make layout height & width understand viewport and percentage sizes

See original GitHub issue

Hi, how can I set the width of the svg chart according to viewport width? I tried using width: '80vw' in layout, but plotly doesn’t seem to parse the vw units. Appreciate any help!

      const layout = {
        hovermode: 'closest',
        autosize: true,
        // width: 1000,
        // height: 600,
        margin: {
          l: 50,
          r: 20,
          b: 50,
          t: 50,
          pad: 10
        },
        yaxis: {
          rangemode: 'tozero'
        }
      }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:11
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

21reactions
nzjrscommented, Jun 12, 2017

also broken for me. any pointers how to make graphs be 100% of their parent container?

12reactions
tdpetroucommented, Apr 22, 2020

This is still an issue. Height of figures is 450px unless you set it explicitly using px or vh/vw. Spent an extraordinarily long time banging my head against the wall on this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Viewport Units: A Quick Start - SitePoint
Viewport Height (vh). This unit is based on the height of the viewport. · Viewport Width (vw). This unit is based on the...
Read more >
Viewport concepts - CSS: Cascading Style Sheets | MDN
The width property controls the size of the viewport. It should preferably be set to device-width , which is the width of the...
Read more >
How to Understand Viewport Units in CSS - Perficient Blogs
Viewport units let you size items and fonts as a proportion of the user's screen's total width or height (the viewport).
Read more >
How Big Is That Box? Understanding Sizing In CSS Layout
A grid track sized using a percentage will calculate the percentage from the grid container width. You can also use percentages for the...
Read more >
Fun with Viewport Units | CSS-Tricks
Viewport Minimum ( vmin ) – A percentage of the viewport width or height, whichever is smaller. 10vmin will resolve to 10% of...
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