Primeng: Chart is ignoring height attribute

Created on 21 Jul 2016  路  3Comments  路  Source: primefaces/primeng

I tried height="100" and [height]="100" and both are ignored. The chart canvas continues to take up available space.

Most helpful comment

Be carefull to something...

When you use Chart.js there is a default option called "maintainAspectRation" set to true.

So with this is option set to true, your graph height is overridden by the computed height according to the width.

I use the following option parameter :

this.diveChartOptions = {
            scales: {
                xAxes: [{
                    type: 'linear',
                    position: 'bottom'
                }]
            },
            maintainAspectRatio: false
        };

With this, my "height" parameter works well.

So I think there is no issue here.

All 3 comments

+1

Be carefull to something...

When you use Chart.js there is a default option called "maintainAspectRation" set to true.

So with this is option set to true, your graph height is overridden by the computed height according to the width.

I use the following option parameter :

this.diveChartOptions = {
            scales: {
                xAxes: [{
                    type: 'linear',
                    position: 'bottom'
                }]
            },
            maintainAspectRatio: false
        };

With this, my "height" parameter works well.

So I think there is no issue here.

Please try with the latest PrimeNG version and comment if the issue still persists.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SchneMa picture SchneMa  路  3Comments

just-paja picture just-paja  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments

garethlewis picture garethlewis  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments