8

I am trying to increase spacing between legend labels and chart with reactjs, I've looked for different solutions but most are with vanilla js. I've added this in my chart options based on this 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}
          />
       )

enter image description here

But it's not working, am I missing something here ?

Kaung Khant Zaw
  • 1,508
  • 3
  • 19
  • 31

0 Answers0