File tree 5 files changed +64
-1
lines changed
5 files changed +64
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
3
3
import {
4
4
AxesSelector ,
5
5
AxesRange ,
6
+ CanvasSize ,
6
7
ColorPicker ,
7
8
DataSelector ,
8
9
Dropdown ,
@@ -176,12 +177,43 @@ class DefaultEditor extends Component {
176
177
177
178
< LayoutPanel group = "Style" name = { _ ( 'Layout' ) } >
178
179
< Fold name = { _ ( 'Canvas' ) } >
179
- < Numeric
180
+ < Radio
181
+ attr = "autosize"
182
+ options = { [
183
+ { label : _ ( 'Auto' ) , value : true } ,
184
+ { label : _ ( 'Custom' ) , value : false } ,
185
+ ] }
186
+ />
187
+ < CanvasSize
180
188
label = { _ ( 'Fixed Width' ) }
181
189
step = { 1 }
182
190
attr = "width"
183
191
postfix = "px"
184
192
/>
193
+ < CanvasSize
194
+ label = { _ ( 'Fixed Height' ) }
195
+ step = { 1 }
196
+ attr = "height"
197
+ postfix = "px"
198
+ />
199
+ < ColorPicker label = { _ ( 'Color' ) } attr = "paper_bgcolor" />
200
+ </ Fold >
201
+ < Fold name = { _ ( 'Margins and Padding' ) } >
202
+ < Numeric label = { _ ( 'Top' ) } step = { 1 } attr = "margin.t" postfix = "px" />
203
+ < Numeric
204
+ label = { _ ( 'Bottom' ) }
205
+ step = { 1 }
206
+ attr = "margin.b"
207
+ postfix = "px"
208
+ />
209
+ < Numeric label = { _ ( 'Left' ) } step = { 1 } attr = "margin.l" postfix = "px" />
210
+ < Numeric label = { _ ( 'Right' ) } step = { 1 } attr = "margin.r" postfix = "px" />
211
+ < Numeric
212
+ label = { _ ( 'Padding' ) }
213
+ step = { 1 }
214
+ attr = "margin.pad"
215
+ postfix = "px"
216
+ />
185
217
</ Fold >
186
218
</ LayoutPanel >
187
219
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 CanvasSize extends Component {
6
+ static modifyPlotProps ( props , context , plotProps ) {
7
+ if ( ! plotProps . isVisible ) {
8
+ return ;
9
+ }
10
+ const { fullContainer} = plotProps ;
11
+ if ( fullContainer && fullContainer . autosize ) {
12
+ plotProps . isVisible = false ;
13
+ }
14
+ }
15
+
16
+ render ( ) {
17
+ return < Numeric { ...this . props } /> ;
18
+ }
19
+ }
20
+
21
+ CanvasSize . propTypes = {
22
+ ...Numeric . propTypes ,
23
+ } ;
24
+
25
+ export default connectToContainer ( CanvasSize ) ;
Original file line number Diff line number Diff line change 1
1
import AxesRange from './AxesRange' ;
2
2
import AxesSelector from './AxesSelector' ;
3
+ import CanvasSize from './CanvasSize' ;
3
4
import ColorPicker from './Color' ;
4
5
import Dropdown from './Dropdown' ;
5
6
import Flaglist from './Flaglist' ;
@@ -13,6 +14,7 @@ import TraceSelector from './TraceSelector';
13
14
export {
14
15
AxesRange ,
15
16
AxesSelector ,
17
+ CanvasSize ,
16
18
ColorPicker ,
17
19
Dropdown ,
18
20
Flaglist ,
Original file line number Diff line number Diff line change 1
1
import {
2
2
AxesRange ,
3
3
AxesSelector ,
4
+ CanvasSize ,
4
5
ColorPicker ,
5
6
Dropdown ,
6
7
Flaglist ,
@@ -26,6 +27,7 @@ export {
26
27
AxesSelector ,
27
28
AxesRange ,
28
29
MenuPanel ,
30
+ CanvasSize ,
29
31
ColorPicker ,
30
32
DataSelector ,
31
33
Dropdown ,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {EDITOR_ACTIONS} from './constants';
12
12
import {
13
13
AxesRange ,
14
14
AxesSelector ,
15
+ CanvasSize ,
15
16
ColorPicker ,
16
17
DataSelector ,
17
18
Dropdown ,
@@ -35,6 +36,7 @@ export {
35
36
AxesRange ,
36
37
AxesSelector ,
37
38
MenuPanel ,
39
+ CanvasSize ,
38
40
ColorPicker ,
39
41
DataSelector ,
40
42
Dropdown ,
You can’t perform that action at this time.
0 commit comments