@pie-lib/graphing 2.6.3 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/lib/axis/arrow.js +15 -25
  3. package/lib/axis/arrow.js.map +1 -1
  4. package/lib/axis/axes.js +41 -73
  5. package/lib/axis/axes.js.map +1 -1
  6. package/lib/axis/index.js +1 -1
  7. package/lib/bg.js +20 -31
  8. package/lib/bg.js.map +1 -1
  9. package/lib/container/index.js +27 -41
  10. package/lib/container/index.js.map +1 -1
  11. package/lib/container/reducer.js +2 -2
  12. package/lib/container/reducer.js.map +1 -1
  13. package/lib/coordinates-label.js +5 -5
  14. package/lib/coordinates-label.js.map +1 -1
  15. package/lib/graph-with-controls.js +116 -55
  16. package/lib/graph-with-controls.js.map +1 -1
  17. package/lib/graph.js +45 -69
  18. package/lib/graph.js.map +1 -1
  19. package/lib/grid-setup.js +72 -27
  20. package/lib/grid-setup.js.map +1 -1
  21. package/lib/grid.js +28 -46
  22. package/lib/grid.js.map +1 -1
  23. package/lib/index.js +3 -3
  24. package/lib/index.js.map +1 -1
  25. package/lib/labels.js +22 -38
  26. package/lib/labels.js.map +1 -1
  27. package/lib/mark-label.js +10 -20
  28. package/lib/mark-label.js.map +1 -1
  29. package/lib/toggle-bar.js +177 -45
  30. package/lib/toggle-bar.js.map +1 -1
  31. package/lib/tool-menu.js +49 -32
  32. package/lib/tool-menu.js.map +1 -1
  33. package/lib/tools/circle/bg-circle.js +27 -38
  34. package/lib/tools/circle/bg-circle.js.map +1 -1
  35. package/lib/tools/circle/component.js +36 -54
  36. package/lib/tools/circle/component.js.map +1 -1
  37. package/lib/tools/circle/index.js +5 -5
  38. package/lib/tools/circle/index.js.map +1 -1
  39. package/lib/tools/line/component.js +11 -25
  40. package/lib/tools/line/component.js.map +1 -1
  41. package/lib/tools/line/index.js +2 -2
  42. package/lib/tools/line/index.js.map +1 -1
  43. package/lib/tools/parabola/component.js +2 -2
  44. package/lib/tools/parabola/component.js.map +1 -1
  45. package/lib/tools/parabola/index.js +5 -5
  46. package/lib/tools/parabola/index.js.map +1 -1
  47. package/lib/tools/point/component.js +30 -47
  48. package/lib/tools/point/component.js.map +1 -1
  49. package/lib/tools/point/index.js +5 -5
  50. package/lib/tools/point/index.js.map +1 -1
  51. package/lib/tools/polygon/component.js +59 -107
  52. package/lib/tools/polygon/component.js.map +1 -1
  53. package/lib/tools/polygon/index.js +9 -19
  54. package/lib/tools/polygon/index.js.map +1 -1
  55. package/lib/tools/polygon/line.js +28 -41
  56. package/lib/tools/polygon/line.js.map +1 -1
  57. package/lib/tools/polygon/polygon.js +28 -42
  58. package/lib/tools/polygon/polygon.js.map +1 -1
  59. package/lib/tools/ray/component.js +11 -25
  60. package/lib/tools/ray/component.js.map +1 -1
  61. package/lib/tools/ray/index.js +2 -2
  62. package/lib/tools/ray/index.js.map +1 -1
  63. package/lib/tools/segment/component.js +8 -11
  64. package/lib/tools/segment/component.js.map +1 -1
  65. package/lib/tools/segment/index.js +2 -2
  66. package/lib/tools/segment/index.js.map +1 -1
  67. package/lib/tools/shared/arrow-head.js +2 -2
  68. package/lib/tools/shared/arrow-head.js.map +1 -1
  69. package/lib/tools/shared/line/index.js +43 -66
  70. package/lib/tools/shared/line/index.js.map +1 -1
  71. package/lib/tools/shared/line/line-path.js +29 -42
  72. package/lib/tools/shared/line/line-path.js.map +1 -1
  73. package/lib/tools/shared/line/with-root-edge.js +12 -14
  74. package/lib/tools/shared/line/with-root-edge.js.map +1 -1
  75. package/lib/tools/shared/point/arrow-point.js +24 -39
  76. package/lib/tools/shared/point/arrow-point.js.map +1 -1
  77. package/lib/tools/shared/point/arrow.js +23 -37
  78. package/lib/tools/shared/point/arrow.js.map +1 -1
  79. package/lib/tools/shared/point/base-point.js +24 -38
  80. package/lib/tools/shared/point/base-point.js.map +1 -1
  81. package/lib/tools/shared/point/index.js +6 -6
  82. package/lib/tools/shared/point/index.js.map +1 -1
  83. package/lib/tools/shared/styles.js +7 -5
  84. package/lib/tools/shared/styles.js.map +1 -1
  85. package/lib/tools/shared/types.js +2 -2
  86. package/lib/tools/shared/types.js.map +1 -1
  87. package/lib/tools/sine/component.js +2 -2
  88. package/lib/tools/sine/component.js.map +1 -1
  89. package/lib/tools/sine/index.js +5 -5
  90. package/lib/tools/sine/index.js.map +1 -1
  91. package/lib/tools/vector/component.js +8 -11
  92. package/lib/tools/vector/component.js.map +1 -1
  93. package/lib/tools/vector/index.js +2 -2
  94. package/lib/tools/vector/index.js.map +1 -1
  95. package/lib/undo-redo.js +19 -31
  96. package/lib/undo-redo.js.map +1 -1
  97. package/lib/use-debounce.js +5 -13
  98. package/lib/use-debounce.js.map +1 -1
  99. package/lib/utils.js +2 -2
  100. package/lib/utils.js.map +1 -1
  101. package/package.json +4 -3
  102. package/src/graph-with-controls.jsx +100 -14
  103. package/src/graph.jsx +2 -0
  104. package/src/grid-setup.jsx +155 -88
  105. package/src/toggle-bar.jsx +143 -13
  106. package/src/tool-menu.jsx +15 -0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "2.6.3",
6
+ "version": "2.8.1",
7
7
  "description": "Graphing components",
8
8
  "keywords": [
9
9
  "react",
@@ -18,9 +18,10 @@
18
18
  "dependencies": {
19
19
  "@mapbox/point-geometry": "^0.1.0",
20
20
  "@material-ui/core": "^3.8.3",
21
+ "@pie-lib/drag": "^1.1.52",
21
22
  "@pie-lib/graphing-utils": "^1.1.20",
22
23
  "@pie-lib/plot": "^2.2.0",
23
- "@pie-lib/render-ui": "^4.12.9",
24
+ "@pie-lib/render-ui": "^4.13.1",
24
25
  "@vx/axis": "^0.0.189",
25
26
  "@vx/clip-path": "^0.0.189",
26
27
  "@vx/event": "^0.0.189",
@@ -43,6 +44,6 @@
43
44
  "peerDependencies": {
44
45
  "react": "^16.8.1"
45
46
  },
46
- "gitHead": "531a7f4895323a9d524cfb96f7e26a5f1ab9f7c1",
47
+ "gitHead": "856c051f8dcb735d955408ffcfe49f22f96729c9",
47
48
  "scripts": {}
48
49
  }
@@ -10,6 +10,13 @@ import ToolMenu from './tool-menu';
10
10
  import Graph, { graphPropTypes } from './graph';
11
11
  import UndoRedo from './undo-redo';
12
12
  import { allTools, toolsArr } from './tools';
13
+ import {
14
+ ExpansionPanel,
15
+ ExpansionPanelDetails,
16
+ ExpansionPanelSummary,
17
+ Typography
18
+ } from '@material-ui/core';
19
+ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
13
20
 
14
21
  export const setToolbarAvailability = toolbarTools =>
15
22
  toolsArr.map(tA => ({ ...tA, toolbar: !!toolbarTools.find(t => t === tA.type) })) || [];
@@ -25,6 +32,34 @@ export const filterByValidToolTypes = backgroundMarks =>
25
32
  export const filterByVisibleToolTypes = (toolbarTools, marks) =>
26
33
  marks.filter(bM => !!toolbarTools.find(tool => tool === bM.type));
27
34
 
35
+ const getDefaultCurrentTool = toolType => toolsArr.find(tool => tool.type === toolType) || null;
36
+
37
+ const Collapsible = ({ classes, children, title }) => (
38
+ <ExpansionPanel
39
+ elevation={0}
40
+ className={classes.expansionPanel}
41
+ disabledGutters={true}
42
+ square={true}
43
+ >
44
+ <ExpansionPanelSummary
45
+ classes={{
46
+ root: classes.summaryRoot,
47
+ content: classes.summaryContent
48
+ }}
49
+ expandIcon={<ExpandMoreIcon />}
50
+ >
51
+ <Typography variant="subheading">{title}</Typography>
52
+ </ExpansionPanelSummary>
53
+ <ExpansionPanelDetails className={classes.details}>{children}</ExpansionPanelDetails>
54
+ </ExpansionPanel>
55
+ );
56
+
57
+ Collapsible.propTypes = {
58
+ classes: PropTypes.object,
59
+ children: PropTypes.array,
60
+ title: PropTypes.string
61
+ };
62
+
28
63
  export class GraphWithControls extends React.Component {
29
64
  static propTypes = {
30
65
  ...graphPropTypes,
@@ -34,9 +69,30 @@ export class GraphWithControls extends React.Component {
34
69
  toolbarTools: PropTypes.arrayOf(PropTypes.string) // array of tool types that have to be displayed in the toolbar, same shape as 'allTools'
35
70
  };
36
71
 
37
- static defaultProps = { toolbarTools: [] };
72
+ static defaultProps = {
73
+ collapsibleToolbar: false,
74
+ collapsibleToolbarTitle: '',
75
+ toolbarTools: []
76
+ };
77
+
78
+ constructor(props) {
79
+ super(props);
80
+
81
+ this.state = {
82
+ currentTool: getDefaultCurrentTool(props.defaultTool),
83
+ labelModeEnabled: false
84
+ };
85
+ }
86
+
87
+ componentDidUpdate(prevProps) {
88
+ const { defaultTool } = this.props;
38
89
 
39
- state = { currentTool: null, labelModeEnabled: false };
90
+ if (prevProps.defaultTool !== defaultTool) {
91
+ const currentTool = getDefaultCurrentTool(defaultTool);
92
+
93
+ this.setState({ currentTool });
94
+ }
95
+ }
40
96
 
41
97
  changeCurrentTool = (tool, tools) =>
42
98
  this.setState({ currentTool: tools.find(t => t.type === tool) });
@@ -45,16 +101,19 @@ export class GraphWithControls extends React.Component {
45
101
 
46
102
  render() {
47
103
  let { currentTool, labelModeEnabled } = this.state;
48
-
49
104
  const {
50
105
  axesSettings,
51
106
  classes,
52
107
  className,
53
108
  coordinatesOnHover,
109
+ collapsibleToolbar,
110
+ collapsibleToolbarTitle,
54
111
  disabled,
55
112
  domain,
113
+ draggableTools,
56
114
  labels,
57
115
  onChangeMarks,
116
+ onChangeTools,
58
117
  onUndo,
59
118
  onRedo,
60
119
  onReset,
@@ -62,7 +121,6 @@ export class GraphWithControls extends React.Component {
62
121
  size,
63
122
  title
64
123
  } = this.props;
65
-
66
124
  let { backgroundMarks, marks, toolbarTools } = this.props;
67
125
 
68
126
  // make sure only valid tool types are kept (string) and without duplicates
@@ -81,19 +139,33 @@ export class GraphWithControls extends React.Component {
81
139
  currentTool = getAvailableTool(tools);
82
140
  }
83
141
 
142
+ const graphActions = (
143
+ <React.Fragment>
144
+ <ToolMenu
145
+ currentToolType={currentTool && currentTool.type}
146
+ disabled={!!disabled}
147
+ draggableTools={draggableTools}
148
+ labelModeEnabled={labelModeEnabled}
149
+ onChange={tool => this.changeCurrentTool(tool, tools)}
150
+ onToggleLabelMode={this.toggleLabelMode}
151
+ toolbarTools={toolbarTools}
152
+ onChangeTools={onChangeTools}
153
+ />
154
+
155
+ {!disabled && <UndoRedo onUndo={onUndo} onRedo={onRedo} onReset={onReset} />}
156
+ </React.Fragment>
157
+ );
158
+
84
159
  return (
85
160
  <div className={classNames(classes.graphWithControls, className)}>
86
161
  <div className={classes.controls}>
87
- <ToolMenu
88
- currentToolType={currentTool && currentTool.type}
89
- disabled={!!disabled}
90
- labelModeEnabled={labelModeEnabled}
91
- onChange={tool => this.changeCurrentTool(tool, tools)}
92
- onToggleLabelMode={this.toggleLabelMode}
93
- toolbarTools={toolbarTools}
94
- />
95
-
96
- {!disabled && <UndoRedo onUndo={onUndo} onRedo={onRedo} onReset={onReset} />}
162
+ {collapsibleToolbar ? (
163
+ <Collapsible classes={classes} title={collapsibleToolbarTitle}>
164
+ {graphActions}
165
+ </Collapsible>
166
+ ) : (
167
+ graphActions
168
+ )}
97
169
  </div>
98
170
 
99
171
  <div ref={r => (this.labelNode = r)} />
@@ -134,6 +206,20 @@ const styles = theme => ({
134
206
  '& button': {
135
207
  fontSize: theme.typography.fontSize
136
208
  }
209
+ },
210
+ expansionPanel: {
211
+ backgroundColor: color.primaryLight()
212
+ },
213
+ summaryRoot: {
214
+ padding: `0 ${theme.spacing.unit}px`,
215
+ minHeight: '32px !important'
216
+ },
217
+ summaryContent: {
218
+ margin: '4px 0 !important'
219
+ },
220
+ details: {
221
+ padding: 0,
222
+ marginTop: theme.spacing.unit
137
223
  }
138
224
  });
139
225
 
package/src/graph.jsx CHANGED
@@ -18,6 +18,8 @@ export const graphPropTypes = {
18
18
  axesSettings: PropTypes.shape(AxisPropTypes),
19
19
  backgroundMarks: PropTypes.array,
20
20
  className: PropTypes.string,
21
+ collapsibleToolbar: PropTypes.bool,
22
+ collapsibleToolbarTitle: PropTypes.string,
21
23
  domain: types.DomainType,
22
24
  labels: PropTypes.shape(LabelType),
23
25
  labelModeEnabled: PropTypes.bool,
@@ -11,34 +11,59 @@ import { NumberTextFieldCustom, Toggle } from '@pie-lib/config-ui';
11
11
  import EditableHTML from '@pie-lib/editable-html';
12
12
 
13
13
  const GridConfig = props => {
14
- const { classes, disabled, labelValue, labelValues, gridValue, gridValues, onChange } = props;
14
+ const {
15
+ classes,
16
+ disabled,
17
+ displayedFields,
18
+ labelValue,
19
+ labelValues,
20
+ gridValue,
21
+ gridValues,
22
+ onChange
23
+ } = props;
24
+ const { labelStep = {}, step = {} } = displayedFields;
15
25
 
16
26
  return (
17
27
  <div className={classes.columnView}>
18
- <NumberTextFieldCustom
19
- className={classes.mediumTextField}
20
- label="Grid Interval"
21
- value={gridValue}
22
- customValues={gridValues}
23
- variant="outlined"
24
- disabled={disabled}
25
- onChange={(e, v) => onChange('step', v)}
26
- />
27
- <NumberTextFieldCustom
28
- className={classes.mediumTextField}
29
- label="Label Interval"
30
- value={labelValue}
31
- customValues={labelValues}
32
- variant="outlined"
33
- disabled={disabled}
34
- onChange={(e, v) => onChange('labelStep', v)}
35
- />
28
+ {step && step.enabled && (
29
+ <NumberTextFieldCustom
30
+ className={classes.mediumTextField}
31
+ label={step.label || ''}
32
+ value={gridValue}
33
+ customValues={gridValues}
34
+ variant="outlined"
35
+ disabled={disabled}
36
+ onChange={(e, v) => onChange('step', v)}
37
+ />
38
+ )}
39
+ {labelStep && labelStep.enabled && (
40
+ <NumberTextFieldCustom
41
+ className={classes.mediumTextField}
42
+ label={labelStep.label || ''}
43
+ value={labelValue}
44
+ customValues={labelValues}
45
+ variant="outlined"
46
+ disabled={disabled}
47
+ onChange={(e, v) => onChange('labelStep', v)}
48
+ />
49
+ )}
36
50
  </div>
37
51
  );
38
52
  };
39
53
 
40
54
  const AxisConfig = props => {
41
- const { classes, disabled, label, maxValue, minValue, onChange, type } = props;
55
+ const {
56
+ classes,
57
+ disabled,
58
+ displayedFields,
59
+ displayHeader,
60
+ label,
61
+ maxValue,
62
+ minValue,
63
+ onChange,
64
+ type
65
+ } = props;
66
+ const { axisLabel = {}, min = {}, max = {} } = displayedFields;
42
67
  const activePlugins = [
43
68
  'bold',
44
69
  'italic',
@@ -49,39 +74,47 @@ const AxisConfig = props => {
49
74
 
50
75
  return (
51
76
  <div className={classes.columnView}>
52
- <Typography variant="subtitle2">
53
- <i>{type === 'domain' ? 'x' : 'y'}</i>
54
- -axis
55
- </Typography>
56
- <NumberTextFieldCustom
57
- className={classes.mediumTextField}
58
- label="Min Value"
59
- value={minValue}
60
- min={-10000}
61
- max={maxValue - 0.01}
62
- variant="outlined"
63
- disabled={disabled}
64
- onChange={(e, v) => onChange('min', v)}
65
- />
66
- <NumberTextFieldCustom
67
- className={classes.mediumTextField}
68
- label="Max Value"
69
- value={maxValue}
70
- min={minValue + 0.01}
71
- max={10000}
72
- variant="outlined"
73
- disabled={disabled}
74
- onChange={(e, v) => onChange('max', v)}
75
- />
76
- <InputContainer label="Label" className={classes.mediumTextField}>
77
- <EditableHTML
78
- className={classes.axisLabel}
79
- onChange={value => onChange('axisLabel', value)}
80
- markup={label || ''}
81
- charactersLimit={5}
82
- activePlugins={activePlugins}
77
+ {displayHeader && (
78
+ <Typography variant="subtitle2">
79
+ <i>{type === 'domain' ? 'x' : 'y'}</i>
80
+ -axis
81
+ </Typography>
82
+ )}
83
+ {min && min.enabled && (
84
+ <NumberTextFieldCustom
85
+ className={classes.mediumTextField}
86
+ label={min.label || ''}
87
+ value={minValue}
88
+ min={-10000}
89
+ max={maxValue - 0.01}
90
+ variant="outlined"
91
+ disabled={disabled}
92
+ onChange={(e, v) => onChange('min', v)}
93
+ />
94
+ )}
95
+ {max && max.enabled && (
96
+ <NumberTextFieldCustom
97
+ className={classes.mediumTextField}
98
+ label={max.label || ''}
99
+ value={maxValue}
100
+ min={minValue + 0.01}
101
+ max={10000}
102
+ variant="outlined"
103
+ disabled={disabled}
104
+ onChange={(e, v) => onChange('max', v)}
83
105
  />
84
- </InputContainer>
106
+ )}
107
+ {axisLabel && axisLabel.enabled && (
108
+ <InputContainer label={axisLabel.label || ''} className={classes.mediumTextField}>
109
+ <EditableHTML
110
+ className={classes.axisLabel}
111
+ onChange={value => onChange('axisLabel', value)}
112
+ markup={label || ''}
113
+ charactersLimit={5}
114
+ activePlugins={activePlugins}
115
+ />
116
+ </InputContainer>
117
+ )}
85
118
  </div>
86
119
  );
87
120
  };
@@ -90,7 +123,7 @@ const GridSetup = props => {
90
123
  const {
91
124
  classes,
92
125
  domain,
93
- dimensionsEnabled,
126
+ displayedFields = {},
94
127
  gridValues = {},
95
128
  includeAxes,
96
129
  labelValues = {},
@@ -101,6 +134,20 @@ const GridSetup = props => {
101
134
  standardGrid
102
135
  } = props;
103
136
  const gridProps = { min: 2, max: 41 };
137
+ const {
138
+ axisLabel = {},
139
+ dimensionsEnabled,
140
+ includeAxesEnabled,
141
+ labelStep = {},
142
+ min = {},
143
+ max = {},
144
+ standardGridEnabled,
145
+ step = {}
146
+ } = displayedFields || {};
147
+ const displayAxisType =
148
+ min.enabled || max.enabled || axisLabel.enabled || step.enabled || labelStep.enabled;
149
+ const gridConfigFields = { step, labelStep };
150
+ const axisConfigFields = { min, max, axisLabel };
104
151
 
105
152
  const onIncludeAxes = includeAxes => {
106
153
  const noAxesConfig = type => {
@@ -171,6 +218,8 @@ const GridSetup = props => {
171
218
  <div className={classes.rowView}>
172
219
  <AxisConfig
173
220
  classes={classes}
221
+ displayedFields={axisConfigFields}
222
+ displayHeader={displayAxisType}
174
223
  type="domain"
175
224
  minValue={domain.min}
176
225
  maxValue={domain.max}
@@ -180,6 +229,8 @@ const GridSetup = props => {
180
229
  />
181
230
  <AxisConfig
182
231
  classes={classes}
232
+ displayedFields={axisConfigFields}
233
+ displayHeader={displayAxisType}
183
234
  type="range"
184
235
  minValue={range.min}
185
236
  maxValue={range.max}
@@ -189,36 +240,44 @@ const GridSetup = props => {
189
240
  onChange={onRangeChanged}
190
241
  />
191
242
  </div>
192
- <Typography className={classes.text}>
193
- If you want the axis to be visible, use a zero or negative Min Value, and a positive Max
194
- Value
195
- </Typography>
196
- <div className={classes.rowView}>
197
- <GridConfig
198
- classes={classes}
199
- gridValue={domain.step}
200
- labelValue={domain.labelStep}
201
- gridValues={gridValues.domain || []}
202
- labelValues={labelValues.domain || []}
203
- onChange={onDomainChanged}
204
- />
205
- <GridConfig
206
- classes={classes}
207
- disabled={standardGrid}
208
- gridValue={range.step}
209
- labelValue={range.labelStep}
210
- gridValues={gridValues.range || []}
211
- labelValues={labelValues.range || []}
212
- onChange={onRangeChanged}
213
- />
214
- </div>
215
- <Typography className={classes.text}>
216
- For unnumbered gridlines, enter a label interval of 0
217
- </Typography>
243
+ {(min.enabled || max.enabled) && (
244
+ <Typography className={classes.text}>
245
+ If you want the axis to be visible, use a zero or negative Min Value, and a positive Max
246
+ Value
247
+ </Typography>
248
+ )}
249
+ {(step.enabled || labelStep.enabled) && (
250
+ <div className={classes.rowView}>
251
+ <GridConfig
252
+ classes={classes}
253
+ displayedFields={gridConfigFields}
254
+ gridValue={domain.step}
255
+ labelValue={domain.labelStep}
256
+ gridValues={gridValues.domain || []}
257
+ labelValues={labelValues.domain || []}
258
+ onChange={onDomainChanged}
259
+ />
260
+ <GridConfig
261
+ classes={classes}
262
+ disabled={standardGrid}
263
+ displayedFields={gridConfigFields}
264
+ gridValue={range.step}
265
+ labelValue={range.labelStep}
266
+ gridValues={gridValues.range || []}
267
+ labelValues={labelValues.range || []}
268
+ onChange={onRangeChanged}
269
+ />
270
+ </div>
271
+ )}
272
+ {labelStep.enabled && (
273
+ <Typography className={classes.text}>
274
+ For unnumbered gridlines, enter a label interval of 0
275
+ </Typography>
276
+ )}
218
277
  </React.Fragment>
219
278
  );
220
279
 
221
- const gridlinesConfig = (
280
+ const gridlinesConfig = max.enabled ? (
222
281
  <div className={classes.columnView}>
223
282
  <NumberTextFieldCustom
224
283
  className={classes.largeTextField}
@@ -240,7 +299,7 @@ const GridSetup = props => {
240
299
  onChange={(e, v) => onRangeChanged('max', v)}
241
300
  />
242
301
  </div>
243
- );
302
+ ) : null;
244
303
 
245
304
  return (
246
305
  <div className={classes.wrapper}>
@@ -250,12 +309,20 @@ const GridSetup = props => {
250
309
  </ExpansionPanelSummary>
251
310
  <ExpansionPanelDetails>
252
311
  <div className={classes.content}>
253
- <Toggle label="Include axes and labels?" toggle={onIncludeAxes} checked={includeAxes} />
254
- <Toggle
255
- label="Constrain to standard coordinate grid?"
256
- toggle={onStandardGridChanged}
257
- checked={standardGrid}
258
- />
312
+ {includeAxesEnabled && (
313
+ <Toggle
314
+ label="Include axes and labels?"
315
+ toggle={onIncludeAxes}
316
+ checked={includeAxes}
317
+ />
318
+ )}
319
+ {standardGridEnabled && (
320
+ <Toggle
321
+ label="Constrain to standard coordinate grid?"
322
+ toggle={onStandardGridChanged}
323
+ checked={standardGrid}
324
+ />
325
+ )}
259
326
  {includeAxes ? axesConfig : gridlinesConfig}
260
327
  {dimensionsEnabled && (
261
328
  <div className={classes.dimensions}>
@@ -298,7 +365,7 @@ const GridSetup = props => {
298
365
  GridSetup.propTypes = {
299
366
  classes: PropTypes.object,
300
367
  domain: PropTypes.object,
301
- dimensionsEnabled: PropTypes.object,
368
+ displayedFields: PropTypes.object,
302
369
  gridValues: PropTypes.object,
303
370
  includeAxes: PropTypes.bool,
304
371
  labelValues: PropTypes.object,