From 15634d68225934e7f9d116acf8e1e9447399031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 1 Jun 2023 22:42:08 +0200 Subject: [PATCH] modernize traffic-horizon with an axis filter --- test/output/trafficHorizon.html | 1346 +++++++++++++++---------------- test/plots/traffic-horizon.ts | 13 +- 2 files changed, 676 insertions(+), 683 deletions(-) diff --git a/test/output/trafficHorizon.html b/test/output/trafficHorizon.html index dc2d132b0f..140b0d80cc 100644 --- a/test/output/trafficHorizon.html +++ b/test/output/trafficHorizon.html @@ -50,1682 +50,1680 @@ white-space: pre; } - - - - - - - - - - - - - - - - - - - Jan 412 AM - 12 PM - Jan 512 AM - 12 PM - Jan 612 AM - 12 PM - Jan 712 AM - 12 PM - Jan 812 AM - 12 PM - Jan 912 AM - 12 PM - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - Von der Heydt + + + + + + + + + + + + + + + + + + 12 PM + Jan 512 AM + 12 PM + Jan 612 AM + 12 PM + Jan 712 AM + 12 PM + Jan 812 AM + 12 PM + Jan 912 AM + 12 PM + + + + + Von der Heydt - - Kirschheck + + Kirschheck - - Saarbrücken-Neuhaus + + Saarbrücken-Neuhaus - - Riegelsberg + + Riegelsberg - - Holz + + Holz - - Göttelborn + + Göttelborn - - Illingen + + Illingen - - AS Eppelborn + + AS Eppelborn - - Hasborn + + Hasborn - - Kastel + + Kastel - - Otzenhausen + + Otzenhausen - - Bierfeld + + Bierfeld - - Nonnweiler + + Nonnweiler - - Hetzerath + + Hetzerath - - Laufeld + + Laufeld - - Nettersheim + + Nettersheim - - Euskirchen/Bliesheim + + Euskirchen/Bliesheim - - Hürth + + Hürth - - Köln-Nord + + Köln-Nord - - Schloss Burg + + Schloss Burg - - Hagen-Vorhalle + + Hagen-Vorhalle - - Hengsen + + Hengsen - - Unna + + Unna - - Ascheberg + + Ascheberg - - Ladbergen + + Ladbergen - - Lotte + + Lotte - - HB-Silbersee + + HB-Silbersee - - HB-Weserbrücke + + HB-Weserbrücke - - HB-Mahndorfer See + + HB-Mahndorfer See - - Groß Ippener + + Groß Ippener - - Uphusen + + Uphusen - - Bockel + + Bockel - - Dibbersen + + Dibbersen - - Glüsingen + + Glüsingen - - Barsbüttel + + Barsbüttel - - Bad Schwartau + + Bad Schwartau - - Oldenburg (Holstein) + + Oldenburg (Holstein) - - Neustadt i. H.-Süd + + Neustadt i. H.-Süd diff --git a/test/plots/traffic-horizon.ts b/test/plots/traffic-horizon.ts index 3b229abad9..c864fb3249 100644 --- a/test/plots/traffic-horizon.ts +++ b/test/plots/traffic-horizon.ts @@ -10,9 +10,7 @@ export async function trafficHorizon() { return Plot.plot({ width: 960, height: 1100, - x: { - axis: "top" - }, + marginLeft: 0, y: { axis: null, domain: [0, step] @@ -30,13 +28,10 @@ export async function trafficHorizon() { axis: null, domain: data.map((d) => d.location) // respect input order }, - facet: { - data, - y: "location" - }, marks: [ - ticks.map((t) => Plot.areaY(data, {x: "date", y: (d) => d.vehicles - t, fill: t, clip: true})), - Plot.text(data, Plot.selectFirst({text: "location", frameAnchor: "left"})) + ticks.map((t) => Plot.areaY(data, {x: "date", y: (d) => d.vehicles - t, fy: "location", fill: t, clip: true})), + Plot.axisX({anchor: "top", filter: (d, i) => i > 0}), // don’t show the first tick + Plot.axisFy({frameAnchor: "left", fill: "currentColor", textStroke: "white", label: null}) ] }); }