Problems with Chart.js version v4.2.1

Hi everyone,
when i enter the script

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-zoom/2.0.0/chartjs-plugin-zoom.min.js"></script>

in a template node, and I create two charts (1 with chart node, 1 with chart.js ) the one with chart node disappears and is no longer updated if I change page (error in console

TypeError: Cannot read properties of undefined (reading 'updateScaleDefaults')
    at app.min.js:614:5434
    at app.min.js:193:38
    at Yg.completeTask (app.min.js:189:231)
    at app.min.js:73:229

)
and that chart.js doesn't work properly the zoom (any zoom you do shows only the first data)
it happens only if type line, if type bar works perfectly (it doesn't give any error in console)

Only chart.js graphs can be made to work perfectly
Thank you

(used google translate)

If you load chart.js from the jsdelivr cdn, that will load version 4.2.1
but the Dashboard already loads Version: 2.3.0 for its own use with the Chart node
So the problem you are seeing is due to a clash of versions .. significant changes in the library with breaking functionality.

possible solutions to this could be, not to load the chart.js from cdn and use the 2.3.0 (already preloaded) and try to find a chartjs-plugin-zoom that is compatible with chart.js 2.3.0

use Apexcharts that in my opinion have a nicer zoom feature
Zoomable Timeseries

I tried several ways but chartjs-plugin-zoom without the latest version from other problems.

It would be to be able to update the dashboard to version 4.2.1 (I understand the difficulty) or to be able to load the dashboard without chart.

I will definitely try Apexcharts thanks a lot for the advice

(used google translate)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.