fix: 🐛 error on chart.js

This commit is contained in:
K Muller 2025-12-04 14:56:23 +01:00
parent 4a03763703
commit 236cd4b062
3 changed files with 6 additions and 84 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,7 @@
import "../../sass/front/app.scss";
import Chart from 'chart.js/auto';
// COOKIES
import CookieNotice from "@ldc-web/cookie-notice";
window.CookieNotice = CookieNotice;
window.Chart = Chart;

View file

@ -47,7 +47,9 @@
@endphp
<canvas id="{{ $id }}" width="400" height="400"></canvas>
<script nonce="{{ $nonce ?? '' }}">
new Chart(document.getElementById('{{ $id }}'), {!! json_encode($chart) !!});
document.addEventListener('DOMContentLoaded', () => {
new window.Chart(document.getElementById('{{ $id }}'), {!! json_encode($chart) !!});
});
</script>
</div>
@if($g['type'] === 'list_bilan_simplify')
@ -61,3 +63,4 @@
</div>
</div>
</div>