-
-
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
🔨 add empty arrays to the default grapher config #4294
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Dec 12, 2024
This was referenced Dec 12, 2024
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 1357 (61b200) ❌ Edited: 2024-12-17 16:16:29 UTC |
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 13, 2024 13:15
8500f7a
to
741a4d2
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 13, 2024 13:15
542d063
to
71cbc47
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 13, 2024 13:20
741a4d2
to
27ae90b
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 13, 2024 13:20
71cbc47
to
3e1e8fe
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 13, 2024 14:01
27ae90b
to
19101b4
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 13, 2024 14:02
3e1e8fe
to
8906031
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 13, 2024 14:29
19101b4
to
98b1288
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
2 times, most recently
from
December 13, 2024 15:13
19e9eeb
to
3cd081f
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 13, 2024 15:21
3cd081f
to
2dfcaae
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 16, 2024 10:05
98b1288
to
c5cd96a
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 16, 2024 10:05
2dfcaae
to
dca509b
Compare
This was referenced Dec 16, 2024
marcelgerber
approved these changes
Dec 16, 2024
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.
Nice! 🙌
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 17, 2024 10:31
c5cd96a
to
ca90be4
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 17, 2024 10:31
dca509b
to
684cf54
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 17, 2024 15:33
ca90be4
to
f02e646
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 17, 2024 15:34
684cf54
to
a1f8570
Compare
sophiamersmann
force-pushed
the
slope-figma-viz
branch
from
December 17, 2024 15:57
f02e646
to
20ab21a
Compare
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 17, 2024 15:57
a1f8570
to
7db7446
Compare
sophiamersmann
added a commit
that referenced
this pull request
Dec 17, 2024
Adds the option to highlight lines in line and slope charts ### Summary - Adds a new config field, `focusedSeriesNames` (suggestions for a different name welcome) - A line is identified by its series name which is either an entity name, a column display name or a combination of both - The list of focused series names is persisted to the URL as `focus` query param - The entity name utility functions are used to parse and serialise focused series names, so that the same delimiter is used and entity names are mapped to their codes if possible - This breaks if a column name contains `~` (the delimiter) which theoretically is possible but I don't think we need to worry about that now - Focused lines have bold labels, non-focused lines are grayed out - Grapher makes an effort to prevent the chart to enter a 'bad state' where all lines are grayed out because the focused line doesn't exist - This includes removing all elements from the focus array when the facet strategy changes and dismissing focused entities when they're unselected #### In the admin - There is a new 'Data to highlight' section below the entity selection section - If the chart is in a bad state because one of the focused series names is invalid, saving is disabled and shows an error message ### Follow up - It's a bit ugly that `selectedEntityNames` and `focusedSeriesNames` are always serialised, even for an empty Grapher. I've fixes that in a [follow-up PR](#4294) - The line legend method that drops labels if there are to many is a bit difficult to read. I'll open another PR with a refactor
sophiamersmann
changed the base branch from
slope-figma-viz
to
graphite-base/4294
December 17, 2024 16:27
sophiamersmann
force-pushed
the
default-config-empty-arrays-viz
branch
from
December 17, 2024 16:31
7db7446
to
4d090e0
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Empty arrays are not currently included in Grapher's default config object that is derived from the schema. That's a bit of a foot gun, so I added them now.
For context: When I implemented inheritance, I decided to keep empty arrays out of the default config since all defaults ended up in the
fullConfig
of each chart and that would have been unnecessarily verbose. But now that we're not doing that anymore, I can't think of a downside of also including the default values for arrays.This has two nice effects:
selectedEntityNames
was always serialised, even for an empty Grapher:owid-grapher/packages/@ourworldindata/grapher/src/core/Grapher.jsdom.test.ts
Lines 92 to 98 in 28ba2e4