-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (stacked bar) align x-axis of facets / TAS-548 (#3726)
Aligns x-axes of faceted StackedBar charts, resolves #2160 Implemented as part of an effort to create a set of climate charts, see draft charts on [this staging site](http://staging-site-stacked-bar/admin/charts) ## Summary - Replaces the StackedBar chart's custom x-axis implementation with `DualAxisComponent` - This works by passing a list of `domainValues` to the axis – it's then the axis' job (i) to figure out how much space is available for a single domain value (called the `bandWidth`) and (ii) to adjust the scale in such a way that we have sufficient padding on both sides for the outer bars to fit - We also pass custom x-ticks to the axis, based on the actual x-values in the chart - The `domainValues` and the `ticks` are shared across all facets, so that we end up with the same x-axis for all facets ## Screenshots | Before | After | | ------- | ------ | | <img width="965" alt="Screenshot 2024-06-21 at 17 30 05" src="https://github.com/owid/owid-grapher/assets/12461810/1c231224-f4c2-483d-9e73-24054cafe4c6"> | <img width="965" alt="Screenshot 2024-06-21 at 17 30 40" src="https://github.com/owid/owid-grapher/assets/12461810/560274d0-c784-475f-b8c3-37b565e184a8"> | Link: http://staging-site-stacked-bar-dual-axis/grapher/natural-disasters-by-type?facet=entity&uniformYAxis=0&country=Wildfire~Glacial+lake+outburst+flood~Dry+mass+movement~Extreme+temperature
- Loading branch information
1 parent
6cafe62
commit 0800199
Showing
7 changed files
with
165 additions
and
184 deletions.
There are no files selected for viewing
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 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 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 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 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
Oops, something went wrong.