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

add support to hide tooltips, key => seriesKey to avoid React prop clash. #73

Merged
merged 3 commits into from
Nov 9, 2017

Conversation

williaster
Copy link
Owner

this PR makes the following improvements 🚀

  • [shared][tooltip] don't render a tooltip if the output of renderTooltip is falsy
  • breaking [xy-chart] use seriesKey instead of key in onMouseMove event signature (relevant to StackedBarSeries and GroupedBarSeries only)

cc @alecklandgraf

@alecklandgraf
Copy link
Contributor

what do you think about duplicating key with seriesKey (or stackedKey)? it would make this backward compatible.

@coveralls
Copy link

coveralls commented Nov 8, 2017

Coverage Status

Coverage increased (+0.03%) to 83.212% when pulling 7446444 on chris--falsy-tooltip into 49733e9 on master.

@@ -94,6 +94,10 @@ class WithTooltip extends React.PureComponent {
tooltipData,
};

const tooltipContent = renderTooltip && tooltipOpen && TooltipComponent ?
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you need the ternary. This should work just fine:

const tooltipContent = renderTooltip && tooltipOpen && TooltipComponent && renderTooltip(tooltipData);

...
{toolTipContent && <TooltipComponent ... />

Copy link
Contributor

@alecklandgraf alecklandgraf left a comment

Choose a reason for hiding this comment

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

Looks good! One comment

@williaster
Copy link
Owner Author

williaster commented Nov 8, 2017

thanks for the comments.

I'd rather not always pass key around since it's reserved in React, we haven't been avoiding breaking changes in vx or data-ui until we hit a major version just so we can land on better apis. I think that seriesKey is slightly better than stackKey because it can be used by stacked + grouped bar series.

@coveralls
Copy link

coveralls commented Nov 8, 2017

Coverage Status

Coverage increased (+0.02%) to 83.206% when pulling f88831a on chris--falsy-tooltip into 49733e9 on master.

@williaster williaster merged commit de7642e into master Nov 9, 2017
@williaster williaster deleted the chris--falsy-tooltip branch November 9, 2017 01:33
@williaster williaster added this to the v0.0.48 milestone Nov 14, 2017
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.

3 participants