owid / owid-grapher

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

Add tolerance to stacked area charts #2861

Open pabloarosado opened 1 year ago

pabloarosado commented 1 year ago

Description

Setting the tolerance of an indicator in a stacked area chart doesn't work.

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to this URL https://owid.cloud/admin/charts/4316/edit
  2. On the "Basic" tab, click on "Add indicators", select "Electricity from fossil fuels (TWh)" and "Electricity from renewables (TWh)" and unselect all other indicators.
  3. On the "Data" tab, select Algeria, and select "Show entities with missing data".
  4. Go back to the "Basic" tab, and play around with the tolerance of the fossil fuels indicator. For 2022 there's no data on fossil fuels, so a tolerance of simply 1 year should fill that data point, but it does not.

Screenshots

Screen Shot 2023-10-26 at 12 43 05

Additional context

For more context and examples, see https://github.com/owid/owid-issues/issues/1257

danyx23 commented 8 months ago

Adding tolerance and communicating the fact that data is interpolated in the tooltip would be a good first step. If this comes up more often it might also make sense draw areas in relative stacked charts that have missing data in a different shade or otherwise distinguish them.

danyx23 commented 1 month ago

@pabloarosado do we have more live examples where this would be helpful? We're considering this for the next batch cycle and then it would be very useful to be able to look at several examples at once. Thanks!

pabloarosado commented 1 month ago

Hi @danyx23, thanks for looking into this. Another example would be another stacked area chart in the same dataset, namely on electricity production by source. For this one, and the chart in the issue description, I created indicators that are filled up with zeros to avoid issues on stacked area charts.

So, if you want to experience with tolerance, you can take any of those two charts, and replace the indicators whose names end in (adapted for visualization of chart ***slug***) by the analogous indicators without that title ending.