Published
Edited
Sep 17, 2020
Insert cell
Insert cell
Insert cell
Insert cell
points = {
let result = []
lines.forEach(element => {
let pair = element.split(/\s+/);
result.push(pair.map(Number))
})
return result
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
svg = {
let height = width/4;
let radius = 5;
const dsvg = DOM.svg(width, height);
d3.select(dsvg)
.selectAll("circle")
.data(sorted)
.join("circle")
.attr("r", radius)
.attr("fill", "darkblue")
.attr("cx", d => d[0])
.attr("cy", d => height-d[1])
// Draw Axis
d3.select(dsvg)
.append("g")
.call(d3.axisBottom(xScale))
return dsvg;
}
Insert cell
xMax = d3.max(sorted, v => v[0])
Insert cell
xScale = d3.scaleLinear().domain([0, xMax+50]).range([0, width-10])
Insert cell
xScale(800)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more