Unlisted
Edited
Nov 10
Insert cell
Insert cell
url = "https://cdn.glitch.com/3406f498-ccaa-4592-93d3-c0a3a2e58c43%2Fcars.csv?v=1604907277091"
Insert cell
data = d3.csv(url)
Insert cell
height = 500
Insert cell
xScale = d3.scaleLinear().domain([0, 40000]).range([0, width])
Insert cell
yScale = d3.scaleLinear().domain([0, 70000]).range([height, 0])
Insert cell
yScale(46000)
Insert cell
chart = {
const svg = d3.create("svg").attr("viewBox", [0, 0, width, height]);

const container = svg.append("g");
const selection = container.selectAll("circle").data(data);

selection
.enter()
.append("circle")
.attr("cx", (d) => {
console.log(d);
return xScale(d["Retail Price"]);
})
.attr("cy", (d) => yScale(d["Dealer Cost"]))
.attr("r", 2);

return svg.node();
}
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