From 6a6727c70e8517116b00b213fe1a15aa3b1835c1 Mon Sep 17 00:00:00 2001 From: Nicolas Kruchten Date: Sun, 7 Oct 2018 10:09:00 -0400 Subject: [PATCH 1/5] pie scale group --- src/default_panels/StyleTracesPanel.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/default_panels/StyleTracesPanel.js b/src/default_panels/StyleTracesPanel.js index 86995241d..282761c6a 100644 --- a/src/default_panels/StyleTracesPanel.js +++ b/src/default_panels/StyleTracesPanel.js @@ -215,6 +215,7 @@ const StyleTracesPanel = (props, {localize: _}) => ( {label: _('Counterclockwise'), value: 'counterclockwise'}, ]} /> + From 53aa956690d1bd456ad9c2f16451509093b30ecd Mon Sep 17 00:00:00 2001 From: Nicolas Kruchten Date: Sun, 7 Oct 2018 10:09:32 -0400 Subject: [PATCH 2/5] upgrade colorscale picker --- package.json | 2 +- src/components/widgets/ColorscalePicker.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 10206f7e9..4bac8ca02 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "prop-types": "^15.5.10", "raf": "^3.4.0", "react-color": "^2.13.8", - "react-colorscales": "0.6.1", + "react-colorscales": "0.7.1", "react-dropzone": "^5.0.1", "react-plotly.js": "^2.2.0", "react-rangeslider": "^2.2.0", diff --git a/src/components/widgets/ColorscalePicker.js b/src/components/widgets/ColorscalePicker.js index 515a3cf61..5d40b917b 100644 --- a/src/components/widgets/ColorscalePicker.js +++ b/src/components/widgets/ColorscalePicker.js @@ -31,7 +31,9 @@ class Scale extends Component { const {onColorscaleChange, selected} = this.props; const {selectedColorscaleType, showColorscalePicker} = this.state; const description = COLOR_PICKER_CONSTANTS.COLORSCALE_DESCRIPTIONS[selectedColorscaleType]; - const colorscaleOptions = COLOR_PICKER_CONSTANTS.COLORSCALE_TYPES.map(type => ({ + const colorscaleOptions = COLOR_PICKER_CONSTANTS.COLORSCALE_TYPES.filter( + type => type !== 'custom' + ).map(type => ({ label: type + ' scales', value: type, })); From 81378bc43d135a7a71edc53db6004792ce733ee3 Mon Sep 17 00:00:00 2001 From: Nicolas Kruchten Date: Sun, 7 Oct 2018 10:10:47 -0400 Subject: [PATCH 3/5] adding advanced tick formatting --- src/components/fields/DropdownCustom.js | 11 ++++++----- src/components/fields/derived.js | 20 ++++++++++++++++++++ src/components/fields/index.js | 2 ++ src/components/index.js | 2 ++ src/default_panels/StyleAxesPanel.js | 18 ++++++++++++++++++ 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/components/fields/DropdownCustom.js b/src/components/fields/DropdownCustom.js index 96df0b023..49d44c994 100644 --- a/src/components/fields/DropdownCustom.js +++ b/src/components/fields/DropdownCustom.js @@ -6,7 +6,7 @@ import Field from './Field'; import DropdownWidget from '../widgets/Dropdown'; import Text from './Text'; -class UnconnectedDropdownCustom extends Component { +export class UnconnectedDropdownCustom extends Component { constructor(props, context) { super(props, context); @@ -35,19 +35,20 @@ class UnconnectedDropdownCustom extends Component { setValue(value, custom = false) { this.value = value; + const customOpt = this.props.customOpt; this.setState({ - custom: (custom || value === this.props.customOpt) && value !== '', + custom: (custom || value === customOpt) && value !== '', }); this.props.updateContainer({ - [this.props.attr]: value === this.props.customOpt && !custom ? 'custom' : value, + [this.props.attr]: value === customOpt && !custom ? customOpt : value, }); } render() { - const {options, attr} = this.props; + const {options, attr, customOpt} = this.props; const value = (this.value === '' || !options.map(o => o.value).includes(this.value)) && this.state.custom - ? 'custom' + ? customOpt : this.value; return ( diff --git a/src/components/fields/derived.js b/src/components/fields/derived.js index 31ea38006..0785c8748 100644 --- a/src/components/fields/derived.js +++ b/src/components/fields/derived.js @@ -1,5 +1,6 @@ import isNumeric from 'fast-isnumeric'; import {UnconnectedDropdown} from './Dropdown'; +import {UnconnectedDropdownCustom} from './DropdownCustom'; import {UnconnectedFlaglist} from './Flaglist'; import {UnconnectedNumeric} from './Numeric'; import {UnconnectedAxisRangeValue} from './AxisRangeValue'; @@ -145,6 +146,25 @@ export const BinningDropdown = connectToContainer(UnconnectedDropdown, { }, }); +export const TickFormat = connectToContainer(UnconnectedDropdownCustom, { + modifyPlotProps: (props, context, plotProps) => { + const {localize: _} = context; + if (plotProps.fullContainer.type === 'date') { + plotProps.options = [ + {label: _('Default'), value: ''}, + {label: _('Advanced (d3-time-format)'), value: '%x'}, + ]; + plotProps.customOpt = '%x'; + } else { + plotProps.options = [ + {label: _('Simple'), value: ''}, + {label: _('Advanced (d3-format)'), value: 's'}, + ]; + plotProps.customOpt = 's'; + } + }, +}); + export const ShowInLegend = connectToContainer(UnconnectedVisibilitySelect, { modifyPlotProps: (props, context, plotProps) => { plotProps.isVisible = context.fullLayout.showlegend; diff --git a/src/components/fields/index.js b/src/components/fields/index.js index 6682f016a..f075ab544 100644 --- a/src/components/fields/index.js +++ b/src/components/fields/index.js @@ -54,6 +54,7 @@ import { ShowInLegend, HoveronDropdown, HovermodeDropdown, + TickFormat, } from './derived'; import {LineDashSelector, LineShapeSelector} from './LineSelectors'; @@ -93,6 +94,7 @@ export { DualNumeric, AxisRangeValue, Text, + TickFormat, Radio, SymbolSelector, RangesliderVisible, diff --git a/src/components/index.js b/src/components/index.js index 58aee0874..ced31a810 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -56,6 +56,7 @@ import { LocationSelector, HoveronDropdown, HovermodeDropdown, + TickFormat, } from './fields'; import { @@ -89,6 +90,7 @@ import {Button} from './widgets'; import PanelMenuWrapper from './PanelMenuWrapper'; export { + TickFormat, AnnotationAccordion, AxisAnchorDropdown, AxisOverlayDropdown, diff --git a/src/default_panels/StyleAxesPanel.js b/src/default_panels/StyleAxesPanel.js index 191efa0fb..52cb1dabd 100644 --- a/src/default_panels/StyleAxesPanel.js +++ b/src/default_panels/StyleAxesPanel.js @@ -19,6 +19,7 @@ import { RangeSelectorAccordion, VisibilitySelect, DropdownCustom, + TickFormat, } from '../components'; class StyleAxesPanel extends Component { @@ -163,6 +164,12 @@ class StyleAxesPanel extends Component { ]} /> + + Date: Sun, 7 Oct 2018 13:23:43 -0400 Subject: [PATCH 4/5] bump dep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4bac8ca02..f4216a502 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "prop-types": "^15.5.10", "raf": "^3.4.0", "react-color": "^2.13.8", - "react-colorscales": "0.7.1", + "react-colorscales": "0.7.2", "react-dropzone": "^5.0.1", "react-plotly.js": "^2.2.0", "react-rangeslider": "^2.2.0", From 03a845f25510490d11d50ca1f110162cd1fde3aa Mon Sep 17 00:00:00 2001 From: Nicolas Kruchten Date: Tue, 9 Oct 2018 11:06:47 -0400 Subject: [PATCH 5/5] moving scale group to scaling section --- src/default_panels/StyleTracesPanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/default_panels/StyleTracesPanel.js b/src/default_panels/StyleTracesPanel.js index 282761c6a..f0a670f2f 100644 --- a/src/default_panels/StyleTracesPanel.js +++ b/src/default_panels/StyleTracesPanel.js @@ -215,7 +215,6 @@ const StyleTracesPanel = (props, {localize: _}) => ( {label: _('Counterclockwise'), value: 'counterclockwise'}, ]} /> - @@ -541,7 +540,7 @@ const StyleTracesPanel = (props, {localize: _}) => ( /> - + ( {label: _('Manual'), value: 'manual'}, ]} /> +