diff --git a/client/app/visualizations/chart/ChartColorEditor.jsx b/client/app/visualizations/chart/ChartColorEditor.jsx index 953079e9d6..711c8d6e01 100644 --- a/client/app/visualizations/chart/ChartColorEditor.jsx +++ b/client/app/visualizations/chart/ChartColorEditor.jsx @@ -1,13 +1,9 @@ import React from 'react'; import PropTypes from 'prop-types'; -import Select from 'antd/lib/select'; -import 'antd/lib/select/style'; import { map } from 'lodash'; -import { ColorPalette } from '@/visualizations/chart/plotly/utils'; import { SeriesOptions, ValuesOptions } from '@/components/proptypes'; - -const colors = { Automatic: null, ...ColorPalette }; +import ColorSelect from './ColorSelect'; export default class ChartColorEditor extends React.Component { static propTypes = { @@ -26,11 +22,6 @@ export default class ChartColorEditor extends React.Component { changeColor = (value, color) => this.updateOptions(value, { color }); render() { - const colorSelectItem = v => (); - const colorOptionItem = (v, k) => {colorSelectItem(v)}{k}; return (
- + /> | ))} diff --git a/client/app/visualizations/chart/ChartEditor.jsx b/client/app/visualizations/chart/ChartEditor.jsx index 5c875dd09a..25e2f21b9b 100644 --- a/client/app/visualizations/chart/ChartEditor.jsx +++ b/client/app/visualizations/chart/ChartEditor.jsx @@ -15,6 +15,7 @@ import { QueryData } from '@/components/proptypes'; import ChartTypePicker from './ChartTypePicker'; import ChartSeriesEditor from './ChartSeriesEditor'; import ChartColorEditor from './ChartColorEditor'; +import ColorSelect from './ColorSelect'; import ChartRenderer from './ChartRenderer'; const DEFAULT_CUSTOM_CODE = `// Available variables are x, ys, element, and Plotly @@ -49,6 +50,10 @@ function PopoverHelp(props) { PopoverHelp.propTypes = { children: PropTypes.arrayOf(PropTypes.node).isRequired }; +const colorSchemes = ['Blackbody', 'Bluered', 'Blues', 'Earth', 'Electric', + 'Greens', 'Greys', 'Hot', 'Jet', 'Picnic', 'Portland', + 'Rainbow', 'RdBu', 'Reds', 'Viridis', 'YlGnBu', 'YlOrRd', 'Custom...']; + export default class ChartEditor extends React.Component { static propTypes = { data: QueryData.isRequired, @@ -117,6 +122,7 @@ export default class ChartEditor extends React.Component { getErrorColumn = () => findKey(this.props.options.columnMapping, c => c === 'yError') getSizeColumn = () => findKey(this.props.options.columnMapping, c => c === 'size') getGroupby = () => findKey(this.props.options.columnMapping, c => c === 'groupby') + getZValue = () => findKey(this.props.options.columnMapping, c => c === 'zVal') updateOptions = (newOptions) => { const opts = this.props.options; @@ -174,6 +180,9 @@ export default class ChartEditor extends React.Component { }) toggleSortX = e => this.updateOptions({ sortX: e.target.checked }) + toggleReverseX = e => this.updateOptions({ reverseX: e.target.checked }) + toggleSortY = e => this.updateOptions({ sortY: e.target.checked }) + toggleReverseY = e => this.updateOptions({ reverseY: e.target.checked }) toggleXLabels = e => this.updateOptions({ xAxis: { @@ -195,6 +204,7 @@ export default class ChartEditor extends React.Component { updateGroupby = groupby => this.updateColumn({ groupby }) updateSizeColumn = size => this.updateColumn({ size }) updateErrorColumn = yError => this.updateColumn({ yError }) + updateZValue = zVal => this.updateColumn({ zVal }) updateStacking = stacking => this.updateOptions({ series: { ...this.props.options.series, stacking }, }) @@ -221,6 +231,7 @@ export default class ChartEditor extends React.Component { updatePercentFormat = e => this.updateOptions({ percentFormat: e.target.value }) updateDateTimeFormat = e => this.updateOptions({ dateTImeFormat: e.target.value }) updateTextFormat = e => this.updateOptions({ textFormat: e.target.value }) + updateColorScheme = colorScheme => this.updateOptions({ colorScheme }) yAxisPanel = (side, i) => { const yAxis = this.props.options.yAxis[i]; return ( @@ -299,13 +310,14 @@ export default class ChartEditor extends React.Component { - {opts.globalSeriesType !== 'custom' ? + {!includes(['custom', 'heatmap'], opts.globalSeriesType) ?