Remove crosshair when someone graph is moused out

pull/1951/head
Andrew Watkins 2017-08-30 17:42:31 -07:00
parent c25e15c64d
commit fd5560512a
1 changed files with 14 additions and 1 deletions

View File

@ -401,6 +401,19 @@ export default class Dygraph extends Component {
return moment(timeRange).utc().format()
}
deselectCrosshair = () => {
const plugins = this.dygraph.plugins_
const {plugin: crosshair} = plugins.find(
({plugin}) => plugin.toString() === 'Crosshair Plugin'
)
if (!crosshair) {
return
}
crosshair.deselect()
}
render() {
const {
legend,
@ -413,7 +426,7 @@ export default class Dygraph extends Component {
} = this.state
return (
<div className="dygraph-child">
<div className="dygraph-child" onMouseLeave={this.deselectCrosshair}>
<DygraphLegend
{...legend}
sortType={sortType}