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.

chart not filling-up div

See original GitHub issue

See screenshot

I want the chart to nicely fill up the area. Is this a bug? Or am I doing something wrong?

Thanks!

HTML

<div class="chart-wrapper">
    <chart class="chart" [options]="options"></chart>
</div>

CSS

.chart {
    border: 3px solid yellow;
    width: 100% !important;
}

.chart-wrapper {
    border: 3px solid orangered;
    width: 100% !important;
}

[bug]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
sspillemancommented, Apr 30, 2016

You’re probably right… I fixed it by applying “display:block” to the chart div… Must be the bootstrap class “container” leaking onto your component or something. You may want to add it to the docs though

7reactions
born2netcommented, Apr 16, 2017

do this:

chart {
    width: 100% !important;
    margin: 0 auto;
    display: block;
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Zingchart chart not filling parent div's width - Stack Overflow
The barchart is rendered correctly but the width doesn't seem to much the parent div. I've checked if anything is setting the height...
Read more >
How can I make a chart fill its parent div · Issue #72 - GitHub
When I set no height/width, it seems to default too an arbitrary w/h. I want to only control the parent div's w/h so...
Read more >
Responsive Charts - Chart.js
When it comes to changing the chart size based on the window size, a major limitation is that the canvas render size (...
Read more >
How to make a div fill a remaining horizontal space using CSS?
The width property is used to fill a div remaining horizontal space using CSS. By setting the width to 100% it takes the...
Read more >
Charts small and aligns left, and does not fill container
My charts tend to be small, and floated to the left of the <div> container. I believe one of the reasons for this...
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