chart.html 478 B

1234567891011121314151617
  1. {{ $json := printf "./%s.json" (.Get "data") }}
  2. {{ $id := delimit (shuffle (seq 1 9)) "" }}
  3. <div id="chart-{{$id}}" class="chart"></div>
  4. <script>
  5. (function() {
  6. let a = setInterval( function() {
  7. if ( typeof window.Plotly === 'undefined' ) {
  8. return;
  9. }
  10. clearInterval( a );
  11. Plotly.d3.json({{$json}}, function(chart) {
  12. Plotly.plot('chart-{{$id}}', chart.data, chart.layout, {responsive: true});
  13. });
  14. }, 500 );
  15. })();
  16. </script>