Skip to content

Radial Bar Chart Label Issue #11745

@gshunc

Description

@gshunc

Expected behavior

When creating the labels field in the data object that is passed into a Doughnut in react-chartjs-2, each label that then appears in the legend should align with each dataset that is passed in. Each label's color would align with the color array of each dataset, not just with the first dataset in the datasets list.

Current behavior

Instead, the labels array aligns with each color of the first dataset, not with each. So, when we are creating doughnuts with multiple layers, or radial bar charts using the circumference callback method, we see that the colors of the labels are all the same, and match solely with the first dataset. Example shown in picture of the hacky workaround I had to come up with in order to achieve my desired result, also shown.

Screenshot 2024-04-17 at 4 53 22 PM Screenshot 2024-04-17 at 4 53 55 PM

Reproducible sample

https://codepen.io/gshunc/pen/MWRPJEP

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.4.1

Browser name and version

No response

Link to your project

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions