score:17
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!
Source: stackoverflow.com
Related Query
- ChartJS – is there any way to remove blank space around pie charts?
- Is there any way to remove extra space and Horizontal line from Bar chart of Chart.js?
- Is there any way to show tooltip by default (without hover pie chart) on chartjs
- Is there any way to change the font color and size of labels in Chartjs 3.0.0
- chart.js pie chart background colors: is there any way to generate them randomly?
- Is there any way I can customize my chartjs
- Is there a better way to create an 'n' number of charts in ChartJS and ASP.NET C#?
- In ng 2 chart during the load an undefined legend gets created automatically ,Is there any way to remove it?
- ChartJS Line Charts - remove color underneath lines
- chartjs + Angular6 is not showing charts or any error
- is there a way to call a Component's function from click function of Chartjs
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- Is there any way to use 2 different color for the same bar in a chart?
- Chart.js - Remove empty space in pie chart
- Is there any way to get Chiselled Effect in chart js?
- Is there any way to get y of specific x which not belongs to the dataset in Chart.js graph?
- Is there any way to display float bar in chart.js?
- Remove slice onClick events on Pie Charts in Chart.js
- Is there a way in chartjs to display different Boolean values with an offset in Y over a common timeline?
- Is there a way to give a pie chart in chart.js a different color outer border than the border color between segments?
- Is there a way to represent date hole in chartjs time series?
- Is there a way to insert multiple lines, with labels, dynamically, into a ChartJS Line chart?
- Is there anyway to remove the dots for points from angularjs charts
- Remove white space in ChartJS when value is null
- Is there any way to change the font size of labels in bar chart in Chart.js v3?
- Is it possible to remove the border between the segments but leave the border around the pie chart in react-chartjs-2?
- Remove blank space in chart.js chart
- Is there any way to show a tooltip for points which are not visible on the chart in Chart.js?
- Remove chartjs pie chart highlight on hover
- Is There any way to show image on top of the stacked bar, Am getting image on every color Instead of that i need only on top of each bar
More Query from same tag
- Chart JS Line insert Picture
- Changing fontFamily on ChartJS bar chart
- Providing server side data for Chart.js charts
- Chartjs won't render chart with Requirejs
- Trouble with setting background color for Line chart at Chartjs version 3.5.1
- how to not repeat code while creating multiple charts in chart js
- Change dot size individually Scatter Chart -- ChartJS
- Chart.js displays the label in a weird font in IE8
- ChartJS Annotations display custom label
- Issue regards data in charts JS
- Chart.js. Edit bar width -v2.5-
- How to use chart.js in blazor?
- Using chart.js for isotopic patterns
- Chart JS ShowChart()bar" is not a chart type error
- Charts in wicket
- Call to undefined method App\Charts\SampleChart::labels(), chartjs
- Y Axes not displaying properly on Chartjs
- In chart.js bar chart, how do I label each bar within a category?
- How to add an event when clicking a bubble in bubble chart?
- Chart.js - displaying multiple line charts using multiple labels
- Chartjs render only the last in loop (ionic)
- Chartjs Doughnut Chart smooth animation in countdown
- how to setting chart js customization
- Using zoom/pan with ChartJS
- JQuery insertAfter() Method only works once when inserting a Chart.js chart
- ng2-charts update labels and data
- Changing line color below specific value in Chart.js
- Custom scatter chart extended from scatter chart becomes line chart
- chart.js data forming though the API dynamically based on selects
- Issue in implementing ChartJS in my new assignment of ReactJS App, please let me know where I am wrong