Update crosshair on mousemove

pull/10616/head
Andrew Watkins 2018-06-25 15:44:12 -07:00
parent e24e87eb22
commit de4e189c86
5 changed files with 13 additions and 20 deletions

View File

@ -18,10 +18,10 @@ class LogViewerChart extends PureComponent<Props> {
onZoom={onZoom} onZoom={onZoom}
queries={[]} queries={[]}
data={data} data={data}
displayOptions={{animatedZooms: false}}
setResolution={this.setResolution}
isBarGraph={true} isBarGraph={true}
timeRange={timeRange} timeRange={timeRange}
displayOptions={{animatedZooms: false}}
setResolution={this.setResolution}
colors={DEFAULT_LINE_COLORS} colors={DEFAULT_LINE_COLORS}
/> />
) )

View File

@ -148,7 +148,7 @@ class Dygraph extends Component<Props, State> {
zoomCallback: (lower: number, upper: number) => zoomCallback: (lower: number, upper: number) =>
this.handleZoom(lower, upper), this.handleZoom(lower, upper),
drawCallback: () => this.handleDraw(), drawCallback: () => this.handleDraw(),
highlightCircleSize: 0, highlightCircleSize: 3,
} }
if (isBarGraph) { if (isBarGraph) {
@ -242,7 +242,7 @@ class Dygraph extends Component<Props, State> {
const {staticLegend, cellID} = this.props const {staticLegend, cellID} = this.props
return ( return (
<div className="dygraph-child"> <div className="dygraph-child" onMouseMove={this.handleShowLegend}>
{this.dygraph && ( {this.dygraph && (
<div className="dygraph-addons"> <div className="dygraph-addons">
{this.areAnnotationsVisible && ( {this.areAnnotationsVisible && (
@ -265,11 +265,7 @@ class Dygraph extends Component<Props, State> {
/> />
</div> </div>
)} )}
<div <div className="dygraph-child-container" style={this.dygraphStyle} />
className="dygraph-child-container"
style={this.dygraphStyle}
onMouseEnter={this.handleShowLegend}
/>
{staticLegend && ( {staticLegend && (
<StaticLegend <StaticLegend
dygraphSeries={this.colorDygraphSeries} dygraphSeries={this.colorDygraphSeries}
@ -287,7 +283,6 @@ class Dygraph extends Component<Props, State> {
className="dygraph-child-container" className="dygraph-child-container"
ref={this.graphRef} ref={this.graphRef}
style={this.dygraphStyle} style={this.dygraphStyle}
onMouseEnter={this.handleShowLegend}
/> />
<ReactResizeDetector <ReactResizeDetector
handleWidth={true} handleWidth={true}

View File

@ -18,6 +18,7 @@ const validateTimeSeries = timeseries => {
) )
) )
} }
@ErrorHandlingWith(InvalidData) @ErrorHandlingWith(InvalidData)
class LineGraph extends Component { class LineGraph extends Component {
constructor(props) { constructor(props) {
@ -60,7 +61,6 @@ class LineGraph extends Component {
cellID, cellID,
onZoom, onZoom,
queries, queries,
hoverTime,
timeRange, timeRange,
cellHeight, cellHeight,
ruleValues, ruleValues,
@ -120,7 +120,6 @@ class LineGraph extends Component {
labels={labels} labels={labels}
queries={queries} queries={queries}
options={options} options={options}
hoverTime={hoverTime}
timeRange={timeRange} timeRange={timeRange}
isBarGraph={isBarGraph} isBarGraph={isBarGraph}
timeSeries={timeSeries} timeSeries={timeSeries}
@ -182,7 +181,6 @@ LineGraph.propTypes = {
label: string, label: string,
}), }),
}), }),
hoverTime: string,
handleSetHoverTime: func, handleSetHoverTime: func,
title: string, title: string,
isFetchingInitially: bool, isFetchingInitially: bool,

View File

@ -31,7 +31,6 @@ const RefreshingGraph = ({
onZoom, onZoom,
cellID, cellID,
queries, queries,
hoverTime,
tableOptions, tableOptions,
templates, templates,
timeRange, timeRange,
@ -106,7 +105,7 @@ const RefreshingGraph = ({
cellID={cellID} cellID={cellID}
colors={colors} colors={colors}
inView={inView} inView={inView}
hoverTime={hoverTime} isInCEO={isInCEO}
key={manualRefresh} key={manualRefresh}
queries={queries} queries={queries}
templates={templates} templates={templates}
@ -120,7 +119,6 @@ const RefreshingGraph = ({
resizerTopHeight={resizerTopHeight} resizerTopHeight={resizerTopHeight}
grabDataForDownload={grabDataForDownload} grabDataForDownload={grabDataForDownload}
handleSetHoverTime={handleSetHoverTime} handleSetHoverTime={handleSetHoverTime}
isInCEO={isInCEO}
onSetResolution={onSetResolution} onSetResolution={onSetResolution}
/> />
) )
@ -199,7 +197,6 @@ RefreshingGraph.propTypes = {
isEnforced: bool.isRequired, isEnforced: bool.isRequired,
digits: number.isRequired, digits: number.isRequired,
}).isRequired, }).isRequired,
hoverTime: string.isRequired,
handleSetHoverTime: func.isRequired, handleSetHoverTime: func.isRequired,
isInCEO: bool, isInCEO: bool,
onSetResolution: func, onSetResolution: func,
@ -213,9 +210,8 @@ RefreshingGraph.defaultProps = {
decimalPlaces: DEFAULT_DECIMAL_PLACES, decimalPlaces: DEFAULT_DECIMAL_PLACES,
} }
const mapStateToProps = ({dashboardUI, annotations: {mode}}) => ({ const mapStateToProps = ({annotations: {mode}}) => ({
mode, mode,
hoverTime: dashboardUI.hoverTime,
}) })
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({

View File

@ -589,8 +589,12 @@ class TableGraph extends Component<Props, State> {
} }
} }
const mstp = ({dashboardUI}) => ({
hoverTime: dashboardUI.hoverTime,
})
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
handleUpdateFieldOptions: bindActionCreators(updateFieldOptions, dispatch), handleUpdateFieldOptions: bindActionCreators(updateFieldOptions, dispatch),
}) })
export default connect(null, mapDispatchToProps)(TableGraph) export default connect(mstp, mapDispatchToProps)(TableGraph)