owid-grapher
owid-grapher copied to clipboard
StackedArea chart faceted by entity is collapsed when only one year is selected
Screenshots
https://user-images.githubusercontent.com/2641501/174830383-fd2002b3-af73-4f88-9c6e-a1b2c1ca6bf3.mp4
Steps to reproduce
Steps to reproduce the behavior:
- Go to https://ourworldindata.org/grapher/population-by-broad-age-group?facet=entity&country=JPN~FRA
- Drag the timeline handle such that it shows the single year 2020
- => 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
.
Marking as "nice to have" since it's quite an edge case.
This was fixed by Marcel's work on facetted charts in Autumn