@pie-lib/graphing 2.6.2 → 2.8.0

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 (107) 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 +109 -50
  20. package/lib/grid-setup.js.map +1 -1
  21. package/lib/grid.js +28 -53
  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 +178 -91
  105. package/src/grid.jsx +0 -7
  106. package/src/toggle-bar.jsx +143 -13
  107. 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.2",
6
+ "version": "2.8.0",
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.8",
24
+ "@pie-lib/render-ui": "^4.13.0",
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": "debcaf764c62d97a1401f2898b062183847ce33b",
47
+ "gitHead": "f766e0fdb9e51a9449324db51ccaa93904211710",
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,
@@ -1,78 +1,120 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { color } from '@pie-lib/render-ui';
3
+ import { color, InputContainer } from '@pie-lib/render-ui';
4
4
  import { withStyles } from '@material-ui/core/styles';
5
5
  import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
6
6
  import Typography from '@material-ui/core/Typography';
7
7
  import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails';
8
8
  import ExpansionPanel from '@material-ui/core/ExpansionPanel';
9
9
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
10
- import TextField from '@material-ui/core/TextField';
11
10
  import { NumberTextFieldCustom, Toggle } from '@pie-lib/config-ui';
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.textField}
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.textField}
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;
67
+ const activePlugins = [
68
+ 'bold',
69
+ 'italic',
70
+ 'underline',
71
+ 'strikethrough'
72
+ // 'languageCharacters'
73
+ ];
42
74
 
43
75
  return (
44
76
  <div className={classes.columnView}>
45
- <Typography variant="subtitle2">
46
- <i>{type === 'domain' ? 'x' : 'y'}</i>
47
- -axis
48
- </Typography>
49
- <NumberTextFieldCustom
50
- className={classes.textField}
51
- label="Min Value"
52
- value={minValue}
53
- variant="outlined"
54
- disabled={disabled}
55
- onChange={(e, v) => onChange('min', v)}
56
- />
57
- <NumberTextFieldCustom
58
- className={classes.textField}
59
- label="Max Value"
60
- value={maxValue}
61
- variant="outlined"
62
- disabled={disabled}
63
- onChange={(e, v) => onChange('max', v)}
64
- />
65
- <TextField
66
- label="Label"
67
- value={label}
68
- inputProps={{
69
- maxLength: 5,
70
- style: { textAlign: 'center' }
71
- }}
72
- variant="outlined"
73
- className={classes.textField}
74
- onChange={e => onChange('axisLabel', e.target.value)}
75
- />
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)}
105
+ />
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
+ )}
76
118
  </div>
77
119
  );
78
120
  };
@@ -80,18 +122,32 @@ const AxisConfig = props => {
80
122
  const GridSetup = props => {
81
123
  const {
82
124
  classes,
83
- sizeConstraints,
84
125
  domain,
85
- dimensionsEnabled,
86
- gridValues,
126
+ displayedFields = {},
127
+ gridValues = {},
87
128
  includeAxes,
88
- labelValues,
129
+ labelValues = {},
89
130
  onChange,
90
131
  range,
91
132
  size,
133
+ sizeConstraints,
92
134
  standardGrid
93
135
  } = props;
94
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 };
95
151
 
96
152
  const onIncludeAxes = includeAxes => {
97
153
  const noAxesConfig = type => {
@@ -162,6 +218,8 @@ const GridSetup = props => {
162
218
  <div className={classes.rowView}>
163
219
  <AxisConfig
164
220
  classes={classes}
221
+ displayedFields={axisConfigFields}
222
+ displayHeader={displayAxisType}
165
223
  type="domain"
166
224
  minValue={domain.min}
167
225
  maxValue={domain.max}
@@ -171,6 +229,8 @@ const GridSetup = props => {
171
229
  />
172
230
  <AxisConfig
173
231
  classes={classes}
232
+ displayedFields={axisConfigFields}
233
+ displayHeader={displayAxisType}
174
234
  type="range"
175
235
  minValue={range.min}
176
236
  maxValue={range.max}
@@ -180,34 +240,44 @@ const GridSetup = props => {
180
240
  onChange={onRangeChanged}
181
241
  />
182
242
  </div>
183
- <Typography className={classes.text}>
184
- If you want the axis to be visible, use a zero or negative Min Value, and a positive Max
185
- Value
186
- </Typography>
187
- <div className={classes.rowView}>
188
- <GridConfig
189
- classes={classes}
190
- gridValue={domain.step}
191
- labelValue={domain.labelStep}
192
- gridValues={gridValues}
193
- labelValues={labelValues}
194
- onChange={onDomainChanged}
195
- />
196
- <GridConfig
197
- classes={classes}
198
- disabled={standardGrid}
199
- gridValue={range.step}
200
- labelValue={range.labelStep}
201
- onChange={onRangeChanged}
202
- />
203
- </div>
204
- <Typography className={classes.text}>
205
- For unnumbered gridlines, enter a label interval of 0
206
- </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
+ )}
207
277
  </React.Fragment>
208
278
  );
209
279
 
210
- const gridlinesConfig = (
280
+ const gridlinesConfig = max.enabled ? (
211
281
  <div className={classes.columnView}>
212
282
  <NumberTextFieldCustom
213
283
  className={classes.largeTextField}
@@ -229,7 +299,7 @@ const GridSetup = props => {
229
299
  onChange={(e, v) => onRangeChanged('max', v)}
230
300
  />
231
301
  </div>
232
- );
302
+ ) : null;
233
303
 
234
304
  return (
235
305
  <div className={classes.wrapper}>
@@ -239,18 +309,28 @@ const GridSetup = props => {
239
309
  </ExpansionPanelSummary>
240
310
  <ExpansionPanelDetails>
241
311
  <div className={classes.content}>
242
- <Toggle label="Include axes and labels?" toggle={onIncludeAxes} checked={includeAxes} />
243
- <Toggle
244
- label="Constrain to standard coordinate grid?"
245
- toggle={onStandardGridChanged}
246
- checked={standardGrid}
247
- />
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
+ )}
248
326
  {includeAxes ? axesConfig : gridlinesConfig}
249
327
  {dimensionsEnabled && (
250
328
  <div className={classes.dimensions}>
251
329
  <div>
252
330
  <Typography>Dimensions(px)</Typography>
253
- <Typography className={classes.disabled}>Min 150, Max 700</Typography>
331
+ <Typography className={classes.disabled}>
332
+ Min {sizeConstraints.min}, Max {sizeConstraints.max}
333
+ </Typography>
254
334
  </div>
255
335
  <NumberTextFieldCustom
256
336
  className={classes.textField}
@@ -285,7 +365,7 @@ const GridSetup = props => {
285
365
  GridSetup.propTypes = {
286
366
  classes: PropTypes.object,
287
367
  domain: PropTypes.object,
288
- dimensionsEnabled: PropTypes.object,
368
+ displayedFields: PropTypes.object,
289
369
  gridValues: PropTypes.object,
290
370
  includeAxes: PropTypes.bool,
291
371
  labelValues: PropTypes.object,
@@ -319,6 +399,10 @@ const styles = theme => ({
319
399
  width: '130px',
320
400
  margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`
321
401
  },
402
+ mediumTextField: {
403
+ width: '160px',
404
+ margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`
405
+ },
322
406
  largeTextField: {
323
407
  width: '230px',
324
408
  margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`
@@ -334,6 +418,9 @@ const styles = theme => ({
334
418
  },
335
419
  disabled: {
336
420
  color: color.disabled()
421
+ },
422
+ axisLabel: {
423
+ paddingTop: theme.spacing.unit * 2
337
424
  }
338
425
  });
339
426
 
package/src/grid.jsx CHANGED
@@ -14,13 +14,6 @@ export class Grid extends React.Component {
14
14
  graphProps: types.GraphPropsType.isRequired
15
15
  };
16
16
 
17
- shouldComponentUpdate(nextProps) {
18
- const { graphProps } = this.props;
19
- const { graphProps: nextGraphProps } = nextProps;
20
-
21
- return !utils.isDomainRangeEqual(graphProps, nextGraphProps);
22
- }
23
-
24
17
  getAdditionalGridProps = (rowTickValues, columnTickValues) => {
25
18
  const {
26
19
  graphProps: {