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

refactor: cleanup wordcloud config, types and theming #1358

Merged
merged 4 commits into from
Sep 12, 2021

Conversation

nickofthyme
Copy link
Collaborator

@nickofthyme nickofthyme commented Sep 3, 2021

Summary

Refactor wordcloud spec to cleanup duplicate or unused config and types.

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.

Changes include

  • WorkcloudSpec.margin deleted in favor of Theme.chartMargins.
  • WorkcloudConfigs is removed in favor of singular WordcloudViewModel type which is extended to form WordcloudSpec.

Details

Other Changes:

  • Word types are refined to reflect the mutating nature of d3TagCloud function.
  • Added vrt screenshots to test template variations in story.
  • Cleaned up wordcloud story.
  • Added typings for d3-cloud

Checklist

  • The proper chart type label has been added (e.g. :xy, :partition)
  • The proper feature labels have been added (e.g. :interactions, :axis)
  • The :theme label has been added and the @elastic/eui-design team has been pinged when there are Theme API changes
  • All related issues have been linked (i.e. closes #123, fixes #123)
  • New public API exports have been added to packages/charts/src/index.ts
  • Unit tests have been added or updated to match the most common scenarios
  • The proper documentation and/or storybook story has been added or updated
  • The code has been checked for cross-browser compatibility (Chrome, Firefox, Safari, Edge)
  • Visual changes have been tested with all available themes including dark, light, eui-dark & eui-light

@nickofthyme nickofthyme added :wordcloud Wordcloud related issues :refactor Code refactor labels Sep 3, 2021
@monfera
Copy link
Contributor

monfera commented Sep 3, 2021

image

😍😍😍

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

The name WordcloudViewModel looks more like an internal detail/api more than a public part of the API.
What if we rename it back to WordcloudConfig

.eslintrc.js Show resolved Hide resolved
Copy link
Contributor

@monfera monfera left a comment

Choose a reason for hiding this comment

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

Beautiful reduction of code noise, lots of lines gone 😍 Also, great to have added the new image prints. Good to go once CI is in green

@nickofthyme nickofthyme requested a review from markov00 September 8, 2021 14:44
Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Changes look good to me

storybook/style.scss Outdated Show resolved Hide resolved
@nickofthyme nickofthyme merged commit 193e488 into elastic:alpha Sep 12, 2021
@nickofthyme nickofthyme deleted the wordcloud-theme branch September 12, 2021 16:56
@nickofthyme nickofthyme restored the wordcloud-theme branch September 12, 2021 18:32
@nickofthyme nickofthyme deleted the wordcloud-theme branch September 18, 2021 20:20
nickofthyme added a commit to nickofthyme/elastic-charts that referenced this pull request Sep 23, 2021
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.

Changes include

- `WorkcloudSpec.margin` deleted in favor of `Theme.chartMargins`.
- `WorkcloudConfigs` is removed in favor of singular `WordcloudViewModel` type which is extended to form `WordcloudSpec`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:refactor Code refactor :wordcloud Wordcloud related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants