add vega-lite embed

This commit is contained in:
Oleh Omelchenko
2024-07-26 03:00:09 +03:00
parent c2500516cb
commit c411fded70
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<!-- Create a unique ID for the div where the Vega-Lite visualization will be rendered -->
<div class="vegaVis" id="{{ .Get "id" | default "vega-lite-vis" }}"></div>
<script>
const spec = {{ .Inner | safeJS }};
spec['width'] = {{ .Get "width" | default 700}};
spec['height'] = {{ .Get "height" | default 300}};
vegaEmbed('#{{ .Get "id" | default "vega-lite-vis" }}', spec, {"actions": false}).catch(console.error);
</script>