Skip to content
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: Theming - Charts #1608

Merged
merged 16 commits into from
Nov 7, 2023
Merged

Conversation

bmingles
Copy link
Contributor

@bmingles bmingles commented Oct 31, 2023

Added ChartThemeProvider, added support for resolving css variables in chart theme, and updated chart theme to use css variables.

resolves #1572

BREAKING CHANGE:

  • ChartThemeProvider is now required to provide ChartTheme
  • ChartModelFactory and ChartUtils now require chartTheme args
  • Any runtime references to ChartTheme will need to be updated

Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (61d1a53) 46.71% compared to head (fa1435e) 46.71%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1608   +/-   ##
=======================================
  Coverage   46.71%   46.71%           
=======================================
  Files         583      586    +3     
  Lines       36308    36340   +32     
  Branches     9094     9095    +1     
=======================================
+ Hits        16961    16977   +16     
- Misses      19295    19311   +16     
  Partials       52       52           
Flag Coverage Δ
unit 46.71% <58.22%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ckages/app-utils/src/components/ThemeBootstrap.tsx 100.00% <100.00%> (ø)
packages/chart/src/Chart.tsx 0.00% <ø> (ø)
packages/chart/src/ChartTheme.ts 100.00% <100.00%> (ø)
packages/chart/src/FigureChartModel.ts 54.14% <100.00%> (-0.14%) ⬇️
packages/components/src/theme/ThemeUtils.ts 99.06% <100.00%> (-0.94%) ⬇️
packages/components/src/theme/theme-dark/index.ts 100.00% <ø> (ø)
packages/chart/src/ChartModelFactory.ts 81.81% <50.00%> (+4.89%) ⬆️
packages/chart/src/ChartUtils.ts 64.99% <80.00%> (+0.72%) ⬆️
packages/console/src/HeapUsage.tsx 0.00% <0.00%> (ø)
packages/chart/src/useChartTheme.tsx 0.00% <0.00%> (ø)
... and 6 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmingles bmingles force-pushed the 1572-theming-charts branch 2 times, most recently from 289bc10 to 144d2fe Compare November 1, 2023 19:50
@bmingles bmingles marked this pull request as ready for review November 2, 2023 13:16
@bmingles bmingles requested a review from mofojed November 2, 2023 13:16
@bmingles bmingles force-pushed the 1572-theming-charts branch from ee3eb43 to d7b4adc Compare November 2, 2023 17:11
@bmingles bmingles force-pushed the 1572-theming-charts branch from ed0c47e to fd9a477 Compare November 2, 2023 21:03
packages/chart/src/ChartThemeProvider.tsx Outdated Show resolved Hide resolved
packages/chart/src/ChartTheme.ts Outdated Show resolved Hide resolved
Comment on lines 21 to 32
static _theme: ChartTheme;

static get theme(): ChartTheme {
/* eslint-disable no-underscore-dangle */
if (MockChartModel._theme == null) {
MockChartModel._theme = initChartTheme();
}

return MockChartModel._theme;
/* eslint-enable no-underscore-dangle */
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the theme be passed in to the constructor? As it is I don't see how this would update to if the user changes the theme in the Style Guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to only be used in static methods, so there's not really a constructor involved. I can probably just expose a setter that can be used by the Styleguide to change it, but I'll defer that until I implement the theme picker unless you have any objections.

packages/chart/src/useChartTheme.tsx Outdated Show resolved Hide resolved
packages/console/src/HeapUsage.tsx Outdated Show resolved Hide resolved
packages/dashboard-core-plugins/src/ChartBuilderPlugin.tsx Outdated Show resolved Hide resolved
@bmingles bmingles force-pushed the 1572-theming-charts branch from fd9a477 to 9a9bf88 Compare November 3, 2023 20:27
@bmingles bmingles force-pushed the 1572-theming-charts branch from d1ece51 to ff57e85 Compare November 6, 2023 20:19
@bmingles bmingles requested a review from mofojed November 6, 2023 21:10
@bmingles bmingles merged commit d5b3b48 into deephaven:main Nov 7, 2023
5 checks passed
@bmingles bmingles deleted the 1572-theming-charts branch November 7, 2023 21:40
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Theming - Charts and Plots
2 participants