owid / owid-grapher

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

Hide single-entity legends when appropriate #2594

Closed sophiamersmann closed 5 months ago

sophiamersmann commented 1 year ago

Core problem

No need to show a legend if we're looking at single-entity charts and the entity is mentioned in the title.

yields-of-important-staple-crops(1)

Link: https://ourworldindata.org/grapher/yields-of-important-staple-crops?tab=chart&facet=metric&uniformYAxis=0&country=~OWID_WRL

annual-reported-ai-incidents-controversies

Link: https://ourworldindata.org/grapher/annual-reported-ai-incidents-controversies

Context

Requested by Max on Slack Also mentioned by Charlie on Slack

sophiamersmann commented 10 months ago

Mentioned by Saloni. Example chart:

image

sophiamersmann commented 9 months ago

Another example reported in #2961: https://ourworldindata.org/grapher/per-capita-co2-region (go to the admin, remove color variable, then you'll see a single-item legend)