Published
Edited
Oct 4, 2020
1 fork
Insert cell
Insert cell
Insert cell
chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height])
.attr("stroke-width", 1.5)
svg.append("rect")
.attr("width", "100%")
.attr("height", "100%")
.attr("fill", "#343C34");//"#54A12D");
const team_colours = ['#2E8B57','white','white','white','white','white','white','white','white','white','white']
svg.selectAll("line")
.data(pitchmarkings)
.join("line")
.attr("x1", d => d.x1)
.attr("x2", d => d.x2)
.attr("y1", d => d.y1)
.attr("y2", d => d.y2)
.attr("stroke", "white")
.attr("stroke-width", 4);

svg.selectAll("circle")
.data(spursPlod)
.join("circle")
.attr("cx", d => x(d.x))
.attr("cy", d => y(d.y))
.attr("r", (d, i) => size(d.touches))
.attr("fill", (d, i) => color(d.rating))
.attr("stroke", "black");
const text = svg.selectAll(".axis")
.data(spursPlod)
.enter()
.append("g")
.attr("class", "text")
.append("text")
.style("font-size", "26px")
.style("font-weight", 700)
.attr("text-anchor", "middle")
.attr("font-family", "monospace")
.attr("dy", "0.35em")
.attr("x", (d) => x(d.x))
.attr("y", (d) => y(d.y))
.text(d => d.n);
return svg.node();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stats = matchStats.playerTableStats
Insert cell
matchStats = d3.json('https://gist.githubusercontent.com/theojolliffe/c56d2ab35dba0207aef3ae08c32dc3b4/raw/eae6823fa45c62e1309acd7356ab5e10ba6f3170/PlovdivMatchStats')
Insert cell
Insert cell
Insert cell
Insert cell
height = 670
Insert cell
width = 1060
Insert cell
d3 = require("d3@5")
Insert cell
Insert cell
import {legend} from "@d3/color-legend"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more