Skip to content

Instantly share code, notes, and snippets.

@NookieGrey
Last active July 5, 2018 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NookieGrey/add3b1f3416f4dddb7f7da8766f6279a to your computer and use it in GitHub Desktop.
Save NookieGrey/add3b1f3416f4dddb7f7da8766f6279a to your computer and use it in GitHub Desktop.
class GraphTooltip extends React.Component {
render() {
const {datum, x, y, color} = this.props;
return (
<g style={{pointerEvents: 'none'}}>
<foreignObject x={x} y={y} width="1" height="1">
<div
className="advisor-clients-portfolio-analytics-historical-tooltip-dot"
style={{backgroundColor: color}}
>
<div
className="advisor-clients-portfolio-analytics-historical-tooltip-line"
style={{backgroundColor: color, height: 500 - y - 56}}
/>
<div className="advisor-clients-portfolio-analytics-historical-tooltip">
<div>{moment(datum.date).format("MMMM DD, YYYY")}</div>
<div>{datum["value-formatted"]} ({datum["total-change"] > 0 && "+"}{datum["total-change-formatted"]})</div>
</div>
</div>
</foreignObject>
</g>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment