Skip to content

feat(partition): treemap padding#660

Merged
monfera merged 21 commits intoelastic:masterfrom
monfera:treemap-padding
May 5, 2020
Merged

feat(partition): treemap padding#660
monfera merged 21 commits intoelastic:masterfrom
monfera:treemap-padding

Conversation

@monfera
Copy link
Copy Markdown
Contributor

@monfera monfera commented May 1, 2020

Summary

Adds treemap text padding configurability by specifying

  • fillLabel: { padding: 3 } for the perimeter in pixels, or
  • fillLabel: {padding: { top: 0, bottom: 0, left: 2, right: 2 } } to allow per-side configuration

Closes #659

image

The default value is minimal, but non-zero (2px), to avoid minor text bleeding. This is in effect if padding is omitted altogether, or for unspecified sides if padding is an object.

It's a per-layer configuration, because constraints, font sizes etc. may vary per layer.

In particular, it's good practice to have very small (0..2px) top and bottom padding for in-groove group texts, while there's more freedom to adjust eg. left (and less importantly, right) to horizontally align the left edge of the groove text with

  • the logical are of the group
  • the left edge of leaf node ink
  • the left edge of the (potentially left-padded) node leaf text

The story 8_groove_text.tsx shows an example for horizontal alignment with the ink.

Reviewer notes:

  • the last commit is pure renaming
  • besides the padding example 8_groove_text.tsx the other treemap mock changes are due to the use of a 2px padding rather than reusing the overhang padding, the change is small though

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, including a check against IE11
  • 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

@monfera monfera self-assigned this May 1, 2020
@monfera monfera added the wip work in progress label May 1, 2020
@codecov-io
Copy link
Copy Markdown

codecov-io commented May 1, 2020

Codecov Report

Merging #660 into master will increase coverage by 0.03%.
The diff coverage is 93.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
+ Coverage   72.94%   72.97%   +0.03%     
==========================================
  Files         266      266              
  Lines        8618     8630      +12     
  Branches     1695     1696       +1     
==========================================
+ Hits         6286     6298      +12     
  Misses       2293     2293              
  Partials       39       39              
Impacted Files Coverage Δ
...types/partition_chart/layout/types/config_types.ts 100.00% <ø> (ø)
...es/partition_chart/layout/types/viewmodel_types.ts 80.00% <ø> (ø)
...artition_chart/renderer/canvas/canvas_renderers.ts 6.20% <0.00%> (ø)
...rtition_chart/layout/viewmodel/fill_text_layout.ts 95.26% <100.00%> (+0.31%) ⬆️
...tion_chart/layout/viewmodel/hierarchy_of_arrays.ts 88.88% <100.00%> (ø)
...ypes/partition_chart/layout/viewmodel/viewmodel.ts 89.14% <100.00%> (ø)

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 16d9974...536e000. Read the comment docs.

}

type GetShapeRowGeometry = (
container: any, // fixme RectangleConstruction | RingSector,
Copy link
Copy Markdown
Contributor Author

@monfera monfera May 1, 2020

Choose a reason for hiding this comment

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

This type centralizes a number of old references and replaces the former ...args: any[] blanket so it's an improvement; I'm planning to revisit this sole remaining parameter, likely in a next treemap PR, to make this config available asap

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This could be also something like

type GetShapeRowGeometry<C> = (
  container: C, 
  ...

@monfera monfera added :chart Chart element related issue :partition Partition/PieChart/Donut/Sunburst/Treemap chart related enhancement New feature or request and removed wip work in progress labels May 1, 2020
Copy link
Copy Markdown
Collaborator

@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.

Code LGTM,
nit: if you can add a set of knobs to the groove text story it will give the reader a good idea on how the padding play a role in the rendering

}

type GetShapeRowGeometry = (
container: any, // fixme RectangleConstruction | RingSector,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This could be also something like

type GetShapeRowGeometry<C> = (
  container: C, 
  ...

@monfera monfera requested a review from markov00 May 4, 2020 17:34
Copy link
Copy Markdown
Collaborator

@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.

Code LGTM

@monfera monfera merged commit ed1e8be into elastic:master May 5, 2020
@monfera monfera deleted the treemap-padding branch May 5, 2020 14:06
markov00 pushed a commit that referenced this pull request May 5, 2020
# [19.2.0](v19.1.2...v19.2.0) (2020-05-05)

### Features

* **partition:** treemap padding ([#660](#660)) ([ed1e8be](ed1e8be))
@markov00
Copy link
Copy Markdown
Collaborator

markov00 commented May 5, 2020

🎉 This PR is included in version 19.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label May 5, 2020
AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this pull request Feb 10, 2022
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.

Project coverage is 72.98%. Comparing base (019323a) to head (a2f64db).

Files with missing lines Patch % Lines
...artition_chart/renderer/canvas/canvas_renderers.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
+ Coverage   72.94%   72.98%   +0.04%     
==========================================
  Files         266      266              
  Lines        8618     8632      +14     
  Branches     1695     1697       +2     
==========================================
+ Hits         6286     6300      +14     
  Misses       2293     2293              
  Partials       39       39              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:chart Chart element related issue enhancement New feature or request :partition Partition/PieChart/Donut/Sunburst/Treemap chart related released Issue released publicly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treemap should also observe the fillLabel.padding setting

4 participants