ng2-charts icon indicating copy to clipboard operation
ng2-charts copied to clipboard

How to add rounded corners to a doughnut chart?

Open AnaTorres88 opened this issue 5 years ago • 4 comments

I've been trying to add rounded corners to a doughnut/gauge chart. I've tried to use ViewChild to try to manipulate the canvas with no success.

Has someone encountered this problem before? What's the best way to solve it?

https://stackblitz.com/edit/chartjs-angular-pupzff

AnaTorres88 avatar Mar 21 '19 15:03 AnaTorres88

Stackblitz in link doesn't exist.

paviad avatar Mar 24 '19 07:03 paviad

Your link is not available , I used chart options to handle gauge chart, it may help you too.

public chartOptions: any = {
		scaleShowVerticalLines: false,
		responsive: true,
		circumference: Math.PI,
		rotation: Math.PI,
		cutoutPercentage: 80, // precent
		plugins: {
			datalabels: {
				backgroundColor: 'rgba(0, 0, 0, 0.7)',
				borderColor: '#ffffff',
				color: function (context) {
					return context.dataset.backgroundColor;
				},
				font: function (context) {
					var w = context.chart.width;
					return {
						size: w < 512 ? 18 : 20
					}
				},
				align: 'start',
				anchor: 'start',
				offset: 10,
				borderRadius: 4,
				borderWidth: 1,
				formatter: function (value, context) {
					var i = context.dataIndex;
					var len = context.dataset.data.length - 1;
					if (i == len) {
						return null;
					}
					return value + ' mph';
				}
			}
		},
		legend: {
			display: false
		},
		tooltips: {
			enabled: `false`
		}
	};

mahsaml90 avatar Mar 26 '19 06:03 mahsaml90

Sorry, this is the link.

https://stackblitz.com/edit/chartjs-angular-comp

AnaTorres88 avatar Mar 29 '19 16:03 AnaTorres88

I'm also finding solution for this. please can you update the answer

Ranindu15 avatar Jan 21 '21 16:01 Ranindu15

Not an issue. Refer to the the Chart.js documentation to learn how to configure charts.

santam85 avatar Dec 07 '22 15:12 santam85