如何更改chartjs中两个圆环图的厚度

how to change thickness of two doughnut charts in chartjs

如果两个圆环图嵌套在另一个里面,我如何更改两个圆环图的厚度。 示例:https://codesandbox.io/s/doughnut-chart-percentage-kqoi1?file=/src/App.tsx

我想要这样:

我已经尝试使用 'cutout' 和 'weight' 选项,如果我只有一个图表,它会起作用,但我不能将两个图表更改为相同的厚度。 我想让两个甜甜圈都像图片一样薄

您可以在两个数据集上定义 cutout: '90%'

cutout: The portion of the chart that is cut out of the middle. If string and ending with '%', percentage of the chart radius. number is considered to be pixels.

请看一下你修改后的Sandbox

Not sure why but I have to press the refresh button inside the Sandbox in order to have the chart drawn correctly. I guess, Sandbox is somehow remembering your original code after I forked it.