fix hovertime issue in tableGraphs

Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>
pull/3030/head
Iris Scholten 2018-03-21 14:25:48 -07:00
parent 2716a59a62
commit 88ab26a385
1 changed files with 6 additions and 4 deletions

View File

@ -57,8 +57,6 @@ class TableGraph extends Component {
super(props) super(props)
this.state = { this.state = {
data: [[]], data: [[]],
unzippedData: [[]],
filteredData: [[]],
processedData: [[]], processedData: [[]],
hoveredColumnIndex: NULL_ARRAY_INDEX, hoveredColumnIndex: NULL_ARRAY_INDEX,
hoveredRowIndex: NULL_ARRAY_INDEX, hoveredRowIndex: NULL_ARRAY_INDEX,
@ -126,12 +124,16 @@ class TableGraph extends Component {
handleHover = (columnIndex, rowIndex) => () => { handleHover = (columnIndex, rowIndex) => () => {
const {onSetHoverTime, tableOptions: {verticalTimeAxis}} = this.props const {onSetHoverTime, tableOptions: {verticalTimeAxis}} = this.props
const data = verticalTimeAxis ? this.state.data : this.state.unzippedData const {data} = this.state
if (rowIndex === 0) {
return
}
if (onSetHoverTime) { if (onSetHoverTime) {
const hoverTime = verticalTimeAxis const hoverTime = verticalTimeAxis
? data[rowIndex][0] ? data[rowIndex][0]
: data[0][columnIndex] : data[columnIndex][0]
onSetHoverTime(hoverTime.toString()) onSetHoverTime(hoverTime.toString())
console.log(moment(hoverTime).format(this.props.tableOptions.timeFormat))
} }
this.setState({ this.setState({
hoveredColumnIndex: columnIndex, hoveredColumnIndex: columnIndex,