congo/layouts/shortcodes/chart.html

13 lines
356 B
HTML
Raw Permalink Normal View History

2021-10-28 04:32:27 +00:00
<div class="chart">
{{ $id := delimit (shuffle (seq 1 9)) "" }}
<canvas id="{{ $id }}"></canvas>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", (event) => {
2021-10-28 04:32:27 +00:00
const ctx = document.getElementById("{{ $id }}");
const chart = new Chart(ctx, {
{{ .Inner | safeJS }}
});
});
</script>
</div>