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

We need a "Missing data strategy" in stacked discrete bar charts

Open pabloarosado opened this issue 1 year ago • 2 comments

Core problem

We need to handle missing data in stacked discrete bar charts. Currently, the default behaviour is to treat missing data as zeros, but this causes lots of unacceptable chart views.

For example, Per capita energy from fossil fuels, nuclear and renewables chart shows that Norway and Sweden were 100% renewable in 1965. This happens simply because there is no data for fossil fuels until several years later. per-capita-energy-source-stacked

Proposed solution

  • The "Missing data strategy" option should be available for stacked discrete bar charts.
  • Additionally, the default choice would be to hide entities with missing data.
    • This is the safest option, but we would need to see how this default would affect existing charts.

Context

For more context and several examples of unacceptable chart views: see https://github.com/owid/owid-issues/issues/1257

pabloarosado avatar Oct 26 '23 10:10 pabloarosado

@pabloarosado could you outline a bit more what you mean with missing data strategy? What should be the conditions to hide which kinds of data?

danyx23 avatar Jan 25 '24 15:01 danyx23

Hi @danyx23, what I meant is that, while for stacked area charts we have a missing data strategy dropdown menu (e.g. this chart) Screenshot 2024-01-26 at 10 33 16 for stacked discrete bar charts (e.g. this chart) we don't have that menu.

Currently, in stacked discrete bar charts, nans are treated like zeros (which would be the expected behavior if you chose "Show entities with missing data"). However, you may not want that and would prefer to hide entities if they have nans.

pabloarosado avatar Jan 26 '24 09:01 pabloarosado