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

[WIP] feat: click trigger treemap tooltip #4245

Closed
wants to merge 1 commit into from

Conversation

ckifer
Copy link
Member

@ckifer ckifer commented Feb 29, 2024

Description

Realized that Treemap currently has no on-click Tooltip ability. Hacked this together quickly, adding as draft for now. Watch video for behavior

TODO: TESTS!!

Related Issue

#4238

Motivation and Context

Feature parity with other charts

How Has This Been Tested?

  • manually so far
  • TODO: unit tests

Screenshots (if appropriate):

recharts-click-tooltip.mov

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or extended an existing story to show my changes
  • All new and existing tests passed.

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 2.85714% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 93.09%. Comparing base (ca178b1) to head (53daba1).
Report is 1 commits behind head on 3.x.

Files Patch % Lines
src/chart/Treemap.tsx 2.85% 34 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              3.x    #4245      +/-   ##
==========================================
- Coverage   93.21%   93.09%   -0.13%     
==========================================
  Files          94       94              
  Lines       20028    20059      +31     
  Branches     2720     2721       +1     
==========================================
+ Hits        18670    18674       +4     
- Misses       1347     1374      +27     
  Partials       11       11              

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

@PavelVanecek
Copy link
Collaborator

Hahaaa I like the bot harassing on new lines without coverage

@ckifer
Copy link
Member Author

ckifer commented Feb 29, 2024

LOL, bad me for not having enough time for tests at midnight my time 🤣

Copy link
Collaborator

@PavelVanecek PavelVanecek left a comment

Choose a reason for hiding this comment

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

I wonder if I can convince you to move the tooltip behaviour to context while working on the Treemap onClick fix.

@@ -360,8 +360,9 @@ export class Treemap extends PureComponent<Props, State> {
e.persist();
const { onMouseEnter, children } = this.props;
const tooltipItem = findChildByType(children, Tooltip);
const tooltipTrigger = tooltipItem.props.trigger;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Another findChildByType 😢 we need to move all of this to context

Copy link
Collaborator

Choose a reason for hiding this comment

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

Outside of this PR of course.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep. I'm solving problems from issues in a siloed way.. need to start helping with the broader changes.

const { activeNode } = this.state;
const isNestedParentNode = type === 'nest' && node.children;

if (tooltipTrigger === 'click') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

How much of this is copy-paste from generateCategoricalChart? Just wondering.

Copy link
Member Author

@ckifer ckifer Feb 29, 2024

Choose a reason for hiding this comment

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

I just hacked this to get it it to work, no references from anywhere except Treemap (its not pretty I know :p)

@ckifer
Copy link
Member Author

ckifer commented Feb 29, 2024

I'll take a step back from this change and try to narrow in on moving the Tooltip to context instead. This functionality was worth a mini-POC either way. Definitely something to come back to

@ckifer ckifer closed this May 2, 2024
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

2 participants