feat(heatmap): dark mode with theme controls#1406
feat(heatmap): dark mode with theme controls#1406nickofthyme merged 14 commits intoelastic:masterfrom
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.
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
monfera
left a comment
There was a problem hiding this comment.
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)
markov00
left a comment
There was a problem hiding this comment.
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.
not in this PR but we should find a way to express this in the right way
There was a problem hiding this comment.
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.configprop is removed. All properties have been moved/renamed under newTheme.heatmapoptions with the following exceptions:HeatmapSpec.marginwas not used,Theme.chartMarginsshould be used in the future.HeatmapSpec.fontFamilyHeatmapSpec.widthandHeatmapSpec.heightall removed as they were never used.Details
Applies #1356 to
masterThe
Heatmap,PartitionandWordCloudspecs all have no connection to the chart theme and thus have no canonical inheritance to dark mode. This PR fixes this for theHeatmapchart and adds some added styles to the text labels as exposed in xy charts. TheHeatmapConfigwas broken down and moved intoThemeor theHeatmapSpecaccordingly. We should avoid having aConfigoption 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
Configalternative to the react props in addition to theThemeoptions.Issues
closes #1335
Checklist
:xy,:partition):interactions,:axis):themelabel has been added and the@elastic/eui-designteam has been pinged when there areThemeAPI changescloses #123,fixes #123)packages/charts/src/index.tsdark,light,eui-dark&eui-light