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(partition): small multiples #1076

Merged
merged 31 commits into from
Mar 23, 2021

Conversation

monfera
Copy link
Contributor

@monfera monfera commented Mar 11, 2021

Summary

Small multiples for partition charts

resize

image

  • Additive small multiples (first level of small multiples; index): multiple <Partition> specs under <Chart> WIP
  • Multiplicative small multiples (second level of small multiples; innerIndex): breakdown of a <Partition> spec along its first partitioning layer
  • Both layers can independently specify horizontal, vertical or Z pattern (grid) (additive layer: not exposed yet)
  • Eventually, 2D grid will be possible not just with Z pattern but also, allowing a category specification per dimension (additive) and allowing the breakdown along the second partitioning layer; not in scope for this PR
  • Uses getChartIdSelectors in place of previous repeated (state) => state.chartIds (earlier unrelated feedback by Nick)
  • Abstracts out some types, eg. PanelPlacement, RelativeMargins
  • Tightens containerBackgroundColor in getShapeViewModel (no longer optional)
  • BREAKING: redefines the inner/outer padding notation for small multiples from [outer, inner] to {outer, inner}

Warning, will likely do push -f while it's WIP

Checklist

Delete any items that are not applicable to this PR.

  • Any consumer-facing exports were added to src/index.ts (and stories only import from ../src except for test data & storybook)
  • This was checked for cross-browser compatibility
  • Proper documentation or storybook story was added for features that require explanation or tutorials
  • Unit tests were updated or added to match the most common scenarios
  • Threading through small multiples and group by options into the spec
  • Fixing margin
  • Adding per-panel titles and adding title info to the tooltip
  • Pie size related fixes (it still preserves the room for an extra layer)
  • Adjust legend generation to the new (cartesian-compatible) type of small multiples generation via <GroupBy>
  • Crop panel title with ... if it doesn't fit horizontally
  • Take font spec for panel title from the theme, use that for title text rendering, and preserve vertical area for title in function of that

@codecov-io
Copy link

codecov-io commented Mar 11, 2021

Codecov Report

Merging #1076 (cb12f05) into master (f08f4c9) will increase coverage by 0.20%.
The diff coverage is 60.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1076      +/-   ##
==========================================
+ Coverage   71.77%   71.98%   +0.20%     
==========================================
  Files         381      397      +16     
  Lines       11743    12229     +486     
  Branches     2512     2636     +124     
==========================================
+ Hits         8429     8803     +374     
- Misses       3299     3387      +88     
- Partials       15       39      +24     
Flag Coverage Δ
unittests 71.55% <60.29%> (-0.23%) ⬇️

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

Impacted Files Coverage Δ
...types/partition_chart/layout/types/config_types.ts 100.00% <ø> (ø)
src/chart_types/partition_chart/specs/index.ts 53.84% <ø> (ø)
src/chart_types/xy_chart/utils/dimensions.ts 91.66% <ø> (ø)
src/common/geometry.ts 81.25% <ø> (ø)
src/common/predicate.ts 36.00% <ø> (ø)
src/specs/group_by.ts 100.00% <ø> (ø)
...types/partition_chart/renderer/dom/highlighter.tsx 16.09% <4.34%> (-2.96%) ⬇️
...n_chart/renderer/canvas/canvas_linear_renderers.ts 8.19% <4.54%> (-1.24%) ⬇️
...artition_chart/renderer/canvas/canvas_renderers.ts 6.21% <14.28%> (+0.57%) ⬆️
...on_chart/state/selectors/get_highlighted_shapes.ts 63.63% <25.00%> (+5.30%) ⬆️
... and 48 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f08f4c9...cb12f05. Read the comment docs.

@monfera monfera added :partition Partition/PieChart/Donut/Sunburst/Treemap chart related :small multiples Small multiples/trellising related issues wip work in progress labels Mar 11, 2021
@monfera monfera force-pushed the small-multiples-partition-4 branch 2 times, most recently from b0b1240 to 6da2336 Compare March 21, 2021 15:12
@monfera monfera force-pushed the small-multiples-partition-4 branch from 8ff0f95 to 30e3241 Compare March 23, 2021 01:17
@monfera monfera marked this pull request as ready for review March 23, 2021 06:20
@monfera monfera requested a review from markov00 March 23, 2021 06:21
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.

There are two outstanding issues that I'm seeing here:

Screenshot 2021-03-23 at 11 53 47

With a vertical layout and 0 outer vertical padding, the first title is cutoff.
The legend instead mix up colors, in the example the the Mineral/fuel has a blue color, but is represented with the red one

@monfera
Copy link
Contributor Author

monfera commented Mar 23, 2021

The vertical offsetting is improved to avoid cropping with a zero outer panel pad: cb12f05 and the Theme iteration (follow-up PR) will use the Theme font and padding specs

@markov00 markov00 removed the wip work in progress label Mar 23, 2021
@markov00 markov00 self-requested a review March 23, 2021 13:54
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.

LGTM, merging on green.
Followup PR:

  • fix hierarchical legend

@monfera monfera merged commit 282082b into elastic:master Mar 23, 2021
github-actions bot pushed a commit that referenced this pull request Mar 23, 2021
# [26.0.0](v25.4.0...v26.0.0) (2021-03-23)

### Features

* **partition:** small multiples ([#1076](#1076)) ([282082b](282082b))

### BREAKING CHANGES

* **partition:** clarifies the inner/outer padding notation `<SmallMultiples style={{horizontalPanelPadding, verticalPanelPadding}}` from `[outer, inner]` to `{outer, inner}`—they still have the same effect
@nickofthyme
Copy link
Collaborator

🎉 This PR is included in version 26.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickofthyme nickofthyme added the released Issue released publicly label Mar 23, 2021
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
# [26.0.0](elastic/elastic-charts@v25.4.0...v26.0.0) (2021-03-23)

### Features

* **partition:** small multiples ([opensearch-project#1076](elastic/elastic-charts#1076)) ([9b7f2f6](elastic/elastic-charts@9b7f2f6))

### BREAKING CHANGES

* **partition:** clarifies the inner/outer padding notation `<SmallMultiples style={{horizontalPanelPadding, verticalPanelPadding}}` from `[outer, inner]` to `{outer, inner}`—they still have the same effect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:partition Partition/PieChart/Donut/Sunburst/Treemap chart related released Issue released publicly :small multiples Small multiples/trellising related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants