Unable to hide Chart Legend in PrimeReact

UI Components for React
Post Reply
Nedum247
Posts: 3
Joined: 07 Dec 2016, 00:43

08 Aug 2023, 15:06

Hi Primetek team,

I am unable to hide the legend in the pie chart i am displaying in my app. I am setting the display option in the chart options to false
and it is still not hidden. See snippet below:

Code: Select all

const getPieChartOptions = () => {
    const textColor = getComputedStyle(document.body).getPropertyValue('--text-color') || 'rgba(0, 0, 0, 0.87)';
    const fontFamily = getComputedStyle(document.body).getPropertyValue('--font-family');
    return {
        plugins: {
            legend: {
                display: false,
                labels: {
                    font: {
                        family: fontFamily,
                    },
                    color: textColor
                }
            }
        }
    };
};
Kindly guide me on how to hide the chart legends.

Nedum247
Posts: 3
Joined: 07 Dec 2016, 00:43

09 Aug 2023, 09:22

This has been resolved. I set an empty label array when setting up the data object and that resolved it.

Thanks.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests