Bug: New entities in explorer-derived charts show up with the same colours
Core problem
Charts from explorers only support adding entities, not changing entities. This means that stacked charts look odd because countries can be stacked on top of World. Also, the added entities are sometimes the same colour as World, which makes the graph confusing.
Proposed solution
Make sure that the colours of new entities are distinct.
Context
In Hannah's article, the grapher chart:
If I add more countries, they get stacked on top of World, and sometimes show up with the same colour.
Additional context
This came out of the issue: https://github.com/owid/owid-grapher/issues/3617
Reproduction steps:
- Go to https://ourworldindata.org/explorers/natural-disasters
- Note that 'World' is blue
- Select 'Europe', note that it's red
- Deselect 'Europe'
- Select 'Germany', note that it's blue (same as 'World')
This happens because stacked bar charts pick a subset of colors based on the number of available entities:
- Only 'World' is selected -> One color picked, assigned to World
- Add 'Europe' to the selection -> Two colors picked, one available, assigned to Europe
- Remove 'Europe' and add 'Germany' -> Two colors pickes, none available, first color re-assigned to Germany
This issue has had no activity within 4 months. It is considered stale and will be closed in 30 days unless it is worked on or tagged as pinned.