diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index ae97b8d837..595642a60c 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -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() } diff --git a/ui/src/data_explorer/components/Visualization.js b/ui/src/data_explorer/components/Visualization.js index 4729009040..66c34664d4 100644 --- a/ui/src/data_explorer/components/Visualization.js +++ b/ui/src/data_explorer/components/Visualization.js @@ -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), }), }), }, diff --git a/ui/src/shared/parsing/getRangeForDygraph.js b/ui/src/shared/parsing/getRangeForDygraph.js index 1e505718b9..43eec356df 100644 --- a/ui/src/shared/parsing/getRangeForDygraph.js +++ b/ui/src/shared/parsing/getRangeForDygraph.js @@ -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