btn=p5(s => {
let width=600,height=400
s.setup = function() {
s.createCanvas(width, height);
s.fill('#DC3F74');
let button=s.createButton('press')
button.mousePressed(drawPoints)
};
function drawPoints() {
s.fill('#DC3F74');
let margin={left:30,right:30,top:30,bottom:30}
let data=[{x:1,y:8},{x:2,y:3},{x:3,y:2},{x:4,y:6},{x:5,y:7}]
let X=d3.scaleLinear().domain(d3.extent(data,d=>d.x)).range([0,width*0.9/2])
let Y=d3.scaleLinear().domain(d3.extent(data,d=>d.y)).range([height*0.9/2,0])
data.forEach(d=>{
s.rect(margin.left+X(d.x),margin.top+Y(d.y),30,height/2-Y(d.y))
s.text(d.y,margin.left+X(d.x)+10,margin.top+Y(d.y)-10)
})
}
})