Published
Edited
Oct 1, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pie(sums).render()
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
pie = arr => {
const data = arr;
const color = d3.scaleSequential(d3.interpolateSpectral).domain([0, data.length-1]);
const colors = {
domain: data.map(d => d.message),
range: data.map((i, j) => color(j))
};

return vl.markArc({outerRadius: 250})
.data(data)
.encode(
vl.tooltip().fieldN('message').fieldQ('value'),
vl.theta().fieldQ('value').stack(true).scale({range: [0.75 * Math.PI, 2.75 * Math.PI]}),
vl.color().fieldN('message').title('Error').scale(colors).legend({orient: 'right'}),
)
.config({view: {stroke: null}})
.width(500)
.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