Published
Edited
Nov 2, 2021
Insert cell
Insert cell
symbols = directions.map(getSymbolFromIndex)
Insert cell
directions = d3.range(0, 370, 15)
Insert cell
getSymbolFromIndex = (degree) => {
const index = Math.round((degree % degreesTotal) / symbolRange);
return data[index] ? data[index].symbol : undefined;
}
Insert cell
symbolRange = degreesTotal / data.length
Insert cell
degreesTotal = 360
Insert cell
dataBySymbol = new Map(data.map(({ symbol, ...rest }) => [symbol, rest]))
Insert cell
data = {
const data = d3.csvParse(csv);

data.forEach((d) => {
const { range } = d;
const [min, max] = range.split("-");
d.min = +min;
d.max = +max;
delete d.range;
});

data.columns = data.columns.slice(0, 2).concat(["min", "max"]);

return data;
}
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