【发布时间】:2022-03-26 03:37:13
【问题描述】:
我正在尝试使用reactjs 增加图例标签和图表之间的间距,我已经寻找了不同的解决方案,但大多数都是使用 vanilla js。我已经根据answer在我的图表选项中添加了这个@
const DoughnutOptions = {
plugins: [
{
beforeInit: function (chart, options) {
chart.legend.afterFit = function () {
this.height = this.height + 50;
};
}
},
{
labels: {
render: "percentage",
fontColor: ["black", "white"],
},
},
]
}
return (
<Doughnut
data={DoughnutData}
options={DoughnutOptions}
/>
)
但它不起作用,我在这里遗漏了什么吗?
【问题讨论】: