<script src='https://d3js.org/d3.v6.min.js'></script> was added in the page head.
xxxxxxxxxx
%%html
<style>
import 'https://fonts.googleapis.com/css?family=Wallpoet';
#d3barchart_title {color:silver;
font-family:Wallpoet; font-size:20px}
#d3barchart {width:98%; height:30%;}
</style>
<div id='d3barchart'><text id='d3barchart_title'></text></div>
xxxxxxxxxx
%%javascript
var data=[4,12,21,28,7,15];
var tc=setInterval(function(){
var now=new Date().getTime();
var width=.7*Math.max(window.screen.width,window.innerWidth);
var div=d3.select('#d3barchart');
div.select('#d3barchart_title')
.text('An Example of D3 Bar Charts');
div.style('text-align','right')
.style('text-shadow','3px 3px 3px slategray')
.style('padding','5px')
.style('color',d3.interpolateSinebow(now/1000000))
.style('background',d3.interpolateSinebow(now/1000000));
var x=d3.scaleLinear().domain([0,d3.max(data)])
.range([0,.6*width])
div.selectAll('div').data(data).join('div')
.style('background','silver')
.style('padding','5px').style('margin','1px')
.style('width',d=>x(d)+'px')
.style('font-family','Wallpoet')
.style('font-size','20px')
.text(d=>d);},100);