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

cyberrranger picture cyberrranger  路  3Comments

pchristou picture pchristou  路  3Comments

lilling picture lilling  路  3Comments

Helayxa picture Helayxa  路  3Comments

watalberto picture watalberto  路  3Comments