Mehrdad Masoumi
Mehrdad Masoumi

Reputation: 410

How to show the label values in each part of react-chartjs2 pie chart?

According to the image I have attached, I want to show the percentage or value of labels in the pie chart, but I couldn't find any option.

react-chartjs2 pie chart

 const options = {
    plugins: {
      legend: {
        display: false,
      },
      tooltip: {
        zIndex: 9999,
        callbacks: {
          label: function (data) {
            return "Total: " + data.formattedValue;
          },
        },
      },
      datalabels: {
        formatter: function (value) {
          //custom money icon
          return value;
        },
        color: "#000",
        font: {
          weight: 'bold',
          size:14,
        },
      },
    },
  };

Upvotes: 0

Views: 65

Answers (0)

Related Questions