owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

Stacked area chart offers entities for selection that have no data

Open marcelgerber opened this issue 10 months ago • 1 comments

Description

We now have MissingDataStrategy, which can remove entities from selection if some series are missing. However, we still have cases where entities are being shown that have no data at all.

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://ourworldindata.org/grapher/energy-consumption-by-source-and-country
  2. Select "Low-income countries"
  3. You'll see "No matching data"

Screenshots

CleanShot 2024-04-16 at 09 50 50

Additional context

tableForSelection should filter out entities that have no data for any entity.

marcelgerber avatar Apr 16 '24 07:04 marcelgerber

Ahh, this is actually quite interesting.

If relative mode is disabled, there is actually some data available for "Low-income countries" - albeit not very useful (it's just "Nuclear: 0 kWh"). But then in relative mode, because the Total is 0, toPercentageFromEachColumnForEachEntityAndTime will set all columns to a DivideByZeroError, making it so there is no data that can be plotted.

marcelgerber avatar Apr 19 '24 08:04 marcelgerber