score:121
since version 2 the field has been renamed to cutoutPercentage.
cutoutPercentage
Number 50 - for doughnut, 0 - for pie
The percentage of the chart that is cut out of the middle.
It can be used like this
var options = {
cutoutPercentage: 40
};
more details here http://www.chartjs.org/docs/#doughnut-pie-chart-chart-options
Update: Since version 3
var options = {
cutout: 40
};
According to the documentation at release notes of 3.x
Doughnut
cutoutPercentage
was renamed tocutout
and accepts pixels as numer and percent as string ending with%
.
score:2
I wanted to add how to achieve this exactly in React.
this.myChart = new Chart(this.chartRef.current, {
type: 'doughnut',
options: {
cutout:120
},
data: {
labels: this.props.data.map(d => d.label),
datasets: [{
data: this.props.data.map(d => d.value),
backgroundColor: Object.values(CHART_COLORS)
}]
}
});}
score:6
If you are using chart.js for Angular via ng2-charts you would do something like this in your component.html file:
// component.html file
<canvas baseChart [options]='chartOptions'>
</canvas>
// Do note that other required directives are missing in this example, but that I chose to highlight the 'options' directive
And do something like this in your component.ts file:
//component.ts file
chartOptions = {
cutoutPercentage: 80
};
A helpful source of information: available chart directives and config options for the [options] directive
score:6
Since version 3 the field has been renamed to cutout.
It can be used like this since version 3 the field has been renamed to cutout.
50% - for doughnut, 0 - for pie
It can be used like this
var option = {
cutout:40
}
score:24
use, percentageInnerCutout, like:
var options = {
percentageInnerCutout: 40
};
myNewChart = new Chart(ct).Doughnut(data, options);
Demo:: jsFiddle
score:43
var options = {
cutoutPercentage: 70
};
Source: stackoverflow.com
Related Query
- How to vary the thickness of doughnut chart, using ChartJs.?
- How to add text inside the doughnut chart using Chart.js?
- How to add text in centre of the doughnut chart using Chart.js?
- How to display the labels in doughnut chart using ng2 charts?
- How to add text inside the doughnut chart using Chart.js version 3.2.1
- Chartjs - how to change the notation of doughnut chart
- How to get the data attribute of the canvas chart created using chartjs
- How to add text inside the doughnut chart using Chart.js AngularJS 2.0?
- ChartJs 2 How to remove numbers from the doughnut chart on loading
- How to add image inside the doughnut chart using chart.js?
- Dynamically update the options of a chart in chartjs using Javascript
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- How to create single value Doughnut or Pie chart using Chart.js?
- How can I add some text in the middle of a half doughnut chart in Chart.JS?
- how to reset the graph/chart after zoomin, pan using chartjs
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- I am using chartjs node canvas to render a chart however the graph options are being ignored
- how can i send a list of numbers from views.py to a chartjs file im using for the front?
- How to use set the color for each bar in a bar chart using chartjs?
- How to display chart using Chartjs with JSON data in Laravel
- angular-chart.js doughnut chart : How do I change width of the arc of a doughnut?
- How to update a chart using VueJS and ChartJS
- How to highlight single bar in bar chart using Chartjs
- How to rotate the Label text in doughnut chart slice vertically in chart.js canvas, Angular 12?
- How to get the database data into ChartJS using codeigniter
- How to reduce the number of points shown on line chartjs chart with a large dataset?
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- How can I change the cursor on pie chart segment hover in ChartJS 3?
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
More Query from same tag
- How to clear the data for a angular-chart
- How to remove grid on chart.js
- Chart.js v3.x time series on x axis
- How to toggle one of multiple y axis on chart.js
- How to assign an array to data of charts.js's counts
- Draw chart.js as svg
- Show label for every data point in line chart
- angular-chart.js tickmark issue
- Center origin of a Scatter Chart
- Chart.js: Bar chart multiple colors
- Rest api / json error while using it with react chartjs
- Chart.js HiLo chart example
- Chart JS Line Graph multitooltipkey background color issue
- Creating dynamic arrays in Angular2
- Is it possible to draw min / max lines on Chart JS
- Loading and updating dynamic charts with dynamic data (chart.js)
- how to update chartjs2 option (scale.tick.max)
- How to install vue-chartkick and use it in my components?
- X and Y axis labels not displaying on line chart (Chart.js)
- Skipping the initial animation of a line chart
- vue-chartjs remove top rectangle (datasets label)
- Chart.js wrong x axis date time?
- warning in chartjs/react-chartjs options assignment if setting type:'time'
- How to mutate VueJS prop?
- ChartJS not displaying time data using Moment.js
- How to make Laravel Charts
- Chart.js: How to group legends of dataset? So one toggle for multiple datasets?
- Datalabels not showing on Chart.js
- Dotted Line in ChartJS
- Chartjs - How to update the data from values in my database?