Can't size doughnut chart from chart.js

19,366

Solution 1

try this in chart's option confirg

options = {
  maintainAspectRatio : false
}

Solution 2

Try to set height of canvas inline:

<div style="height: 168px">
     <canvas id="chart-area" height="168px"/>
</div>
Share:
19,366
JJS
Author by

JJS

Herro!

Updated on June 07, 2022

Comments

  • JJS
    JJS almost 2 years

    Not sure how to set height/width for doughnut chart, tried with this:

    <div style="height: 168px">
        <canvas id="chart-area" style="height: 168px"/>
    </div>
    

    I have text underneath the chart, and this only change the position of text & graph rather than the size of the doughnut chart.

    Any help will be appreciated.