diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js index b796d93a3..13716e737 100644 --- a/ui/src/shared/components/Dygraph.js +++ b/ui/src/shared/components/Dygraph.js @@ -216,7 +216,15 @@ class Dygraph extends Component { } handleHideLegend = () => { - this.setState({isHidden: true}) + this.props.handleSetHoverTime(NULL_HOVER_TIME) + this.setState({isHidden: true, isHoveringThisGraph: false}) + } + + handleShowLegend = e => { + const newTime = this.eventToTimestamp(e) + this.props.handleSetHoverTime(newTime) + + this.setState({isHidden: false, isHoveringThisGraph: true}) } get lineColors() { @@ -265,22 +273,6 @@ class Dygraph extends Component { return date.toISOString() } - handleMouseMove = e => { - const newTime = this.eventToTimestamp(e) - this.props.handleSetHoverTime(newTime) - - this.setState({isHoveringThisGraph: true}) - } - - handleMouseLeave = () => { - this.props.handleSetHoverTime(NULL_HOVER_TIME) - this.setState({isHoveringThisGraph: false}) - } - - handleShowLegend = () => { - this.setState({isHidden: false}) - } - handleReceiveStaticLegendHeight = staticLegendHeight => { this.setState({staticLegendHeight}) } @@ -310,7 +302,7 @@ class Dygraph extends Component { } return ( -