File tree 8 files changed +69
-2
lines changed
8 files changed +69
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React, {Component} from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import {
4
4
AxesSelector ,
5
+ AxesRange ,
5
6
ColorPicker ,
6
7
DataSelector ,
7
8
Dropdown ,
@@ -194,9 +195,29 @@ class DefaultEditor extends Component {
194
195
< Numeric label = { _ ( 'Size' ) } step = { 1 } attr = "font.size" postfix = "px" />
195
196
< ColorPicker label = { _ ( 'Color' ) } attr = "font.color" />
196
197
</ AxesFold >
198
+
197
199
< AxesFold name = { _ ( 'Range' ) } >
198
200
< AxesSelector />
201
+ < Section name = { _ ( 'Selection' ) } >
202
+ < Radio
203
+ attr = "autorange"
204
+ options = { [
205
+ { label : _ ( 'Auto' ) , value : true } ,
206
+ { label : _ ( 'Custom' ) , value : false } ,
207
+ ] }
208
+ />
209
+ < AxesRange label = { _ ( 'Min' ) } attr = "range[0]" />
210
+ < AxesRange label = { _ ( 'Max' ) } attr = "range[1]" />
211
+ < Radio
212
+ attr = "type"
213
+ options = { [
214
+ { label : _ ( 'Linear' ) , value : 'linear' } ,
215
+ { label : _ ( 'log' ) , value : 'log' } ,
216
+ ] }
217
+ />
218
+ </ Section >
199
219
</ AxesFold >
220
+
200
221
< AxesFold name = { _ ( 'Lines' ) } >
201
222
< AxesSelector />
202
223
</ AxesFold >
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class Section extends Component {
46
46
47
47
const isAttr = Boolean ( child . props . attr ) ;
48
48
const plotProps = isAttr
49
- ? unpackPlotProps ( child . props , context , child . constructor )
49
+ ? unpackPlotProps ( child . props , context , child . type )
50
50
: { isVisible : true } ;
51
51
const childProps = Object . assign ( { plotProps} , child . props ) ;
52
52
childProps . key = i ;
Original file line number Diff line number Diff line change
1
+ import Numeric from './Numeric' ;
2
+ import React , { Component } from 'react' ;
3
+ import { connectToContainer } from '../../lib' ;
4
+
5
+ class AxesRange extends Component {
6
+ static modifyPlotProps ( props , context , plotProps ) {
7
+ if ( ! plotProps . isVisible ) {
8
+ return ;
9
+ }
10
+ const { fullContainer} = plotProps ;
11
+ if ( fullContainer && fullContainer . autorange ) {
12
+ plotProps . isVisible = false ;
13
+ }
14
+ }
15
+
16
+ render ( ) {
17
+ return < Numeric { ...this . props } /> ;
18
+ }
19
+ }
20
+
21
+ AxesRange . propTypes = {
22
+ ...Numeric . propTypes ,
23
+ } ;
24
+
25
+ AxesRange . defaultProps = {
26
+ showArrows : false ,
27
+ } ;
28
+
29
+ export default connectToContainer ( AxesRange ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class Numeric extends Component {
16
16
max = { this . props . max }
17
17
onChange = { this . props . updatePlot }
18
18
onUpdate = { this . props . updatePlot }
19
- showArrows
19
+ showArrows = { this . props . showArrows }
20
20
/>
21
21
</ Field >
22
22
) ;
@@ -28,9 +28,14 @@ Numeric.propTypes = {
28
28
fullValue : PropTypes . func ,
29
29
min : PropTypes . number ,
30
30
max : PropTypes . number ,
31
+ showArrows : PropTypes . number ,
31
32
step : PropTypes . number ,
32
33
updatePlot : PropTypes . func ,
33
34
...Field . propTypes ,
34
35
} ;
35
36
37
+ Numeric . defaultProps = {
38
+ showArrows : true ,
39
+ } ;
40
+
36
41
export default connectToContainer ( Numeric ) ;
Original file line number Diff line number Diff line change
1
+ import AxesRange from './AxesRange' ;
1
2
import AxesSelector from './AxesSelector' ;
2
3
import ColorPicker from './Color' ;
3
4
import Dropdown from './Dropdown' ;
@@ -9,6 +10,7 @@ import Numeric from './Numeric';
9
10
import TraceSelector from './TraceSelector' ;
10
11
11
12
export {
13
+ AxesRange ,
12
14
AxesSelector ,
13
15
ColorPicker ,
14
16
Dropdown ,
Original file line number Diff line number Diff line change 1
1
import {
2
+ AxesRange ,
2
3
AxesSelector ,
3
4
ColorPicker ,
4
5
Dropdown ,
@@ -15,6 +16,7 @@ import PanelMenuWrapper from './PanelMenuWrapper';
15
16
16
17
export {
17
18
AxesSelector ,
19
+ AxesRange ,
18
20
SubPanel ,
19
21
ColorPicker ,
20
22
DataSelector ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
import { EDITOR_ACTIONS } from './constants' ;
11
11
12
12
import {
13
+ AxesRange ,
13
14
AxesSelector ,
14
15
SubPanel ,
15
16
ColorPicker ,
@@ -29,6 +30,7 @@ import {
29
30
} from './components' ;
30
31
31
32
export {
33
+ AxesRange ,
32
34
AxesSelector ,
33
35
SubPanel ,
34
36
ColorPicker ,
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ import {getDisplayName} from '../lib';
5
5
6
6
export default function connectToContainer ( WrappedComponent ) {
7
7
class ContainerConnectedComponent extends Component {
8
+ static modifyPlotProps ( props , context , plotProps ) {
9
+ if ( WrappedComponent . modifyPlotProps ) {
10
+ WrappedComponent . modifyPlotProps ( props , context , plotProps ) ;
11
+ }
12
+ }
13
+
8
14
constructor ( props , context ) {
9
15
super ( props , context ) ;
10
16
You can’t perform that action at this time.
0 commit comments