Change resolution on graph resize

pull/1609/head
Luke Morris 2017-06-16 16:25:45 -07:00
parent 5aeb32b75f
commit 4263a0dad0
2 changed files with 11 additions and 3 deletions

View File

@ -117,7 +117,7 @@ const AutoRefresh = ComposedComponent => {
const timeSeriesPromises = queries.map(query => {
const {host, database, rp} = query
const templatesWithResolution = templates.map((temp) => {
const templatesWithResolution = templates.map(temp => {
if (temp.tempVar === ':interval:') {
if (resolution) {
return {...temp, resolution}
@ -175,7 +175,13 @@ const AutoRefresh = ComposedComponent => {
return this.renderNoResults()
}
return <ComposedComponent {...this.props} data={timeSeries} setResolution={this.setResolution} />
return (
<ComposedComponent
{...this.props}
data={timeSeries}
setResolution={this.setResolution}
/>
)
},
/**
@ -188,6 +194,7 @@ const AutoRefresh = ComposedComponent => {
<ComposedComponent
{...this.props}
data={data}
setResolution={this.setResolution}
isFetchingInitially={isFirstFetch}
isRefreshing={!isFirstFetch}
/>

View File

@ -7,7 +7,6 @@ import _ from 'lodash'
import Dygraphs from 'src/external/dygraph'
import getRange from 'shared/parsing/getRangeForDygraph'
const LINE_COLORS = [
'#00C9FF',
'#9394FF',
@ -309,6 +308,8 @@ export default class Dygraph extends Component {
// }
dygraph.resize()
const {w} = this.dygraph.getArea()
this.props.setResolution(w)
}
sync() {