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(core): Pass treemap tile data to getFillColor #1342

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

andre-cloudnatix
Copy link

@andre-cloudnatix andre-cloudnatix commented Mar 31, 2022

Updates

  • passes tile data to the getFillColor-function for the treemap component (which is useful for creating divergent tree maps)

If you like to try it out yourself you should make a build and try the code in the sandbox below:
https://codesandbox.io/s/carbon-treechart-getfillcolor-for-color-per-tile-fr4f10

Demo screenshot or recording

Value in console is the third argument that is passed to getFillColor

Screen.Recording.2022-04-07.at.10.52.42.mov

Review checklist (for reviewers only)

  • Demos all features
  • Documented/annotated
  • Matches UI/UX specs
  • Meets the code style guide
  • Accessible
  • Mobile first (responsive)
  • RTL support (bidirectional text)
  • Performant (limited bloat)

@andre-cloudnatix andre-cloudnatix requested review from zvonimirfras and Donisius and removed request for a team March 31, 2022 10:16
@andre-cloudnatix andre-cloudnatix changed the title feat(core): Pass treemap tile data to getFillColor WIP: feat(core): Pass treemap tile data to getFillColor Mar 31, 2022
@andre-cloudnatix andre-cloudnatix marked this pull request as draft March 31, 2022 13:12
@@ -167,8 +167,7 @@ export class Treemap extends Component {
.attr('width', (d) => d.x1 - d.x0)
.attr('height', (d) => d.y1 - d.y0)
.style('fill', (d) => {
while (d.depth > 1) d = d.parent;
Copy link
Author

Choose a reason for hiding this comment

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

It seems the treemap does not support nested data structures, so this while loop seems safe to delete.

@andre-cloudnatix andre-cloudnatix marked this pull request as ready for review April 7, 2022 08:58
@andre-cloudnatix andre-cloudnatix changed the title WIP: feat(core): Pass treemap tile data to getFillColor feat(core): Pass treemap tile data to getFillColor Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant