mirror of
https://github.com/olehomelchenko/olehomelchenko.com.git
synced 2025-12-21 21:22:22 +00:00
add vega-lite embed
This commit is contained in:
9
layouts/shortcodes/vega-lite.html
Normal file
9
layouts/shortcodes/vega-lite.html
Normal 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>
|
||||
Reference in New Issue
Block a user