Published
Edited
Dec 13, 2019
1 fork
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
size = 50;
Insert cell
ladMap = d3.csvParse(await FileAttachment('lad_map.csv').text())
Insert cell
Insert cell
partyColors = [
{color: "#0087DC", name: "Con"},
{color: "#DC241f", name: "Lab"},
{color: "#FAA61A", name: "LD"},
{color: "#c3b203", name: "SNP"},
{color: "#D46A4C", name: "DUP"},
{color: "#6AB023", name: "Green"},
{color: "#008142", name: "PC"},
{color: "#326760", name: "SF"}
]
Insert cell
jsonData = await FileAttachment('2015-results.json').json()
Insert cell
Insert cell
Insert cell
d3 = require("d3@5")
Insert cell
line = d3.line()
.x(d => x(d.year))
.y(d => y(d.val));
Insert cell
x = d3.scaleLinear()
.domain([15, 17])
.range([0, size - 5]);
Insert cell
y = d3.scaleLinear()
.domain([0, 1])
.range([size - 5, 0]);
Insert cell
height = 500
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