Allow set base state on cell

pull/1934/head
Andrew Watkins 2017-08-22 11:04:18 -07:00
parent b3183e9eff
commit 1c3b7a845e
2 changed files with 18 additions and 2 deletions

View File

@ -5,6 +5,7 @@ import OptIn from 'shared/components/OptIn'
const AxesOptions = ({ const AxesOptions = ({
axes, axes,
onSetBase,
onSetLabel, onSetLabel,
onSetPrefixSuffix, onSetPrefixSuffix,
onSetYAxisBoundMin, onSetYAxisBoundMin,
@ -16,6 +17,7 @@ const AxesOptions = ({
const defaultYLabel = _.get(axes, ['y', 'defaultYLabel'], '') const defaultYLabel = _.get(axes, ['y', 'defaultYLabel'], '')
const prefix = _.get(axes, ['y', 'prefix'], '') const prefix = _.get(axes, ['y', 'prefix'], '')
const suffix = _.get(axes, ['y', 'suffix'], '') const suffix = _.get(axes, ['y', 'suffix'], '')
const base = _.get(axes, ['y', 'base'], '10')
return ( return (
<div className="display-options--cell"> <div className="display-options--cell">
@ -73,8 +75,18 @@ const AxesOptions = ({
<div className="form-group col-sm-6"> <div className="form-group col-sm-6">
<label>Labels Format</label> <label>Labels Format</label>
<ul className="nav nav-tablist nav-tablist-sm"> <ul className="nav nav-tablist nav-tablist-sm">
<li className="active">K/M/B</li> <li
<li>K/M/G</li> className={base === '10' ? 'active' : ''}
onClick={onSetBase('10')}
>
K/M/B
</li>
<li
className={base === '2' ? 'active' : ''}
onClick={onSetBase('2')}
>
K/M/G
</li>
</ul> </ul>
</div> </div>
<div className="form-group col-sm-6"> <div className="form-group col-sm-6">
@ -96,6 +108,7 @@ AxesOptions.propTypes = {
onSetYAxisBoundMin: func.isRequired, onSetYAxisBoundMin: func.isRequired,
onSetYAxisBoundMax: func.isRequired, onSetYAxisBoundMax: func.isRequired,
onSetLabel: func.isRequired, onSetLabel: func.isRequired,
onSetBase: func.isRequired,
axes: shape({ axes: shape({
y: shape({ y: shape({
bounds: arrayOf(string), bounds: arrayOf(string),

View File

@ -33,6 +33,7 @@ class DisplayOptions extends Component {
render() { render() {
const { const {
onSetBase,
onSetLabel, onSetLabel,
selectedGraphType, selectedGraphType,
onSelectGraphType, onSelectGraphType,
@ -46,6 +47,7 @@ class DisplayOptions extends Component {
<div className="display-options"> <div className="display-options">
<AxesOptions <AxesOptions
axes={axes} axes={axes}
onSetBase={onSetBase}
onSetLabel={onSetLabel} onSetLabel={onSetLabel}
onSetPrefixSuffix={onSetPrefixSuffix} onSetPrefixSuffix={onSetPrefixSuffix}
onSetYAxisBoundMin={onSetYAxisBoundMin} onSetYAxisBoundMin={onSetYAxisBoundMin}
@ -68,6 +70,7 @@ DisplayOptions.propTypes = {
onSetYAxisBoundMin: func.isRequired, onSetYAxisBoundMin: func.isRequired,
onSetYAxisBoundMax: func.isRequired, onSetYAxisBoundMax: func.isRequired,
onSetLabel: func.isRequired, onSetLabel: func.isRequired,
onSetBase: func.isRequired,
axes: shape({}).isRequired, axes: shape({}).isRequired,
queryConfigs: arrayOf(shape()).isRequired, queryConfigs: arrayOf(shape()).isRequired,
} }