ldc-qrcollector-back/resources/views/vendor/chart-template.blade.php
Vincent BRIDIER 518c18331c
CSP Fix
2023-10-06 14:30:31 +02:00

22 lines
918 B
PHP

<canvas id="{!! $element !!}" width="{!! $size['width'] !!}" height="{!! $size['height'] !!}">
<script nonce="{{$nonce}}">
document.addEventListener("DOMContentLoaded", function(event) {
(function() {
"use strict";
var ctx = document.getElementById("{!! $element !!}");
window.{!! $element !!} = new Chart(ctx, {
type: '{!! $type !!}',
data: {
labels: {!! json_encode($labels) !!},
datasets: {!! json_encode($datasets) !!}
},
@if(!empty($optionsRaw))
options: {!! $optionsRaw !!}
@elseif(!empty($options))
options: {!! json_encode($options) !!}
@endif
});
})();
});
</script>
</canvas>