Published
Edited
May 10, 2022
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart3 = LineChart(new Map([...graph_datax, ...graph_datay]), {
x: d => (new Date(d[1].date) > new Date("2020-03-24")) ? new Date(d[1].date) : undefined,
y: d => d[1].percent,
z: d => d[1].station ? d[1].station : d[1].line + " Line Stations",
yLabel: "Which Stations Are Bouncing Back? % Traffic Compared to Pre-Pandemic",
height: 500,
width: 1000,
color: d=> diffsfilteredx.find(x => x.station == d) ? "orange" : "steelblue",
yDomain: [0, 200],
xDomain: [new Date("2020-03-20"), new Date("2022-05-14")]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stationList = final_diffs.filter(function(v) { return v.station})
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
percentiles = [
{name: "Top 2% Busiest Stations", range:[d3.quantile(bussiness,0.98),d3.quantile(bussiness,1),d3.quantile(changes,0), d3.quantile(changes,1)]},
{name: "Bottom 2% Least Busy Stations", range: [d3.quantile(bussiness,0) ,d3.quantile(bussiness,0.02),d3.quantile(changes,0), d3.quantile(changes,1)]},
{name: "Top 2% Most Recovered Stations", range: [d3.quantile(bussiness,0) ,d3.quantile(bussiness,1),d3.quantile(changes,0.98), d3.quantile(changes,1)]},
{name: "Bottom 2% Least Recovered Stations", range: [d3.quantile(bussiness,0) ,d3.quantile(bussiness,1),d3.quantile(changes,0), d3.quantile(changes,0.02)]},
{name: "All Lines", range: [d3.quantile(bussiness,0) ,d3.quantile(bussiness,1),d3.quantile(changes,0), d3.quantile(changes,1)]}
]
Insert cell
diffsfilteredx=final_diffs.filter(function(v) { return v.total >= percentilex.range[0] && v.total <= percentilex.range[1] && v.percent >= percentilex.range[2] && v.percent <= percentilex.range[3]})
Insert cell
diffsfilteredy=final_diffs_blue.filter(function(v) { return v.total >= percentiley.range[0] && v.total <= percentiley.range[1] && v.percent >= percentiley.range[2] && v.percent <= percentiley.range[3]})
Insert cell
graph_datax=new Map([...graph_data].filter(([a, b])=> diffsfilteredx.find(x => x.station == b.station)))
Insert cell
graph_datay=new Map([...graph_data].filter(([a, b])=> diffsfilteredy.find(x => x.station == b.station)))
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