Merge pull request #3751 from influxdata/fix/crosshairs-pass-edge

Ensure hoverTime is a valid time range for the dygraph
pull/10616/head
Iris Scholten 2018-06-21 15:31:27 -07:00 committed by GitHub
commit 184f9fd8c8
2 changed files with 11 additions and 2 deletions

View File

@ -23,6 +23,7 @@
1. [#3697](https://github.com/influxdata/chronograf/pull/3697): Fix allowing hyphens in basepath
1. [#3698](https://github.com/influxdata/chronograf/pull/3698): Fix error in cell when tempVar returns no values
1. [#3733](https://github.com/influxdata/chronograf/pull/3733): Change arrows in table columns so that ascending sort points up and descending points down
1. [#3751](https://github.com/influxdata/chronograf/pull/3751): Fix crosshairs moving passed the edges of graphs
## v1.5.0.0 [2018-05-15-RC]

View File

@ -34,9 +34,17 @@ class Crosshair extends PureComponent<Props> {
}
private get isVisible() {
const {hoverTime} = this.props
const {dygraph, hoverTime} = this.props
const timeRanges = dygraph.xAxisRange()
return hoverTime !== 0 && _.isFinite(hoverTime)
const minTimeRange = _.get(timeRanges, '0', 0)
const isBeforeMinTimeRange = hoverTime < minTimeRange
const maxTimeRange = _.get(timeRanges, '1', Infinity)
const isPastMaxTimeRange = hoverTime > maxTimeRange
const isValidHoverTime = !isBeforeMinTimeRange && !isPastMaxTimeRange
return isValidHoverTime && hoverTime !== 0 && _.isFinite(hoverTime)
}
private get crosshairLeft(): number {