Closed Shubham-Vishwakarma closed 2 years ago
The only way to decrease the spacing would be to decrease the size of the canvas
Or increase the radius. You can use layout padding to add space to gge bottom, if thst is what you are actually trying to do.
Hey @kurkle. In my opinion, Instead of having a position of the label at the top, we should put labels underneath the doughnut and pie charts, so that label's position can be relative to the chart's bottom side and that will be more appropriate. What say?
Its the legend
plugin that shows the labels. You can change the position.
https://www.chartjs.org/docs/latest/samples/legend/position.html
Like in the below image, the label's position is fixed. What I am saying is to make its position relative to the chart so that the extra space between label and chart can be minimized.
It is relative to the chart (canvas). As is the radius
. You should not try to modify the chart size by reducing the radius
, but changing the canvas container size.
https://www.chartjs.org/docs/latest/configuration/responsive.html
Got it! Thanks for this insight.
Apologies for late response
The application was referring to Chart-2.8.0 previously and output looked like this
We were planning to update it with latest Chart Js version and now output looks like this
The pie chart has expanded a lot In newer version the .css files has been removed due to which I think the problem is caused by that.
I went through the docs and was able to figure out how to decrease the radius But there's a gap between label and graph
I am not sure when used canvas of fixed size will make it responsive or not
Please guide me Just to mention, I am new to ChartJS
Its the default aspectRatio change.
I think this was answered. The change in v3 was the default aspect ratio changing to be a square. The aspectRatio
can be set to 2
to go back to the v2 behaviour
I was try donut chart on https://www.chartjs.org/docs/latest/charts/doughnut.html
With the below radius set at 50% How to decrease the spacing from chart/graph and labels Right's now there's a lot of spacing