mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 03:00:50 +02:00
fix: links
This commit is contained in:
parent
f9b227c335
commit
9b2e271c7c
830 changed files with 4612 additions and 1131 deletions
35
modules/blox-tailwind/layouts/shortcodes/chart.html
Normal file
35
modules/blox-tailwind/layouts/shortcodes/chart.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
{{/*
|
||||
Docs: https://hugoblox.com/docs/content/writing-markdown-latex/#charts
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data :
|
||||
Plotly JSON file name (without ".json" extension, since it is appended automatically to the name).
|
||||
Expects the JSON file to be placed in the page folder.(.Get "data")
|
||||
*/}}
|
||||
|
||||
{{ $json := printf "./%s.json" (.Get "data") }}
|
||||
{{ $id := delimit (shuffle (seq 1 9)) "" }}
|
||||
<div id="chart-{{$id}}" class="chart"></div>
|
||||
<script>
|
||||
async function fetchChartJSON() {
|
||||
console.debug('Wowchemy fetching chart JSON...')
|
||||
const response = await fetch('{{$json}}');
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
(function() {
|
||||
let a = setInterval( function() {
|
||||
if ( typeof window.Plotly === 'undefined' ) {
|
||||
console.debug('Plotly not loaded yet...')
|
||||
return;
|
||||
}
|
||||
clearInterval( a );
|
||||
|
||||
fetchChartJSON().then(chart => {
|
||||
console.debug('Plotting chart...')
|
||||
window.Plotly.newPlot('chart-{{$id}}', chart.data, chart.layout, {responsive: true});
|
||||
});
|
||||
}, 500 );
|
||||
})();
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue