Public
Edited
Oct 24, 2023
1 fork
16 stars
Insert cell
Insert cell
d3.rank([23, 2, -1, 4])
Insert cell
Insert cell
d3.rank([23, null, 2, undefined, -1, NaN, 4, , 1])
Insert cell
Insert cell
d3.rank([{x: 1}, {}, {x: 2}, {x: 0}], d => d.x)
Insert cell
Insert cell
d3.rank(["aa", "ba", "bc", "bb", "ca"], (a, b) => d3.ascending(a[0], b[0]) || d3.ascending(a[1], b[1])) // [0, 1, 3, 2, 4]
Insert cell
Insert cell
d3.rank(["b", "c", "b", "a"])
Insert cell
Insert cell
d3.rank(["b", "c", "b", "a"], (a, b) => d3.ascending(a, b) || 1)
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