Skip to content

Chart canvas/context becomes null until a few redraws later #79

@ThenTech

Description

@ThenTech

As mentioned here, I get the same error Cannot read properties of null (reading 'addEventListener') when using this plugin with react-chartjs-2. When rendering a tree type graph, at some point the chart.canvas reference becomes null thus throwing the error in createProxyAndListen from ChartJS.

If I add redraw={true} to the react-chartjs-2 Chart wrapper, and force it to recreate the graph every time, it does seem to work, but still throws the error 2 times.

I am not sure if I'm missing something else or where exactly the problem originates.

To Reproduce

Use react-chartjs-2's Chart and create a tree type chart.

Expected behavior

I expect the tree to be rendered the first time around.

Context

  • Version:
"chart.js": "4.4.0",
"react-chartjs-2": "5.2.0",
"chartjs-chart-graph": "4.2.3",
  • Browser: Chrome 116.0.5845.141

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions