Chart.js
Chart.js copied to clipboard
Make scatter chart not require the lineElement
Feature Proposal
Currently when using tree shaking to create a verry basic scatter plot you need to import and register the lineElement since it extends the line controller and sets showLine to false.
This feels weird since a scatter chart does not show lines by default so you would expect it does not need the line element.
Possible Implementation
No response
This seems like a great change to make
Is it possible that the following bug is related to this?
https://stackoverflow.com/questions/73957247/chartjsreact-toggle-showline-in-scatter-view-doesnt-work
I don't think so since you import and register everything with the auto import from chart.js.
Do you have a link with a reproducable sample?
yes, you'll find a running example here:
https://stackblitz.com/edit/react-hdhjmn?file=src/App.js
Not sure what exactly is causing the issue, when I try a simpeler case with the react wrapper or with plain js it works fine: wrapper: https://codesandbox.io/s/react-chartjs-2-chart-js-issue-template-forked-wf1d04?file=/src/App.tsx plain js: https://codesandbox.io/s/react-chartjs-2-chart-js-issue-template-forked-ce1ugl?file=/src/App.tsx
Nice! thanks now it works. I tried to find the reason why it's not working with the code before, but can't see the reason.
Thanks for your help!
Not sure what exactly is causing the issue, when I try a simpeler case with the react wrapper or with plain js it works fine: wrapper: https://codesandbox.io/s/react-chartjs-2-chart-js-issue-template-forked-wf1d04?file=/src/App.tsx plain js: https://codesandbox.io/s/react-chartjs-2-chart-js-issue-template-forked-ce1ugl?file=/src/App.tsx
If you open the wrapper example and change chart.js version to >=3.9.0 the error occurs again. All the older version don't throw this error. It might be a bug related to the newer versions...