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

Bug: New entities in explorer-derived charts show up with the same colours

Open saloni-nd opened this issue 11 months ago • 1 comments

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.

Image

Additional context

This came out of the issue: https://github.com/owid/owid-grapher/issues/3617

saloni-nd avatar Apr 28 '25 09:04 saloni-nd

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

sophiamersmann avatar May 07 '25 07:05 sophiamersmann

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.

github-actions[bot] avatar Sep 12 '25 07:09 github-actions[bot]