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.

Stacked Vertical Bar Chart with no/empty view property overflows parent container (bootstrap card)

See original GitHub issue

I’m submitting a …

[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 Stacked Vertical Bar Chart with no/empty view property overflows parent container (bootstrap card) download

Expected behavior Chart should fit within parent container

Reproduction of the problem

import { Component, OnInit } from '@angular/core';
import {single, multi} from './data';

@Component({
  selector: 'app-pitching-volume',
  templateUrl: './pitching-volume.component.html'
})

export class PitchingVolumeComponent implements OnInit {

    single: any[];
    multi: any[];

    // options
    barPadding = 20;
    colorScheme = {
        domain: ['#3f89de', '#5fc4d6', '#7067e6']
    };
    showXAxis = true;
    showYAxis = true;

    constructor() {
        Object.assign(this, {single, multi});
    }

    ngOnInit() {
        console.log('init');
    }

    onSelect(event) {
        console.log(event);
    }

}
<div class="card">
    <div class="card-header">
        <p class="text-primary"><strong>Pitching volume & effectiveness</strong></p>
    </div>
    <div class="card-body">
        <ngx-charts-bar-vertical-stacked
            [barPadding]="barPadding"
            [results]="multi"
            [scheme]="colorScheme"
            [xAxis]="showXAxis"
            [yAxis]="showYAxis"
            (select)="onSelect($event)">
        </ngx-charts-bar-vertical-stacked>
    </div>
</div>

What is the motivation / use case for changing the behavior?

Please tell us about your environment: Visual Studio Code

  • ngx-charts version: 7.0.1
  • Angular version: 5.0
  • Browser: [all]
  • Language: [all]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
TENDesigncommented, Dec 29, 2017

Wow, never used stackblitz before, but i love it! https://stackblitz.com/edit/angular-gl3d1x

1reaction
marjan-georgievcommented, Dec 29, 2017

Here it is fixed: https://stackblitz.com/edit/angular-u6endj?file=app/pitching.component.html

I assumed that your container has a height already set. The parent container must have a width and height bigger than 0 when empty, otherwise when the chart measures it and sees 0, it sets default dimensions, which is what happened here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cards - Bootstrap
Cards have no fixed width to start, so they'll naturally fill the full width of its parent element. This is easily customized with...
Read more >
Bootstrap4 get cards in columns to stretch and fill parent ...
Bootstrap 4 says that if no width is provided, cards by default stretch to fill the entire width of its container. Am I...
Read more >
Bootstrap - CodeProject
I have a bootstrap modal in my asp.net mvc code that it's body bind in runtime. first time I click on the some...
Read more >
The Ultimate Intermediate Ruby on Rails Tutorial: Let's Create ...
Go to app/views/pages and create an index.html.erb file inside this ... For the navigation bar we'll use Bootstrap's navbar component as the ...
Read more >
20 Amazing CSS Progress Bars [With Examples] - Alvaro Trigo
Here's a curated list with great animated CSS and HTML progress bars. Check out these re-usable examples or get inspired to create your...
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