18👍
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>
12👍
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!
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>
1👍
You have to set options for your Chart
JS :
options = { aspectRatio: 1 }
HTML :
<canvas baseChart [options]="options"></canvas>
1👍
I used "react-minimal-pie-chart" npm, there should remove the rounded attribute for remove the space around the pie-chart.
<PieChart
animate
animationDuration={40}
animationEasing="ease-in"
data={data1}
lineWidth={20}
lengthAngle={360}
paddingAngle={0}
radius={30}
// rounded
startAngle={175}
endAngle={150}
/>;
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>