Fix pie chart xaxis labels extraction for chartjs

Created on 11 February 2025, about 2 months ago

Problem/Motivation

I have a bar chart that displays correctly, using Chart.js.
When I switch the chart to pie, I'm getting a JS error:

Uncaught TypeError: n.reduce is not a function
    o plugin.legend.js:564
    <anonymous> plugin.legend.js:556
    _fitCols plugin.legend.js:205
    _fitCols plugin.legend.js:204
    fit plugin.legend.js:150
    update plugin.legend.js:89
    ss core.layouts.js:187
    update core.layouts.js:417
    _updateLayout core.controller.js:634
    update core.controller.js:528
    An core.controller.js:211
    attach charts_chartjs.js:39
    attach charts_chartjs.js:21
    attachBehaviors drupal.js:166
    attachBehaviors drupal.js:162
    <anonymous> drupal.init.js:32
    listener drupal.init.js:20

It seems related to this: https://stackoverflow.com/questions/78842674/chartjs-pie-chart-with-reac...

And it seems the same issue happened with HighCharts: #3239687: Fix pie chart xaxis labels extraction for highcharts β†’

I'll provide a fix similar to that issue.

πŸ› Bug report
Status

Active

Version

5.1

Component

Chart.js integration

Created by

πŸ‡§πŸ‡ͺBelgium ludo.r Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024