score:17

Accepted answer

The problem is not the doughnut, it is the canvas in which it is used.

The doughnut has to use a quadratic box, otherwise it would look like an ellipsis. So if you change the size of the canvas and make it quadratic you won't have any borders anymore.

Here is an JS Fiddle example.

<table border="1">
  <tr>
    <td>
      First
    </td>
    <td>
      <canvas width="100%" height="100%" id="myChart"></canvas>
    </td>
    <td>
      Third
    </td>
  </tr>
</table>

score:0

I think responsive needs to be set to false, then the height and width properties work like this:

const options= {
 responsive: false
} 
<div>
  <canvas id="chart-gender" width="300" options={options} height="300"></canvas>  
</div>

score:0

You have to set options for your Chart

JS :

options = { aspectRatio: 1 }

HTML :

<canvas baseChart [options]="options"></canvas>

score:3

After ton of research, I found that setting width and height will remove that space.

<div>
<canvas id="chart-gender" width="300" height="300"></canvas>  
</div>

score:10

I've been having the same issue recently. My solution was to change the aspect ratio of the chart with

options: { aspectRatio: 1 }

According to the docs here the default is set to 2. If you change it to 1, the chart canvas will be square and there won't be all that whitespace around your doughnut / pie.

Hope this helps someone!


Related Query

More Query from same tag