Public
Edited
May 9, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
colorLegend = function() {
return legend({
color: aircraftScale,
title: "Aircraft route replacement",
width: width
})
}
Insert cell
Insert cell
aircraft = Array.from(new Set(test_flights.map(row => row["electric_aircraft"]))).sort();
Insert cell
colors = /* Array */ ["#ff595e","#ffca3a","#8ac926","#1982c4","#6a4c93"]
Insert cell
aircraftScale = d3.scaleOrdinal(aircraft, colors);
Insert cell
volumeRange = d3.extent(test_flights.map(row => parseInt(row["volume"])));
Insert cell
linkWidth = d3.scaleLinear(volumeRange, strokewidthRange);
Insert cell
Insert cell
widthBase = "volume"
Insert cell
dep_lat = "dep_lat"
Insert cell
dep_lng = "dep_lng"
Insert cell
arr_lat = "arr_lat"
Insert cell
arr_lng = "arr_lng"
Insert cell
test_flights = FileAttachment("forecast-aircraft-replacement.csv").csv()
Insert cell
sorted_flights = test_flights.sort(function(a, b){return parseInt(b["volume"]) - parseInt(a["volume"])});
Insert cell
Insert cell
import {legend, swatches} from "@d3/color-legend"
Insert cell
import {rangeSlider} from '@mootari/range-slider'
Insert cell
import {worldMap, mapPath, mapProjection, activeColorScheme} from "b3a0a78984d6df2e"
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