blowfish/layouts/shortcodes/chart.html
2023-08-17 22:01:42 +01:00

12 lines
373 B
HTML

{{ $id := delimit (slice "chart" .Ordinal now.UnixNano) "-" }}
<div class="chart">
<canvas id="{{ $id }}"></canvas>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", (event) => {
const ctx = document.getElementById("{{ $id }}");
const chart = new Chart(ctx, {
{{ .Inner | safeJS }}
});
});
</script>
</div>