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.

Responsive Charts slightly bigger than container

See original GitHub issue

I’m submitting a … (check one with “x”)

[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior the svg element is marginally bigger than its parent container in responsive mode if parent container has padding

Expected behavior the svg element would fit the parent container in responsive mode and take account of the padding

Reproduction of the problem Use any container that has padding e.g. BS4 card <div class="card"> <div class="card-header"> State Of The Parties </div> <div class="card-block" style="width:100%; min-height: 300px;"> <ngx-charts-bar-horizontal [scheme]="colorScheme" [results]="partyTotals" [yAxis]="true" [xAxis]="true" [legend]="false" [showGridLines]="false" [showXAxisLabel]="true" [showYAxisLabel]="true" [yAxisLabel]="Parties" [xAxisTickFormatting]="xBarFormat" (select)="onSelect($event)"> </ngx-charts-bar-horizontal> </div> </div>

What is the motivation / use case for changing the behavior? Chart hangs outside its container

Windows 10

  • ngx-charts version: 4.1.2
  • Angular version: 2.4.7

2017-02-14 3 2017-02-14 4

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:22 (6 by maintainers)

github_iconTop GitHub Comments

13reactions
kwes01commented, Aug 21, 2018

some one found a solution for this???

5reactions
gpit2286commented, Nov 19, 2017

It also seems that when the charts are drawn within a fxFlex box, they are drawn before the flex box width is computed.

Onload: screen shot 2017-11-19 at 1 11 56 pm

After moving the window a little to get the observeables to fire:

screen shot 2017-11-19 at 1 12 02 pm

Is there a way to get this polling to happen programmatically?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Responsive Charts - Chart.js
Resizes the chart canvas when its container does (important note...). maintainAspectRatio, boolean, true, Maintain the original canvas aspect ...
Read more >
charts.js chart size it's diferente than container setted size
I'm using a 250x250 canvas element to show a char genereated with charts.js but the chrat it's bigger ...
Read more >
Make any chart responsive with one function
Responsive content that resizes and/or reflows in response to the available space is one of the core approaches, and luckily for us it's...
Read more >
Chart Container - Concepts - Handbook - Apache ECharts
Specify the chart size. If the height and width of the container do not exist, or you wish the chart size not equal...
Read more >
How to Resize the Chart and maintainAspectRatio in Chart JS
The canvas tag, javascript, arrays and Chart JS all need to be combined to draw an eye catching bar chart or line chart....
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