{
const zip = (arr1, arr2) => arr1.map((k, i) => [k, arr2[i]])
const ArrayofX = Array(25).fill().map(() => Math.round(Math.random() * 500))
const ArrayofY = Array(25).fill().map(() => Math.round(Math.random() * 300))
const dataset = zip(ArrayofX,ArrayofY)
const width = 500
const height = 300
const padding = 20
const svg = d3.select(DOM.svg(width, height))
const margin = { left: 40, top: 20, right: 10, bottom: 40 }
const xScale = d3.scaleLinear()
.domain(d3.extent(ArrayofX))
.range([margin.left, width - margin.right])
svg.append('g')
.call(d3.axisBottom(xScale))
.attr('transform', `translate(0,${height - margin.bottom})`)
const yScale = d3.scaleLinear()
.range([height - margin.bottom, margin.top])
.domain(d3.extent(ArrayofY))
svg.append('g')
.call(d3.axisLeft(yScale))
.attr('transform', `translate(${margin.left},0)`)
svg.selectAll('circle')
.data(dataset)
.enter()
.append('circle')
.attr("cx", function(d) {
return xScale(d[0]);
})
.attr("cy", function(d) {
return yScale(d[1]);
})
.attr("r", function(d) {
return (Math.cbrt(d[1]));
})
.attr('fill', 'purple')
svg.append("text")
.attr("text-anchor", "middle")
.attr("transform", "translate("+ (width/2) +","+(height-padding/2)+")")
.attr('font-size', 12)
.attr('fill', 'steelblue')
.text("Random X Value")
svg.append("text")
.attr("text-anchor", "middle")
.attr("transform", "translate("+ (padding/2) +","+(height/2)+")rotate(-90)")
.attr('font-size', 12)
.attr('fill', 'steelblue')
.text("Random Y Value")
svg.append("text")
.attr("text-anchor", "middle")
.attr("transform", "translate("+ (width/2) +","+(padding/2)+")")
.attr('font-size', 14)
.text("Random Scatter Plot")
return svg.node()
}