drupalChartsConfigsInitialization event listener is never called

Created on 6 March 2024, 4 months ago

I'm attempting to customise a chart.js chart in javascript.

Following the example in charts_api_example_js_override.js, I have a Drupal behavior attaching, can find the chart element by classname, and add the event listener (once).

But my listener is never called:

// a debug point here is hit, and the listener is attached to the canvas element.
el.addEventListener('drupalChartsConfigsInitialization', (ev) => {
  // a debug point here is never hit.
}

There are no errors in the console.

Is the example and documentation up to date?

πŸ› Bug report
Status

Closed: works as designed

Version

5.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand John Pitcairn

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

Comments & Activities

  • Issue created by @John Pitcairn
  • Status changed to Closed: works as designed 4 months ago
  • πŸ‡³πŸ‡ΏNew Zealand John Pitcairn

    In this case the issue is simply module weight. My custom module is sorted alphabetically before "charts", so it just needed a weight decrease in libraries.yml.

    Thanks @andileco for taking the time to look at this.

Production build 0.69.0 2024