owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.35k stars 227 forks source link

🐛 (facets) show axes for no data charts / TAS-552 #3735

Open sophiamersmann opened 1 week ago

sophiamersmann commented 1 week ago

Show axes for charts without data, fixes https://github.com/owid/owid-grapher/issues/2127

Implemented as part of an effort to create a set of climate charts, see draft charts on this staging site

Summary

To do

Screenshots

Before After
Screenshot 2024-06-21 at 15 34 32 Screenshot 2024-06-21 at 15 24 18
Screenshot 2024-06-21 at 15 34 10 Screenshot 2024-06-21 at 15 32 18

👆🏻 Line chart / Bar chart

More screenshots

Having a single zero line looks a bit dumb: Screenshot 2024-06-26 at 13 38 02 Screenshot 2024-06-25 at 18 33 32 The outer axis labels are cut: Screenshot 2024-06-25 at 18 34 15 Well... Screenshot 2024-06-25 at 18 35 37

sophiamersmann commented 1 week ago

[!WARNING] This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiamersmann and the rest of your teammates on Graphite Graphite

owidbot commented 1 week ago
Quick links (staging server): Site Admin Wizard

Login: ssh owid@staging-site-no-data-axes

SVG tester: Number of differences (default views): 96 ([b43fa4](https://github.com/owid/owid-grapher-svgs/commit/b43fa4e5d59afc605cfc44d21a04831ca96fe779)) ❌ Number of differences (all views): 288 ([414fd1](https://github.com/owid/owid-grapher-svgs/commit/414fd16279fea830d449f2b264b0cfeb49ce7fcc)) ❌

Edited: 2024-06-26 11:55:01 UTC Execution time: 1.24 seconds

notion-workspace[bot] commented 1 week ago

Fix facets: Show axes for charts with missing data

marcelgerber commented 2 days ago

Didn't have time for a proper review yet, but one thing comes to mind about this one:

The "No matching data" text is only shown when rendered to HTML; it is never part of a SVG / png. This meant that before this PR, we were only rendering a white block in place of the charting area (which wasn't great). Now, we're rendering a full, but empty, axis, which might be even more misleading.

sophiamersmann commented 2 days ago

Ah, good point. I removed the buttons in this PR, so we could just turn the foreignObject into SVG.