owid / owid-grapher

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

Missing data strategy in stacked discrete bar charts doesn't work #2836

Closed pabloarosado closed 11 months ago

pabloarosado commented 11 months ago

Description

Missing data strategy in stacked discrete bar charts doesn't work.

Expected behaviour

Stacked area charts (e.g. this chart, if you remove the imposed timeline min of 1985) will show or hide data depending on the "missing data strategy". For example, for Japan, if the strategy is set to "hide entities with missing data", the timeline starts in 1985 (year from which there is no more missing data). And, if the strategy is set to "show entities with missing data", the timeline goes back to 1965, for which some indicators have nans.

Shouldn't the same behaviour be expected for stacked discrete bar charts (e.g. this chart, again, removing the imposed timeline min of 1985)?

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to this URL: https://owid.cloud/admin/charts/5366/edit
  2. Go to the Customize tab, and empty the "Timeline min" field.
  3. Select, e.g. only "Japan". You'll see that, before 1985, they used no fossil fuels (simply because fossil fuel data starts in 1985).
  4. Change the missing data strategy, and see that nothing changes. But, when choosing "hide entities with missing data", one would expect the timeline to start in 1985 instead of 1965.

Additional context

Currently this chart shows that Algeria in 2021 uses almost 100% fossil fuels, and, in 2022, 100% renewable energy. We should fix this as soon as possible. And, if it's tricky, I'll create new variables to avoid this issue.

sophiamersmann commented 11 months ago

"Resolved" by disabling the Missing Data Strategy option for DiscreteBar charts and StackedDiscreteBar charts (https://github.com/owid/owid-grapher/pull/2837)