Save y range for user

pull/10616/head
Andrew Watkins 2017-08-01 09:10:08 -07:00
parent 59141c0125
commit d0e322ef55
3 changed files with 10 additions and 11 deletions

View File

@ -80,14 +80,9 @@ class CellEditorOverlay extends Component {
handleSetRange(e) {
const {min, max} = e.target.form
const {axes} = this.state
this.setState({
axes: {
y: {
bounds: [min.value, max.value],
},
},
})
this.setState({axes: {...axes, y: {bounds: [min.value, max.value]}}})
e.preventDefault()
}

View File

@ -6,7 +6,7 @@ import VisView from 'src/data_explorer/components/VisView'
import {GRAPH, TABLE} from 'shared/constants'
import _ from 'lodash'
const {array, arrayOf, bool, func, number, shape, string} = PropTypes
const {arrayOf, bool, func, number, shape, string} = PropTypes
const META_QUERY_REGEX = /^show/i
const Visualization = React.createClass({
@ -28,7 +28,7 @@ const Visualization = React.createClass({
views: arrayOf(string).isRequired,
axes: shape({
y: shape({
bounds: array,
bounds: arrayOf(string),
}),
}),
},

View File

@ -19,6 +19,11 @@ const getRange = (
) => {
const {value, rangeValue, operator} = ruleValues
if (userSelectedRange.length) {
const [userMin, userMax] = userSelectedRange
return [considerZero(userMin), considerZero(userMax)]
}
const subtractPadding = val => +val - Math.abs(val * PADDING_FACTOR)
const addPadding = val => +val + Math.abs(val * PADDING_FACTOR)
@ -65,10 +70,9 @@ const getRange = (
return [null, null]
}
const [userMin, userMax] = userSelectedRange
const [min, max] = range
return [considerZero(userMin, min), considerZero(userMax, max)]
return [min, max]
}
export default getRange