-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Default Plotly map colors #1721
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c2613f4
Added plotly map colors
bmingles 812c280
Snapshots
bmingles b07cdc4
Sorted unused vars
bmingles 05e6f39
Removed unused chart colors
bmingles 4137cb4
Fixed scroll + Snapshot tests
bmingles b511d20
Renamed css vars
bmingles 6658266
Added jsdoc and removed commented out code
bmingles cc7ea06
Updated snapshots
bmingles c26ea7b
Merge branch 'main' into 101-default-map-colors
bmingles c21e9fe
Fixed tests
bmingles 2c9b2a8
Set geo bgcolor
bmingles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1877,27 +1877,48 @@ class ChartUtils { | |
| return axis; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a plotly layout object based on a given theme. | ||
| * See https://plotly.com/javascript/reference/layout/ | ||
| * @param theme The theme to use for the layout | ||
| */ | ||
| makeDefaultLayout(theme: ChartTheme): Partial<Layout> { | ||
| const { dh } = this; | ||
|
|
||
| const { | ||
| /* Used as top level properties of `Layout` */ | ||
| /* eslint-disable camelcase */ | ||
| paper_bgcolor, | ||
| plot_bgcolor, | ||
| title_color, | ||
| coastline_color, | ||
| land_color, | ||
| ocean_color, | ||
| lake_color, | ||
| river_color, | ||
| /* eslint-disable camelcase */ | ||
| } = theme; | ||
|
|
||
| const layout: Partial<Layout> = { | ||
| ...theme, | ||
| paper_bgcolor, | ||
| plot_bgcolor, | ||
| autosize: true, | ||
| colorway: ChartUtils.getColorwayFromTheme(theme), | ||
| font: { | ||
| family: "'Fira Sans', sans-serif", | ||
| color: theme.title_color, | ||
| color: title_color, | ||
| }, | ||
| title: { | ||
| font: { | ||
| color: theme.title_color, | ||
| color: title_color, | ||
| }, | ||
| yanchor: 'top', | ||
| pad: { ...ChartUtils.DEFAULT_TITLE_PADDING }, | ||
| y: 1, | ||
| }, | ||
| legend: { | ||
| font: { | ||
| color: theme.title_color, | ||
| color: title_color, | ||
| }, | ||
| }, | ||
| margin: { ...ChartUtils.DEFAULT_MARGIN }, | ||
|
|
@@ -1913,8 +1934,23 @@ class ChartUtils { | |
| yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme), | ||
| zaxis: this.makeLayoutAxis(dh.plot.AxisType.Z, theme), | ||
| }, | ||
| geo: { | ||
| showcoastlines: true, | ||
|
Comment on lines
+1937
to
+1938
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add |
||
| showframe: false, | ||
| showland: true, | ||
| showocean: true, | ||
| showlakes: true, | ||
| showrivers: true, | ||
| bgcolor: paper_bgcolor, | ||
| coastlinecolor: coastline_color, | ||
| landcolor: land_color, | ||
| oceancolor: ocean_color, | ||
| lakecolor: lake_color, | ||
| rivercolor: river_color, | ||
| }, | ||
| }; | ||
| layout.datarevision = 0; | ||
|
|
||
| return layout; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Binary file modified
BIN
+6 Bytes
(100%)
tests/styleguide.spec.ts-snapshots/chart-colors-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.32 KB
(99%)
tests/styleguide.spec.ts-snapshots/chart-colors-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+185 Bytes
(100%)
tests/styleguide.spec.ts-snapshots/chart-colors-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.84 KB
(100%)
tests/styleguide.spec.ts-snapshots/charts-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-392 Bytes
(100%)
tests/styleguide.spec.ts-snapshots/charts-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Uh oh!
There was an error while loading. Please reload this page.