chartjs / chartjs/Chart.js

Stacked bar chart generates error with latest umd

Open
#12,162 2 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

a simple stacked bar chart works when using the latest umd from a cdn, but if I take the latest umd from the 4.5.1 dist and reference it locally, I get an error. All other charts work and if I remove stacked:true, i see a working (unstacked) chart.

Local policies prevent me from using a CDN. Is this is a bug? or am i doing something wrong?

### Current behavior

The error when I use a local copy of the umd
`Uncaught ReferenceError: Cannot access 'l' before initialization
at ya (chart.umd.js:7:32206)
at BarController.parse (chart.umd.js:14:24959)
at BarController._insertElements (chart.umd.js:14:31039)
at BarController._resyncElements (chart.umd.js:14:30762)
at BarController.buildOrUpdateElements (chart.umd.js:14:24254)
at l.update (chart.umd.js:14:61851)
at l. (chart.umd.js:14:57882)
at l._doResize (chart.umd.js:7:4573)
at l._resize (chart.umd.js:14:59198)
at l.resize (chart.umd.js:14:58789)`

### Reproducible sample

https://codepen.io/joecallaghan/pen/LENXVVR

### Optional extra steps/info to reproduce

_No response_

### Possible solution

_No response_

### Context

_No response_

### chart.js version

v4.5.1

### Browser name and version

_No response_

### Link to your project

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.