summaryrefslogtreecommitdiff
path: root/themes/blowfish/layouts/shortcodes/chart.html
blob: 1e1727537dec2368a469f0345c7f50d176abe670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{{ $id := delimit (slice "chart" (partial "functions/uid.html" .)) "-" }}
<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>