reactchartjs / react-chartjs-2

React components for Chart.js, the most popular charting library
https://react-chartjs-2.js.org
MIT License
6.63k stars 2.36k forks source link

Multitype Chart Sample doesn't work after building. #1063

Closed jlmn1026 closed 2 years ago

jlmn1026 commented 2 years ago

Would you like to work on a fix?

Current and expected behavior

This page's sample doesn't work after building due to tree-shaking. Chart Component needs to register Controller (this sample needs Bar and Line Controller). https://react-chartjs-2.js.org/examples/multitype-chart

this can't be reproduced in sandbox.

Reproduction

https://codesandbox.io/s/github/reactchartjs/react-chartjs-2/tree/master/sandboxes/chart/multitype?from-embed

chart.js version

3.8.0

react-chartjs-2 version

4.3.1

Possible solution

add BarController, LineController to register.

Arantiryo commented 2 years ago

Hi @HalJune1026 👋

Thank you for bringing this up! I was able to reproduce it and indeed importing and registering BarController and LineController solves the issue.

I'll make a PR to fix it momentarily.