-
Notifications
You must be signed in to change notification settings - Fork 121
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
feat(heatmap): dark mode with theme controls #1406
Conversation
adds dark mode to goal charts with configurable theme styles. BREAKING CHANGE: The `HeatmapSpec.config` prop is removed. All properties have been moved/renamed under new `Theme.heatmap` options with the following exceptions: - `HeatmapSpec.margin` was not used, `Theme.chartMargins` should be used in the future. - `HeatmapSpec.fontFamily` `HeatmapSpec.width` and `HeatmapSpec.height` all removed as they were never used.
packages/charts/src/chart_types/heatmap/state/selectors/get_x_axis_right_overflow.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/heatmap/state/selectors/is_brush_available.ts
Outdated
Show resolved
Hide resolved
packages/charts/src/chart_types/heatmap/state/selectors/on_brush_end_caller.ts
Show resolved
Hide resolved
heatmap: { | ||
maxRowHeight: 30, | ||
maxColumnWidth: 30, | ||
brushArea: { | ||
visible: true, | ||
stroke: '#D3DAE6', // euiColorLightShade, |
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.
At some point in the future, the longwinded theme object ladders could be farmed out so they're external to src
. Their types are already public for external themeability. Worth trying to place them outside src
to see if anything balks
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.
The code looks good to me! I'd rely on @rshen91 or @markov00 doing proper smoke testing, due to more familiarity with themes. I made only optional code comments
The dark mocks look unusual in that (likely) low values are very salient white against the black background, another palette would be more appropriate, so our examples look more or less OK.
For the record I'm not a big fan of the gridline-free mock where it's hard to read which row a cell is in.
Also in some next PR the highlight could be fixed (I discussed it with @rshen91 earlier)
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.
changes LGTM
We should align and work together with EUI team to introduce the right changes to the theme
packages/charts/src/chart_types/heatmap/state/selectors/get_x_axis_right_overflow.ts
Outdated
Show resolved
Hide resolved
// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts | ||
// | ||
// @alpha (undocumented) | ||
export const Heatmap: React_2.FunctionComponent<Pick<HeatmapSpec, 'id' | 'data' | 'colorScale'> & Partial<Omit<HeatmapSpec, 'chartType' | 'specType' | 'id' | 'data'>>>; | ||
export const Heatmap: React_2.FunctionComponent<SpecRequiredProps_8 & SpecOptionalProps_8>; |
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.
not in this PR but we should find a way to express this in the right way
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.
Could you elaborate what you mean here? Would #1421 solve this?
BREAKING CHANGES: The `WorkcloudSpec.config` prop is removed as it was not used other than assigning `margins` even with erroneous properties. All wordcloud properties are now driven from the `WorkcloudSpec` directly. Since the wordcloud is unique in that it's styles are driven by the data I think keeping them on the spec is more favorable than moving them to the theme as they would be overridden more frequently. This does not provide a themed instance of the chart type but this could possibly come from `.brightening` the provided colors of the text elements.
# [41.0.0](v40.2.0...v41.0.0) (2021-12-17) ### Bug Fixes * replace createRef with useRef in Functional Components. ([#1524](#1524)) ([9538417](9538417)) ### Code Refactoring * **goal:** remove deprecated config ([#1408](#1408)) ([312e31d](312e31d)) ### Features * **heatmap:** dark mode with theme controls ([#1406](#1406)) ([f29c8dd](f29c8dd)) * **legend:** custom legend width ([#1467](#1467)) ([51f50df](51f50df)) ### BREAKING CHANGES * **goal:** The `GoalSpec.config` prop is removed. All properties have been moved/renamed under new `Theme.goal` options with the following exceptions: - `Config.margin` is now controlled by `Theme.chartMargins` and is no longer a margin ratio as before. - `Config.backgroundColor` is now controlled by `Theme.background.color`, even though it's not yet used. - `fontFamily` moved into each respective label styles - `angleStart` and `angleEnd` are moved onto the `GoalSpec` as optional values. - `sectorLineWidth`, `width` and `height` all removed as they were never used.
Summary
Adds dark mode to goal charts with configurable theme styles.
BREAKING CHANGES
The
HeatmapSpec.config
prop is removed. All properties have been moved/renamed under newTheme.heatmap
options with the following exceptions:HeatmapSpec.margin
was not used,Theme.chartMargins
should be used in the future.HeatmapSpec.fontFamily
HeatmapSpec.width
andHeatmapSpec.height
all removed as they were never used.Details
Applies #1356 to
master
The
Heatmap
,Partition
andWordCloud
specs all have no connection to the chart theme and thus have no canonical inheritance to dark mode. This PR fixes this for theHeatmap
chart and adds some added styles to the text labels as exposed in xy charts. TheHeatmapConfig
was broken down and moved intoTheme
or theHeatmapSpec
accordingly. We should avoid having aConfig
option to control theme as this not only creates a disconnect but also allows for multiple sources of truth for similar options and another property requirement to toggle for theming between dark and light modes.In the future I think it would great if we have a
Config
alternative to the react props in addition to theTheme
options.Issues
closes #1335
Checklist
:xy
,:partition
):interactions
,:axis
):theme
label has been added and the@elastic/eui-design
team has been pinged when there areTheme
API changescloses #123
,fixes #123
)packages/charts/src/index.ts
dark
,light
,eui-dark
&eui-light