Published
Edited
Sep 15, 2020
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
x = d3.scaleLinear()
.domain([0, d3.max(data, d => d.visits[1])])
.range([params.margin.left, params.svg.width - params.margin.right]);
Insert cell
y = d3.scalePoint()
.domain(data.map(d => d.name))
.rangeRound([params.margin.top, params.svg.height - params.margin.bottom - params.margin.top])
Insert cell
typographyStyles = html`<style>
@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');

text {
fill: #282541;
font: 400 12px/1.4 'Varela Round', sans-serif;
}
`
Insert cell
mutable params = {
let output = {};
output["svg"] = {
"width": 954,
"height": 820
};
output["margin"] = {
"top": 64,
"right": 24,
"bottom": 96,
"left": 96
};

output["plot"] = {
"x": output["margin"]["left"],
"y": output["margin"]["top"],
"width": output["svg"]["width"] - output["margin"]["left"] - output["margin"]["right"],
"height": output["svg"]["height"] - output["margin"]["top"] - output["margin"]["bottom"]
};

return output;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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