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

StackedArea chart faceted by entity is collapsed when only one year is selected

Open marcelgerber opened this issue 2 years ago • 1 comments

Screenshots

https://user-images.githubusercontent.com/2641501/174830383-fd2002b3-af73-4f88-9c6e-a1b2c1ca6bf3.mp4

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://ourworldindata.org/grapher/population-by-broad-age-group?facet=entity&country=JPN~FRA
  2. Drag the timeline handle such that it shows the single year 2020
  3. => Observe that it only shows a single facet now

Additional context

The culprit lies here: https://github.com/owid/owid-grapher/blob/24baad37b4572cd669ac55b8e1f78bacab7815b5/grapher/core/Grapher.tsx#L1923-L1930

FacetStrategy.entity is only available when there's more than one data point per entity. However, in this case, we have exactly one data point per entity, but are working with a chart type that is not capable of rendering more than one entity into a charting area.

I think we should put more information about a chart type in its chart instance class, maybe even as static fields. This one here could say StackedAreaChart.canRenderMultipleEntities = false.

marcelgerber avatar Jun 21 '22 14:06 marcelgerber

Marking as "nice to have" since it's quite an edge case.

larsyencken avatar Aug 02 '22 10:08 larsyencken

This was fixed by Marcel's work on facetted charts in Autumn

danyx23 avatar Jan 10 '23 12:01 danyx23