@pie-lib/charting 5.36.1 → 5.37.0-mui-update.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.
- package/CHANGELOG.md +14 -20
- package/lib/actions-button.js +60 -90
- package/lib/actions-button.js.map +1 -1
- package/lib/axes.js +154 -234
- package/lib/axes.js.map +1 -1
- package/lib/bars/bar.js +13 -41
- package/lib/bars/bar.js.map +1 -1
- package/lib/bars/common/bars.js +55 -126
- package/lib/bars/common/bars.js.map +1 -1
- package/lib/bars/common/correct-check-icon.js +1 -6
- package/lib/bars/common/correct-check-icon.js.map +1 -1
- package/lib/bars/histogram.js +13 -41
- package/lib/bars/histogram.js.map +1 -1
- package/lib/chart-setup.js +110 -184
- package/lib/chart-setup.js.map +1 -1
- package/lib/chart-type.js +29 -38
- package/lib/chart-type.js.map +1 -1
- package/lib/chart-types.js +1 -10
- package/lib/chart-types.js.map +1 -1
- package/lib/chart.js +74 -146
- package/lib/chart.js.map +1 -1
- package/lib/common/correctness-indicators.js +74 -52
- package/lib/common/correctness-indicators.js.map +1 -1
- package/lib/common/drag-handle.js +67 -105
- package/lib/common/drag-handle.js.map +1 -1
- package/lib/common/drag-icon.js +6 -12
- package/lib/common/drag-icon.js.map +1 -1
- package/lib/common/styles.js +6 -24
- package/lib/common/styles.js.map +1 -1
- package/lib/grid.js +44 -81
- package/lib/grid.js.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/lib/key-legend.js +63 -87
- package/lib/key-legend.js.map +1 -1
- package/lib/line/common/drag-handle.js +69 -100
- package/lib/line/common/drag-handle.js.map +1 -1
- package/lib/line/common/line.js +44 -92
- package/lib/line/common/line.js.map +1 -1
- package/lib/line/line-cross.js +77 -87
- package/lib/line/line-cross.js.map +1 -1
- package/lib/line/line-dot.js +66 -78
- package/lib/line/line-dot.js.map +1 -1
- package/lib/mark-label.js +75 -117
- package/lib/mark-label.js.map +1 -1
- package/lib/plot/common/plot.js +76 -144
- package/lib/plot/common/plot.js.map +1 -1
- package/lib/plot/dot.js +31 -57
- package/lib/plot/dot.js.map +1 -1
- package/lib/plot/line.js +37 -62
- package/lib/plot/line.js.map +1 -1
- package/lib/tool-menu.js +48 -80
- package/lib/tool-menu.js.map +1 -1
- package/lib/utils.js +20 -77
- package/lib/utils.js.map +1 -1
- package/package.json +12 -9
- package/src/actions-button.jsx +44 -39
- package/src/axes.jsx +61 -75
- package/src/bars/common/bars.jsx +8 -23
- package/src/chart-setup.jsx +68 -78
- package/src/chart-type.js +26 -21
- package/src/chart.jsx +8 -20
- package/src/common/correctness-indicators.jsx +51 -13
- package/src/common/drag-handle.jsx +44 -59
- package/src/common/drag-icon.jsx +2 -2
- package/src/common/styles.js +1 -1
- package/src/grid.jsx +9 -13
- package/src/key-legend.jsx +62 -60
- package/src/line/common/drag-handle.jsx +57 -55
- package/src/line/common/line.jsx +17 -8
- package/src/line/line-cross.js +37 -12
- package/src/line/line-dot.js +30 -11
- package/src/mark-label.jsx +43 -44
- package/src/plot/common/plot.jsx +17 -22
- package/src/plot/dot.js +10 -3
- package/src/plot/line.js +14 -6
- package/src/tool-menu.jsx +20 -23
package/src/axes.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { AxisLeft, AxisBottom } from '@vx/axis';
|
|
5
|
-
import Checkbox from '@material
|
|
5
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
6
6
|
|
|
7
7
|
import { types } from '@pie-lib/plot';
|
|
8
8
|
import { color } from '@pie-lib/render-ui';
|
|
@@ -13,6 +13,51 @@ import { TickCorrectnessIndicator } from './common/correctness-indicators';
|
|
|
13
13
|
import { bandKey, getTickValues, getRotateAngle } from './utils';
|
|
14
14
|
import MarkLabel from './mark-label';
|
|
15
15
|
|
|
16
|
+
const StyledErrorText = styled('text')(({ theme }) => ({
|
|
17
|
+
fontSize: theme.typography.fontSize - 2,
|
|
18
|
+
fill: theme.palette.error.main,
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const StyledCheckbox = styled(Checkbox)(() => ({
|
|
22
|
+
color: `${color.tertiary()} !important`,
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const StyledAxesGroup = styled('g')(({ theme }) => ({
|
|
26
|
+
'& .vx-axis-line': {
|
|
27
|
+
stroke: color.visualElementsColors.AXIS_LINE_COLOR,
|
|
28
|
+
strokeWidth: 2,
|
|
29
|
+
},
|
|
30
|
+
'& .vx-axis-tick': {
|
|
31
|
+
fill: color.visualElementsColors.AXIS_TICK_COLOR,
|
|
32
|
+
'& line': {
|
|
33
|
+
stroke: color.visualElementsColors.AXIS_TICK_COLOR,
|
|
34
|
+
strokeWidth: 2,
|
|
35
|
+
},
|
|
36
|
+
fontFamily: theme.typography.body1?.fontFamily,
|
|
37
|
+
fontSize: theme.typography.fontSize,
|
|
38
|
+
textAnchor: 'middle',
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
const correctnessIconStyles = (theme) => ({
|
|
43
|
+
borderRadius: theme.spacing(2),
|
|
44
|
+
color: color.defaults.WHITE,
|
|
45
|
+
fontSize: '16px',
|
|
46
|
+
width: '16px',
|
|
47
|
+
height: '16px',
|
|
48
|
+
padding: '2px',
|
|
49
|
+
border: `1px solid ${color.defaults.WHITE}`,
|
|
50
|
+
boxSizing: 'unset', // to override the default border-box in IBX
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const incorrectIconStyles = {
|
|
54
|
+
backgroundColor: color.incorrectWithIcon(),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const correctIconStyles = {
|
|
58
|
+
backgroundColor: color.correct(),
|
|
59
|
+
};
|
|
60
|
+
|
|
16
61
|
export class TickComponent extends React.Component {
|
|
17
62
|
static propTypes = {
|
|
18
63
|
defineChart: PropTypes.bool,
|
|
@@ -112,7 +157,6 @@ export class TickComponent extends React.Component {
|
|
|
112
157
|
|
|
113
158
|
render() {
|
|
114
159
|
const {
|
|
115
|
-
classes,
|
|
116
160
|
categories,
|
|
117
161
|
xBand,
|
|
118
162
|
bandWidth,
|
|
@@ -137,6 +181,13 @@ export class TickComponent extends React.Component {
|
|
|
137
181
|
return null;
|
|
138
182
|
}
|
|
139
183
|
|
|
184
|
+
// Create classes object for TickCorrectnessIndicator compatibility
|
|
185
|
+
const classes = {
|
|
186
|
+
correctnessIcon: correctnessIconStyles,
|
|
187
|
+
incorrectIcon: incorrectIconStyles,
|
|
188
|
+
correctIcon: correctIconStyles,
|
|
189
|
+
};
|
|
190
|
+
|
|
140
191
|
const { dialog } = this.state;
|
|
141
192
|
const { changeEditable, changeInteractive } = chartingOptions || {};
|
|
142
193
|
const index = parseInt(formattedValue.split('-')[0], 10);
|
|
@@ -193,9 +244,9 @@ export class TickComponent extends React.Component {
|
|
|
193
244
|
</foreignObject>
|
|
194
245
|
|
|
195
246
|
{error && index === 0 && (
|
|
196
|
-
<
|
|
247
|
+
<StyledErrorText y={y + 23} height={6} textAnchor="start">
|
|
197
248
|
{distinctMessages}
|
|
198
|
-
</
|
|
249
|
+
</StyledErrorText>
|
|
199
250
|
)}
|
|
200
251
|
|
|
201
252
|
{defineChart && index === 0 && (
|
|
@@ -257,8 +308,7 @@ export class TickComponent extends React.Component {
|
|
|
257
308
|
height={4}
|
|
258
309
|
style={{ pointerEvents: 'visible', overflow: 'visible' }}
|
|
259
310
|
>
|
|
260
|
-
<
|
|
261
|
-
className={classes.customColor}
|
|
311
|
+
<StyledCheckbox
|
|
262
312
|
style={{ position: 'fixed' }}
|
|
263
313
|
checked={interactive}
|
|
264
314
|
onChange={(e) => this.changeInteractive(index, e.target.checked)}
|
|
@@ -274,8 +324,7 @@ export class TickComponent extends React.Component {
|
|
|
274
324
|
height={4}
|
|
275
325
|
style={{ pointerEvents: 'visible', overflow: 'visible' }}
|
|
276
326
|
>
|
|
277
|
-
<
|
|
278
|
-
className={classes.customColor}
|
|
327
|
+
<StyledCheckbox
|
|
279
328
|
style={{ position: 'fixed' }}
|
|
280
329
|
checked={editable}
|
|
281
330
|
onChange={(e) => this.changeEditable(index, e.target.checked)}
|
|
@@ -316,7 +365,6 @@ TickComponent.propTypes = {
|
|
|
316
365
|
formattedValue: PropTypes.string,
|
|
317
366
|
onChangeCategory: PropTypes.func,
|
|
318
367
|
onChange: PropTypes.func,
|
|
319
|
-
classes: PropTypes.object,
|
|
320
368
|
error: PropTypes.object,
|
|
321
369
|
defineChart: PropTypes.bool,
|
|
322
370
|
chartingOptions: PropTypes.object,
|
|
@@ -330,7 +378,6 @@ TickComponent.propTypes = {
|
|
|
330
378
|
export class RawChartAxes extends React.Component {
|
|
331
379
|
static propTypes = {
|
|
332
380
|
bottomScale: PropTypes.func,
|
|
333
|
-
classes: PropTypes.object.isRequired,
|
|
334
381
|
categories: PropTypes.array,
|
|
335
382
|
defineChart: PropTypes.bool,
|
|
336
383
|
error: PropTypes.any,
|
|
@@ -386,7 +433,6 @@ export class RawChartAxes extends React.Component {
|
|
|
386
433
|
|
|
387
434
|
render() {
|
|
388
435
|
const {
|
|
389
|
-
classes,
|
|
390
436
|
graphProps,
|
|
391
437
|
xBand,
|
|
392
438
|
leftAxis,
|
|
@@ -405,7 +451,6 @@ export class RawChartAxes extends React.Component {
|
|
|
405
451
|
showCorrectness,
|
|
406
452
|
} = this.props;
|
|
407
453
|
|
|
408
|
-
const { axis, axisLine, tick } = classes;
|
|
409
454
|
const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};
|
|
410
455
|
const { height, width } = this.state;
|
|
411
456
|
|
|
@@ -432,7 +477,6 @@ export class RawChartAxes extends React.Component {
|
|
|
432
477
|
hiddenLabelRef: (ref) => {
|
|
433
478
|
this.hiddenLabelRef = ref;
|
|
434
479
|
},
|
|
435
|
-
classes,
|
|
436
480
|
categories,
|
|
437
481
|
xBand,
|
|
438
482
|
bandWidth,
|
|
@@ -459,22 +503,17 @@ export class RawChartAxes extends React.Component {
|
|
|
459
503
|
};
|
|
460
504
|
|
|
461
505
|
return (
|
|
462
|
-
<
|
|
506
|
+
<StyledAxesGroup>
|
|
463
507
|
{leftAxis && (
|
|
464
508
|
<AxisLeft
|
|
465
509
|
scale={scale.y}
|
|
466
|
-
className={axis}
|
|
467
|
-
axisLineClassName={axisLine}
|
|
468
510
|
tickLength={10}
|
|
469
|
-
tickClassName={tick}
|
|
470
511
|
tickFormat={(value) => value}
|
|
471
512
|
tickValues={rowTickValues}
|
|
472
513
|
tickLabelProps={getTickLabelProps}
|
|
473
514
|
/>
|
|
474
515
|
)}
|
|
475
516
|
<AxisBottom
|
|
476
|
-
axisLineClassName={axisLine}
|
|
477
|
-
tickClassName={tick}
|
|
478
517
|
scale={bottomScale}
|
|
479
518
|
labelProps={{ y: 60 + top }}
|
|
480
519
|
top={scale.y && scale.y(range.min)}
|
|
@@ -484,64 +523,11 @@ export class RawChartAxes extends React.Component {
|
|
|
484
523
|
autoFocus={autoFocus}
|
|
485
524
|
onAutoFocusUsed={onAutoFocusUsed}
|
|
486
525
|
/>
|
|
487
|
-
</
|
|
526
|
+
</StyledAxesGroup>
|
|
488
527
|
);
|
|
489
528
|
}
|
|
490
529
|
}
|
|
491
530
|
|
|
492
|
-
const ChartAxes =
|
|
493
|
-
(theme) => ({
|
|
494
|
-
axis: {
|
|
495
|
-
stroke: color.primaryDark(),
|
|
496
|
-
strokeWidth: 2,
|
|
497
|
-
},
|
|
498
|
-
axisLine: {
|
|
499
|
-
stroke: color.visualElementsColors.AXIS_LINE_COLOR,
|
|
500
|
-
strokeWidth: 2,
|
|
501
|
-
},
|
|
502
|
-
tick: {
|
|
503
|
-
'& > line': {
|
|
504
|
-
stroke: color.primaryDark(),
|
|
505
|
-
strokeWidth: 2,
|
|
506
|
-
},
|
|
507
|
-
fontFamily: theme.typography.body1.fontFamily,
|
|
508
|
-
fontSize: theme.typography.fontSize,
|
|
509
|
-
textAnchor: 'middle',
|
|
510
|
-
},
|
|
511
|
-
dottedLine: {
|
|
512
|
-
stroke: color.primaryLight(),
|
|
513
|
-
opacity: 0.2,
|
|
514
|
-
},
|
|
515
|
-
error: {
|
|
516
|
-
fontSize: theme.typography.fontSize - 2,
|
|
517
|
-
fill: theme.palette.error.main,
|
|
518
|
-
},
|
|
519
|
-
customColor: {
|
|
520
|
-
color: `${color.tertiary()} !important`,
|
|
521
|
-
},
|
|
522
|
-
correctnessIcon: {
|
|
523
|
-
borderRadius: theme.spacing.unit * 2,
|
|
524
|
-
color: color.defaults.WHITE,
|
|
525
|
-
fontSize: '16px',
|
|
526
|
-
width: '16px',
|
|
527
|
-
height: '16px',
|
|
528
|
-
padding: '2px',
|
|
529
|
-
border: `1px solid ${color.defaults.WHITE}`,
|
|
530
|
-
boxSizing: 'unset', // to override the default border-box in IBX
|
|
531
|
-
},
|
|
532
|
-
incorrectIcon: {
|
|
533
|
-
backgroundColor: color.incorrectWithIcon(),
|
|
534
|
-
},
|
|
535
|
-
correctIcon: {
|
|
536
|
-
backgroundColor: color.correct(),
|
|
537
|
-
},
|
|
538
|
-
tickContainer: {
|
|
539
|
-
display: 'flex',
|
|
540
|
-
flexDirection: 'column',
|
|
541
|
-
alignItems: 'center',
|
|
542
|
-
},
|
|
543
|
-
}),
|
|
544
|
-
{ withTheme: true },
|
|
545
|
-
)(RawChartAxes);
|
|
531
|
+
const ChartAxes = styled(RawChartAxes)(({ theme }) => ({}));
|
|
546
532
|
|
|
547
533
|
export default ChartAxes;
|
package/src/bars/common/bars.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Group } from '@vx/group';
|
|
4
4
|
import { Bar as VxBar } from '@vx/shape';
|
|
5
|
-
import {
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { color } from '@pie-lib/render-ui';
|
|
@@ -51,12 +51,15 @@ const calculateFillColor = (isHovered, barColor, index, hoverHistogramColors, al
|
|
|
51
51
|
return barColor || null;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
const StyledVxBar = styled(VxBar)(() => ({
|
|
55
|
+
fill: color.defaults.TERTIARY,
|
|
56
|
+
}));
|
|
57
|
+
|
|
54
58
|
export class RawBar extends React.Component {
|
|
55
59
|
static propTypes = {
|
|
56
60
|
barColor: PropTypes.string,
|
|
57
61
|
onChangeCategory: PropTypes.func,
|
|
58
62
|
value: PropTypes.number,
|
|
59
|
-
classes: PropTypes.object,
|
|
60
63
|
label: PropTypes.string,
|
|
61
64
|
xBand: PropTypes.func,
|
|
62
65
|
index: PropTypes.number.isRequired,
|
|
@@ -140,7 +143,6 @@ export class RawBar extends React.Component {
|
|
|
140
143
|
graphProps,
|
|
141
144
|
value,
|
|
142
145
|
label,
|
|
143
|
-
classes,
|
|
144
146
|
xBand,
|
|
145
147
|
index,
|
|
146
148
|
interactive,
|
|
@@ -174,12 +176,11 @@ export class RawBar extends React.Component {
|
|
|
174
176
|
onTouchStart={this.handleMouseEnter}
|
|
175
177
|
onTouchEnd={this.handleMouseLeave}
|
|
176
178
|
>
|
|
177
|
-
<
|
|
179
|
+
<StyledVxBar
|
|
178
180
|
x={barX}
|
|
179
181
|
y={scale.y(yy)}
|
|
180
182
|
width={barWidth}
|
|
181
183
|
height={barHeight}
|
|
182
|
-
className={classes.bar}
|
|
183
184
|
style={{ fill: fillColor }}
|
|
184
185
|
/>
|
|
185
186
|
{correctness &&
|
|
@@ -196,12 +197,11 @@ export class RawBar extends React.Component {
|
|
|
196
197
|
|
|
197
198
|
return (
|
|
198
199
|
<>
|
|
199
|
-
<
|
|
200
|
+
<StyledVxBar
|
|
200
201
|
x={barX + 2} // add 2px for the stroke (the dashed border)
|
|
201
202
|
y={yToRender}
|
|
202
203
|
width={barWidth - 4} // substract 4px for the total stroke
|
|
203
204
|
height={diffPx}
|
|
204
|
-
className={classes.bar}
|
|
205
205
|
style={{
|
|
206
206
|
stroke: indicatorBarColor,
|
|
207
207
|
strokeWidth: 2,
|
|
@@ -234,22 +234,7 @@ export class RawBar extends React.Component {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
const Bar =
|
|
238
|
-
bar: {
|
|
239
|
-
fill: color.defaults.TERTIARY,
|
|
240
|
-
},
|
|
241
|
-
correctIcon: {
|
|
242
|
-
backgroundColor: color.correct(),
|
|
243
|
-
borderRadius: theme.spacing.unit * 2,
|
|
244
|
-
color: color.defaults.WHITE,
|
|
245
|
-
fontSize: '10px',
|
|
246
|
-
width: '10px',
|
|
247
|
-
height: '10px',
|
|
248
|
-
padding: '2px',
|
|
249
|
-
border: `1px solid ${color.defaults.WHITE}`,
|
|
250
|
-
boxSizing: 'unset', // to override the default border-box in IBX
|
|
251
|
-
},
|
|
252
|
-
}))(RawBar);
|
|
237
|
+
const Bar = RawBar;
|
|
253
238
|
|
|
254
239
|
export class Bars extends React.Component {
|
|
255
240
|
static propTypes = {
|
package/src/chart-setup.jsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { color } from '@pie-lib/render-ui';
|
|
4
|
-
import {
|
|
5
|
-
import Typography from '@material
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
6
|
import ChartType from './chart-type';
|
|
7
7
|
import { NumberTextFieldCustom } from '@pie-lib/config-ui';
|
|
8
8
|
import { AlertDialog } from '@pie-lib/config-ui';
|
|
@@ -24,9 +24,52 @@ export const resetValues = (data, updateModel, range, onChange, model) => {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
const StyledWrapper = styled('div')(() => ({
|
|
28
|
+
width: '450px',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const StyledContent = styled('div')(({ theme }) => ({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
width: '100%',
|
|
35
|
+
marginTop: theme.spacing(3),
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
const StyledColumnView = styled('div')(() => ({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const StyledRowView = styled('div')(() => ({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
justifyContent: 'space-around',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
}));
|
|
49
|
+
|
|
50
|
+
const StyledTextField = styled(NumberTextFieldCustom)(({ theme }) => ({
|
|
51
|
+
width: '130px',
|
|
52
|
+
margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const StyledMediumTextField = styled(NumberTextFieldCustom)(({ theme }) => ({
|
|
56
|
+
width: '160px',
|
|
57
|
+
margin: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
const StyledDimensions = styled('div')(({ theme }) => ({
|
|
61
|
+
display: 'flex',
|
|
62
|
+
justifyContent: 'space-between',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
margin: `${theme.spacing(3)} 0`,
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
const StyledDisabled = styled(Typography)(() => ({
|
|
68
|
+
color: color.disabled(),
|
|
69
|
+
}));
|
|
70
|
+
|
|
27
71
|
const ConfigureChartPanel = (props) => {
|
|
28
72
|
const {
|
|
29
|
-
classes,
|
|
30
73
|
model,
|
|
31
74
|
onChange,
|
|
32
75
|
chartDimensions,
|
|
@@ -67,24 +110,22 @@ const ConfigureChartPanel = (props) => {
|
|
|
67
110
|
const labelOptions = labelValues && labelValues.range ? { customValues: labelValues.range } : { min: 0, max: 10000 };
|
|
68
111
|
|
|
69
112
|
const stepConfig = (
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
className={classes.mediumTextField}
|
|
113
|
+
<StyledRowView>
|
|
114
|
+
<StyledMediumTextField
|
|
73
115
|
label="Grid Interval"
|
|
74
116
|
value={range.step}
|
|
75
117
|
variant="outlined"
|
|
76
118
|
onChange={(e, v) => onRangeChanged('step', v, e)}
|
|
77
119
|
{...gridOptions}
|
|
78
120
|
/>
|
|
79
|
-
<
|
|
80
|
-
className={classes.mediumTextField}
|
|
121
|
+
<StyledMediumTextField
|
|
81
122
|
label={'Label Interval'}
|
|
82
123
|
value={range.labelStep}
|
|
83
124
|
variant={'outlined'}
|
|
84
125
|
onChange={(e, v) => onRangeChanged('labelStep', v, e)}
|
|
85
126
|
{...labelOptions}
|
|
86
127
|
/>
|
|
87
|
-
</
|
|
128
|
+
</StyledRowView>
|
|
88
129
|
);
|
|
89
130
|
|
|
90
131
|
const handleAlertDialog = (openStatus, callback) => {
|
|
@@ -236,18 +277,17 @@ const ConfigureChartPanel = (props) => {
|
|
|
236
277
|
};
|
|
237
278
|
|
|
238
279
|
return (
|
|
239
|
-
<
|
|
280
|
+
<StyledWrapper>
|
|
240
281
|
<Typography variant={'subtitle1'}>Configure Chart</Typography>
|
|
241
|
-
<
|
|
242
|
-
<
|
|
282
|
+
<StyledContent>
|
|
283
|
+
<StyledRowView>
|
|
243
284
|
<ChartType
|
|
244
285
|
value={model.chartType}
|
|
245
286
|
onChange={(e) => onChartTypeChange(e.target.value)}
|
|
246
287
|
availableChartTypes={availableChartTypes}
|
|
247
288
|
chartTypeLabel={chartTypeLabel}
|
|
248
289
|
/>
|
|
249
|
-
<
|
|
250
|
-
className={classes.mediumTextField}
|
|
290
|
+
<StyledMediumTextField
|
|
251
291
|
label="Max Value"
|
|
252
292
|
value={range.max}
|
|
253
293
|
min={rangeProps(model.chartType).min}
|
|
@@ -255,18 +295,17 @@ const ConfigureChartPanel = (props) => {
|
|
|
255
295
|
variant="outlined"
|
|
256
296
|
onChange={(e, v) => onRangeChanged('max', v, e)}
|
|
257
297
|
/>
|
|
258
|
-
</
|
|
298
|
+
</StyledRowView>
|
|
259
299
|
{!model.chartType.includes('Plot') && stepConfig}
|
|
260
300
|
|
|
261
301
|
{showInConfigPanel && (
|
|
262
|
-
<
|
|
302
|
+
<StyledDimensions>
|
|
263
303
|
<div>
|
|
264
304
|
<Typography>Dimensions(px)</Typography>
|
|
265
305
|
</div>
|
|
266
306
|
|
|
267
|
-
<
|
|
268
|
-
<
|
|
269
|
-
className={classes.textField}
|
|
307
|
+
<StyledColumnView>
|
|
308
|
+
<StyledTextField
|
|
270
309
|
label={'Width'}
|
|
271
310
|
value={size.width}
|
|
272
311
|
min={widthConstraints.min}
|
|
@@ -275,12 +314,11 @@ const ConfigureChartPanel = (props) => {
|
|
|
275
314
|
variant={'outlined'}
|
|
276
315
|
onChange={(e, v) => onSizeChanged('width', v)}
|
|
277
316
|
/>
|
|
278
|
-
<
|
|
279
|
-
</
|
|
317
|
+
<StyledDisabled>Min 50, Max 700</StyledDisabled>
|
|
318
|
+
</StyledColumnView>
|
|
280
319
|
|
|
281
|
-
<
|
|
282
|
-
<
|
|
283
|
-
className={classes.textField}
|
|
320
|
+
<StyledColumnView>
|
|
321
|
+
<StyledTextField
|
|
284
322
|
label={'Height'}
|
|
285
323
|
value={size.height}
|
|
286
324
|
min={heightConstraints.min}
|
|
@@ -289,11 +327,11 @@ const ConfigureChartPanel = (props) => {
|
|
|
289
327
|
variant={'outlined'}
|
|
290
328
|
onChange={(e, v) => onSizeChanged('height', v)}
|
|
291
329
|
/>
|
|
292
|
-
<
|
|
293
|
-
</
|
|
294
|
-
</
|
|
330
|
+
<StyledDisabled>Min 400, Max 700</StyledDisabled>
|
|
331
|
+
</StyledColumnView>
|
|
332
|
+
</StyledDimensions>
|
|
295
333
|
)}
|
|
296
|
-
</
|
|
334
|
+
</StyledContent>
|
|
297
335
|
|
|
298
336
|
<AlertDialog
|
|
299
337
|
open={alertDialog.open}
|
|
@@ -302,12 +340,11 @@ const ConfigureChartPanel = (props) => {
|
|
|
302
340
|
onClose={alertDialog.onClose}
|
|
303
341
|
onConfirm={alertDialog.onConfirm}
|
|
304
342
|
/>
|
|
305
|
-
</
|
|
343
|
+
</StyledWrapper>
|
|
306
344
|
);
|
|
307
345
|
};
|
|
308
346
|
|
|
309
347
|
ConfigureChartPanel.propTypes = {
|
|
310
|
-
classes: PropTypes.object,
|
|
311
348
|
chartDimensions: PropTypes.object,
|
|
312
349
|
domain: PropTypes.object,
|
|
313
350
|
gridValues: PropTypes.object,
|
|
@@ -322,51 +359,4 @@ ConfigureChartPanel.propTypes = {
|
|
|
322
359
|
chartTypeLabel: PropTypes.string,
|
|
323
360
|
};
|
|
324
361
|
|
|
325
|
-
|
|
326
|
-
wrapper: {
|
|
327
|
-
width: '450px',
|
|
328
|
-
},
|
|
329
|
-
content: {
|
|
330
|
-
display: 'flex',
|
|
331
|
-
flexDirection: 'column',
|
|
332
|
-
width: '100%',
|
|
333
|
-
marginTop: theme.spacing.unit * 3,
|
|
334
|
-
},
|
|
335
|
-
columnView: {
|
|
336
|
-
display: 'flex',
|
|
337
|
-
flexDirection: 'column',
|
|
338
|
-
alignItems: 'center',
|
|
339
|
-
},
|
|
340
|
-
rowView: {
|
|
341
|
-
display: 'flex',
|
|
342
|
-
justifyContent: 'space-around',
|
|
343
|
-
alignItems: 'center',
|
|
344
|
-
},
|
|
345
|
-
textField: {
|
|
346
|
-
width: '130px',
|
|
347
|
-
margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
|
|
348
|
-
},
|
|
349
|
-
mediumTextField: {
|
|
350
|
-
width: '160px',
|
|
351
|
-
margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
|
|
352
|
-
},
|
|
353
|
-
largeTextField: {
|
|
354
|
-
width: '230px',
|
|
355
|
-
margin: `${theme.spacing.unit}px ${theme.spacing.unit / 2}px`,
|
|
356
|
-
},
|
|
357
|
-
text: {
|
|
358
|
-
fontStyle: 'italic',
|
|
359
|
-
margin: `${theme.spacing.unit}px 0`,
|
|
360
|
-
},
|
|
361
|
-
dimensions: {
|
|
362
|
-
display: 'flex',
|
|
363
|
-
justifyContent: 'space-between',
|
|
364
|
-
alignItems: 'center',
|
|
365
|
-
margin: `${theme.spacing.unit * 3}px 0`,
|
|
366
|
-
},
|
|
367
|
-
disabled: {
|
|
368
|
-
color: color.disabled(),
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
export default withStyles(styles)(ConfigureChartPanel);
|
|
362
|
+
export default ConfigureChartPanel;
|
package/src/chart-type.js
CHANGED
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import MenuItem from '@material
|
|
4
|
-
import FormControl from '@material
|
|
5
|
-
import InputLabel from '@material
|
|
6
|
-
import Select from '@material
|
|
7
|
-
import OutlinedInput from '@material
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
4
|
+
import FormControl from '@mui/material/FormControl';
|
|
5
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
6
|
+
import Select from '@mui/material/Select';
|
|
7
|
+
import OutlinedInput from '@mui/material/OutlinedInput';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
const StyledContainer = styled('div')(() => ({
|
|
10
|
+
width: '160px',
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
const StyledFormControl = styled(FormControl)(() => ({
|
|
14
|
+
width: '160px',
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const StyledInputLabel = styled(InputLabel)(() => ({
|
|
18
|
+
backgroundColor: 'transparent',
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const ChartType = ({ onChange, value, availableChartTypes, chartTypeLabel }) => (
|
|
22
|
+
<StyledContainer>
|
|
23
|
+
<StyledFormControl variant={'outlined'}>
|
|
24
|
+
<StyledInputLabel id="type-helper-label">
|
|
20
25
|
{chartTypeLabel}
|
|
21
|
-
</
|
|
26
|
+
</StyledInputLabel>
|
|
22
27
|
<Select
|
|
23
28
|
labelId="type-helper-label"
|
|
24
29
|
value={value}
|
|
@@ -32,8 +37,8 @@ const ChartType = withStyles(() => ({
|
|
|
32
37
|
{availableChartTypes?.dotPlot && <MenuItem value={'dotPlot'}>{availableChartTypes.dotPlot}</MenuItem>}
|
|
33
38
|
{availableChartTypes?.linePlot && <MenuItem value={'linePlot'}>{availableChartTypes.linePlot}</MenuItem>}
|
|
34
39
|
</Select>
|
|
35
|
-
</
|
|
36
|
-
</
|
|
37
|
-
)
|
|
40
|
+
</StyledFormControl>
|
|
41
|
+
</StyledContainer>
|
|
42
|
+
);
|
|
38
43
|
|
|
39
44
|
export default ChartType;
|
package/src/chart.jsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
import classNames from 'classnames';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
5
4
|
import debug from 'debug';
|
|
6
5
|
import cloneDeep from 'lodash/cloneDeep';
|
|
7
6
|
|
|
@@ -18,6 +17,10 @@ const { translator } = Translator;
|
|
|
18
17
|
|
|
19
18
|
const log = debug('pie-lib:charts:chart');
|
|
20
19
|
|
|
20
|
+
const StyledChartContainer = styled('div')(() => ({
|
|
21
|
+
width: 'min-content',
|
|
22
|
+
}));
|
|
23
|
+
|
|
21
24
|
export class Chart extends React.Component {
|
|
22
25
|
constructor(props) {
|
|
23
26
|
super(props);
|
|
@@ -31,7 +34,6 @@ export class Chart extends React.Component {
|
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
static propTypes = {
|
|
34
|
-
classes: PropTypes.object.isRequired,
|
|
35
37
|
className: PropTypes.string,
|
|
36
38
|
chartType: PropTypes.string.isRequired,
|
|
37
39
|
size: PropTypes.shape({
|
|
@@ -210,7 +212,6 @@ export class Chart extends React.Component {
|
|
|
210
212
|
|
|
211
213
|
render() {
|
|
212
214
|
const {
|
|
213
|
-
classes,
|
|
214
215
|
className,
|
|
215
216
|
domain = {},
|
|
216
217
|
range = {},
|
|
@@ -279,7 +280,7 @@ export class Chart extends React.Component {
|
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
return (
|
|
282
|
-
<
|
|
283
|
+
<StyledChartContainer className={className}>
|
|
283
284
|
<Root
|
|
284
285
|
title={title}
|
|
285
286
|
onChangeTitle={onChangeTitle}
|
|
@@ -351,22 +352,9 @@ export class Chart extends React.Component {
|
|
|
351
352
|
onClose={dialog.onClose}
|
|
352
353
|
onConfirm={dialog.onConfirm}
|
|
353
354
|
/>
|
|
354
|
-
</
|
|
355
|
+
</StyledChartContainer>
|
|
355
356
|
);
|
|
356
357
|
}
|
|
357
358
|
}
|
|
358
359
|
|
|
359
|
-
|
|
360
|
-
graphBox: {
|
|
361
|
-
transform: 'translate(60px, 35px)',
|
|
362
|
-
},
|
|
363
|
-
svg: {
|
|
364
|
-
overflow: 'visible',
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
chartBox: {
|
|
368
|
-
width: 'min-content',
|
|
369
|
-
},
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
export default withStyles(styles, { withTheme: true })(Chart);
|
|
360
|
+
export default Chart;
|