Public
Edited
Oct 21, 2023
4 forks
31 stars
Insert cell
Insert cell
d3.min([3, 2, 1, 1, 6, 2, 4])
Insert cell
Insert cell
d3.max([3, 2, 1, 1, 6, 2, 4])
Insert cell
d3.extent([3, 2, 1, 1, 6, 2, 4])
Insert cell
Insert cell
d3.minIndex([3, 3, 1, 1])
Insert cell
d3.maxIndex([3, 3, 1, 1])
Insert cell
Insert cell
d3.min(["Driven", "Data", "Documents"])
Insert cell
Insert cell
d3.min("😻😼😾😸😿😺😽🙀😹")
Insert cell
Insert cell
d3.min([new Date(), new Date("2018"), new Date("2011-03-09")])
Insert cell
Insert cell
Math.min(3, 2, 1, NaN, null, undefined, 4) // 🕷
Insert cell
d3.min([3, 2, 1, NaN, null, undefined, 4]) // 👍
Insert cell
Insert cell
d3.min([])
Insert cell
d3.minIndex([NaN, undefined, ,])
Insert cell
Insert cell
d3.min(["2", "3", "10"]) // 🌶
Insert cell
Insert cell
d3.min(["2", "3", "10", "N/A"], s => +s)
Insert cell
Insert cell
{
const strings = ["2", "3", "10", "N/A"];
const numbers = strings.map(s => +s);
return d3.min(numbers);
}
Insert cell
Insert cell
flights = [
{airline: "Icelandair", price: 1621, stops: 3},
{airline: "Multiple airlines", price: 1381, stops: 2},
{airline: "Air France", price: 1948, stops: 0},
{airline: "WestJet", price: 1711, stops: 1},
{airline: "Air France", price: 1951, stops: 1},
{airline: "French Bee", price: 1780, stops: 1}
]
Insert cell
d3.min(flights, d => d.price)
Insert cell
Insert cell
d3.minIndex(flights, d => d.price)
Insert cell
Insert cell
flights[d3.minIndex(flights, d => d.price)]
Insert cell
Insert cell
d3.least(flights, (a, b) => d3.ascending(a.price, b.price))
Insert cell
Insert cell
threshold = 0.6
Insert cell
numbers = Float64Array.from({length: 100}, Math.random)
Insert cell
d3.min(numbers, d => d >= threshold ? d : NaN)
Insert cell
Insert cell
set = new Set([3, 2, 1, 2, 3])
Insert cell
d3.min(set)
Insert cell
Insert cell
d3.minIndex(set)
Insert cell
Insert cell
Insert cell
Insert cell
data = context.getImageData(0, 0, context.canvas.width, context.canvas.height).data
Insert cell
Insert cell
function* asIntensities(data) {
for (let i = 0; i < data.length; i += 4) {
const r = data[i + 0] / 255;
const g = data[i + 1] / 255;
const b = data[i + 2] / 255;
yield r * 0.2989 + g * 0.5870 + b * 0.1140;
}
}
Insert cell
Insert cell
intensities = Float64Array.from(asIntensities(data))
Insert cell
Insert cell
d3.extent(asIntensities(data))
Insert cell
Insert cell
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