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">
      <canvas width="100%" height="100%" id="myChart"></canvas>


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

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


You have to set options for your Chart

JS :

options = { aspectRatio: 1 }


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


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

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


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