-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 fix duplicate indicators in indicator-based explorers #3944
Conversation
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2024-09-09 19:34:55 UTC |
Thanks Ike! I was checking and found some views where the color for different indicators was the same. Also, when hovering over one of these, multiple indicators are highlighted. It looks to me as this doesn't happen when freshly loading a view, but when changing the selection in the drop-down options. I found this behavior in ExamplesExample 1
Example 2
|
I just compared this site version, with one prior to #3793, and it looks like the coloring issue I explained above was there already. Bastian also mentioned that this coloring issue had happened in the past (slack). Since there are multiple explorers live affected by this issue (Conflict Data Explorer, Conflict Data Source Data Explorer, Population and demography Explorer, Migration Explorer, COVID Explorer) I suggest we merge this and we can open a separate issue for the color issue. cc @danyx23 |
explorer/Explorer.tsx
Outdated
// Filter out variableIds that are already present in the dimensions array | ||
.filter( | ||
(yVariableId) => | ||
!dimensions.some((d) => d.variableId === yVariableId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!dimensions.some((d) => d.variableId === yVariableId) | |
!dimensions.some((d) => d.variableId === yVariableId && d.property === DimensionProperty.y) |
Some scatters have the same variable as x and y dimensions, so maybe it's worth being more defensive and only filtering out y duplicates at this spot?
03f4f77
to
0a1544a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for the fix, Ike!
I'll merge this since it leads to errors on today's data insight follow-up link |
A naive potential fix for #3943
I don't understand the Explorer data model well enough to know why
explorerProgram.grapherConfig
has theyVariableIds
that it does - but it seems this line of code that inserts extra variables into the grapher config to get it to load the indicator data and metadata was assuming there'd be no duplicates.There's almost certainly a better upstream fix for this, but this can fix the issue in the meantime until someone who understands explorers better can work things out.