owid / owid-grapher

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

Explorers: Indicators are shown more than once in the same chart #3943

Closed lucasrodes closed 2 days ago

lucasrodes commented 1 week ago

Description

For some explorer views, the same indicator (its time-series, legend name, etc) is shown more than once. I think this may only be happening for catalogPath-based explorers.

Expected

Indicators should be shown only once.

Context and Examples

Issue first raised by Bastian (https://github.com/owid/owid-issues/issues/1650#issuecomment-2338126422), then reported on Slack.

Conflict explorer

View image

I also realised that if I switch between views (and keep doing it), the indicators are added again, and again, ...

image

Population & demography explorer

View image

Migration explorer

View image

Steps to reproduce

  1. Go to https://ourworldindata.org/explorers/migration
  2. Switch to 'Chart' view. You'll see indicators repeated for each country.

Optional:

  1. Then select another option from the drop-down menu, e.g. 'International immigrants'
  2. Then select back the initial drop-down option 'International emigrants'. You'll see indicators added a third time for each country.

Environment

For desktop, provide:

danyx23 commented 1 week ago

In this slack conversation, Ike found this source of the bug:

In Explorer.tsx, the partialGrapherConfig for 812749 has 812749 twice in its dimensions. (edited) The duplicate is getting pushed in here: https://github.com/owid/owid-grapher/blob/9c1a2a26de793f46048a7fbfa6f318eac3220f6b/explorer/Explorer.tsx#L593 So one fix would be to not push duplicates from yVariableIdsList into dimensions,

lucasrodes commented 6 days ago

@larsyencken should we consider this fixed?

cc. @ikesau