Fixed ChartJS

This commit is contained in:
Brandon Rozek 2022-12-05 13:17:02 -05:00
parent 5be5ad26d3
commit 6a6ecf0eb4
2 changed files with 5 additions and 6 deletions

View file

@ -1,5 +1,5 @@
<!DOCTYPE html lang="en"> <!DOCTYPE html>
<html> <html lang="en">
{{ partial "head.html" . }} {{ partial "head.html" . }}
<body> <body>
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}

View file

@ -115,13 +115,12 @@
{{ $chartData := printf "%s" $chartPost | printf "%s%s" $chartYearCount | printf "%s%s" $chartMid | printf "%s%s" $chartYearKeys | printf "%s%s" $chartPre | printf "%s" }} {{ $chartData := printf "%s" $chartPost | printf "%s%s" $chartYearCount | printf "%s%s" $chartMid | printf "%s%s" $chartYearKeys | printf "%s%s" $chartPre | printf "%s" }}
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.0.1/dist/chart.umd.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js/dist/chart.min.js" type="text/javascript"></script> <script>
<script type="text/javascript">
var ctx = document.getElementById('yearchart').getContext('2d'); var ctx = document.getElementById('yearchart').getContext('2d');
var options = {{ $chartData | safeJS }}; var options = {{ $chartData | safeJS }};
new Chart(ctx, options); new Chart(ctx, options);
</script> </script>
</div> </div>
</article> </article>
</main> </main>