@pie-lib/charting 5.16.1-beta.0 → 5.17.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.json +1 -581
- package/CHANGELOG.md +153 -1
- package/package.json +5 -38
- package/src/__tests__/__snapshots__/axes.test.jsx.snap +1 -0
- package/src/__tests__/__snapshots__/chart.test.jsx.snap +0 -18
- package/src/__tests__/__snapshots__/grid.test.jsx.snap +61 -17
- package/src/__tests__/axes.test.jsx +0 -5
- package/src/__tests__/chart.test.jsx +8 -0
- package/src/actions-button.jsx +109 -0
- package/src/axes.jsx +4 -30
- package/src/bars/common/bars.jsx +8 -10
- package/src/chart-setup.jsx +1 -1
- package/src/chart.jsx +31 -26
- package/src/common/drag-handle.jsx +3 -3
- package/src/common/styles.js +1 -1
- package/src/grid.jsx +38 -13
- package/src/index.js +2 -1
- package/src/key-legend.jsx +75 -0
- package/src/line/common/drag-handle.jsx +3 -9
- package/src/line/common/line.jsx +2 -6
- package/src/line/line-cross.js +29 -2
- package/src/line/line-dot.js +36 -19
- package/src/mark-label.jsx +7 -2
- package/src/plot/common/plot.jsx +8 -5
- package/src/tool-menu.jsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,159 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [5.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.17.0) (2025-07-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [5.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.18.0) (2025-07-31)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [5.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.17.0) (2025-07-31)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [5.16.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.8) (2025-07-25)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [5.16.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.7) (2025-07-25)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [5.16.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.7) (2025-07-25)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [5.16.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.6) (2025-07-25)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [5.16.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.6) (2025-07-25)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# [5.16.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.5) (2025-07-25)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [5.16.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.5) (2025-07-25)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# [5.16.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.4) (2025-07-25)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [5.16.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.3) (2025-07-25)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [5.16.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.4) (2025-07-23)
|
|
103
|
+
|
|
104
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [5.16.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.3) (2025-07-23)
|
|
111
|
+
|
|
112
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# [5.16.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.3) (2025-07-20)
|
|
119
|
+
|
|
120
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# [5.16.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.2) (2025-07-20)
|
|
127
|
+
|
|
128
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
# [5.16.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.1) (2025-07-20)
|
|
135
|
+
|
|
136
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# [5.16.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.2) (2025-07-20)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# [5.16.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.1) (2025-07-20)
|
|
151
|
+
|
|
152
|
+
**Note:** Version bump only for package @pie-lib/charting
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# [5.16.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.1) (2025-07-20)
|
|
7
159
|
|
|
8
160
|
**Note:** Version bump only for package @pie-lib/charting
|
|
9
161
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "5.
|
|
6
|
+
"version": "5.17.0",
|
|
7
7
|
"description": "charting",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -19,20 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@mapbox/point-geometry": "^0.1.0",
|
|
21
21
|
"@material-ui/core": "^3.8.3",
|
|
22
|
-
"@
|
|
23
|
-
"@pie-
|
|
24
|
-
"@pie-framework/mathquill": "1.1.4",
|
|
25
|
-
"@pie-lib/config-ui": "beta",
|
|
26
|
-
"@pie-lib/drag": "beta",
|
|
27
|
-
"@pie-lib/editable-html": "beta",
|
|
28
|
-
"@pie-lib/icons": "beta",
|
|
29
|
-
"@pie-lib/math-input": "beta",
|
|
30
|
-
"@pie-lib/math-rendering": "beta",
|
|
31
|
-
"@pie-lib/math-toolbar": "beta",
|
|
32
|
-
"@pie-lib/plot": "^2.8.1-beta.0",
|
|
33
|
-
"@pie-lib/render-ui": "beta",
|
|
34
|
-
"@pie-lib/test-utils": "beta",
|
|
35
|
-
"@pie-lib/translator": "^2.4.1-beta.0",
|
|
22
|
+
"@pie-lib/plot": "^2.10.0",
|
|
23
|
+
"@pie-lib/translator": "^2.6.0",
|
|
36
24
|
"@vx/axis": "^0.0.183",
|
|
37
25
|
"@vx/event": "^0.0.182",
|
|
38
26
|
"@vx/grid": "^0.0.183",
|
|
@@ -44,38 +32,17 @@
|
|
|
44
32
|
"d3-scale": "^2.1.2",
|
|
45
33
|
"d3-selection": "^1.3.2",
|
|
46
34
|
"debug": "^4.1.1",
|
|
47
|
-
"immutable": "^4.0.0-rc.12",
|
|
48
35
|
"invariant": "^2.2.4",
|
|
49
36
|
"lodash": "^4.17.11",
|
|
50
|
-
"mathjax-full": "3.2.2",
|
|
51
|
-
"mathjs": "^7.0.1",
|
|
52
|
-
"prop-types": "^15.7.2",
|
|
53
37
|
"react": "^16.8.1",
|
|
54
|
-
"react-attr-converter": "^0.3.1",
|
|
55
|
-
"react-dnd": "^14.0.5",
|
|
56
|
-
"react-dnd-html5-backend": "^14.0.2",
|
|
57
|
-
"react-dnd-multi-backend": "^6.0.2",
|
|
58
|
-
"react-dnd-touch-backend": "^12.0.0",
|
|
59
|
-
"react-dom": "^16.9.0",
|
|
60
38
|
"react-draggable": "^3.1.1",
|
|
61
39
|
"react-input-autosize": "^2.2.1",
|
|
62
|
-
"react-measure": "^2.2.2",
|
|
63
40
|
"react-redux": "^6.0.0",
|
|
64
|
-
"react-transition-group": "^2.5.2",
|
|
65
41
|
"redux": "^4.0.1",
|
|
66
|
-
"redux-undo": "
|
|
67
|
-
"slate": "^0.36.2",
|
|
68
|
-
"slate-edit-list": "^0.12.1",
|
|
69
|
-
"slate-edit-table": "^0.17.0",
|
|
70
|
-
"slate-html-serializer": "^0.6.12",
|
|
71
|
-
"slate-plain-serializer": "^0.5.26",
|
|
72
|
-
"slate-prop-types": "^0.4.38",
|
|
73
|
-
"slate-react": "^0.14.3",
|
|
74
|
-
"slate-soft-break": "^0.8.1",
|
|
75
|
-
"to-style": "^1.3.3"
|
|
42
|
+
"redux-undo": "latest"
|
|
76
43
|
},
|
|
77
44
|
"peerDependencies": {
|
|
78
45
|
"react": "^16.8.1"
|
|
79
46
|
},
|
|
80
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "889a13bfea2c768b8a3a6eabfc6fe7b7725aa832"
|
|
81
48
|
}
|
|
@@ -4,12 +4,6 @@ exports[`ChartAxes snapshot renders 1`] = `
|
|
|
4
4
|
<div
|
|
5
5
|
className="className"
|
|
6
6
|
>
|
|
7
|
-
<div>
|
|
8
|
-
<ToolMenu
|
|
9
|
-
addCategory={[Function]}
|
|
10
|
-
disabled={true}
|
|
11
|
-
/>
|
|
12
|
-
</div>
|
|
13
7
|
<WithStyles(Root)
|
|
14
8
|
defineChart={false}
|
|
15
9
|
disabledLabels={true}
|
|
@@ -205,12 +199,6 @@ exports[`ChartAxes snapshot renders if size is not defined 1`] = `
|
|
|
205
199
|
<div
|
|
206
200
|
className="className"
|
|
207
201
|
>
|
|
208
|
-
<div>
|
|
209
|
-
<ToolMenu
|
|
210
|
-
addCategory={[Function]}
|
|
211
|
-
disabled={true}
|
|
212
|
-
/>
|
|
213
|
-
</div>
|
|
214
202
|
<WithStyles(Root)
|
|
215
203
|
defineChart={false}
|
|
216
204
|
disabledLabels={true}
|
|
@@ -410,12 +398,6 @@ exports[`ChartAxes snapshot renders without chartType property 1`] = `
|
|
|
410
398
|
<div
|
|
411
399
|
className="className"
|
|
412
400
|
>
|
|
413
|
-
<div>
|
|
414
|
-
<ToolMenu
|
|
415
|
-
addCategory={[Function]}
|
|
416
|
-
disabled={true}
|
|
417
|
-
/>
|
|
418
|
-
</div>
|
|
419
401
|
<WithStyles(Root)
|
|
420
402
|
defineChart={false}
|
|
421
403
|
disabledLabels={true}
|
|
@@ -1,28 +1,72 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Grid snapshot renders 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<g
|
|
5
5
|
className="className"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
>
|
|
7
|
+
<q
|
|
8
|
+
lineStyle={
|
|
9
|
+
Object {
|
|
10
|
+
"stroke": "var(--pie-faded-primary, #DCDAFB)",
|
|
11
|
+
"strokeWidth": 1,
|
|
12
|
+
}
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
scale={[MockFunction]}
|
|
15
|
+
tickValues={Array []}
|
|
16
|
+
width={400}
|
|
17
|
+
/>
|
|
18
|
+
<q
|
|
19
|
+
lineStyle={
|
|
20
|
+
Object {
|
|
21
|
+
"stroke": "#8E88EA",
|
|
22
|
+
"strokeWidth": 1,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
scale={[MockFunction]}
|
|
26
|
+
tickValues={Array []}
|
|
27
|
+
width={400}
|
|
28
|
+
/>
|
|
29
|
+
<V
|
|
30
|
+
height={400}
|
|
31
|
+
offset={NaN}
|
|
32
|
+
scale={
|
|
33
|
+
Object {
|
|
34
|
+
"bandwidth": [Function],
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/>
|
|
38
|
+
</g>
|
|
16
39
|
`;
|
|
17
40
|
|
|
18
41
|
exports[`Grid snapshot renders if graphProps is not defined 1`] = `
|
|
19
|
-
<
|
|
42
|
+
<g
|
|
20
43
|
className="className"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
44
|
+
>
|
|
45
|
+
<q
|
|
46
|
+
lineStyle={
|
|
47
|
+
Object {
|
|
48
|
+
"stroke": "var(--pie-faded-primary, #DCDAFB)",
|
|
49
|
+
"strokeWidth": 1,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
tickValues={Array []}
|
|
53
|
+
/>
|
|
54
|
+
<q
|
|
55
|
+
lineStyle={
|
|
56
|
+
Object {
|
|
57
|
+
"stroke": "#8E88EA",
|
|
58
|
+
"strokeWidth": 1,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
tickValues={Array []}
|
|
62
|
+
/>
|
|
63
|
+
<V
|
|
64
|
+
offset={NaN}
|
|
65
|
+
scale={
|
|
66
|
+
Object {
|
|
67
|
+
"bandwidth": [Function],
|
|
68
|
+
}
|
|
25
69
|
}
|
|
26
|
-
|
|
27
|
-
|
|
70
|
+
/>
|
|
71
|
+
</g>
|
|
28
72
|
`;
|
|
@@ -137,10 +137,5 @@ describe('TickComponent', () => {
|
|
|
137
137
|
w.instance().changeCategory(0, 'new label');
|
|
138
138
|
expect(onChangeCategory).toHaveBeenCalledWith(0, { value: 1, label: 'new label' });
|
|
139
139
|
});
|
|
140
|
-
|
|
141
|
-
it('calls onChange', () => {
|
|
142
|
-
w.instance().deleteCategory(0);
|
|
143
|
-
expect(onChange).toHaveBeenCalledWith([]);
|
|
144
|
-
});
|
|
145
140
|
});
|
|
146
141
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
4
|
+
import Button from '@material-ui/core/Button';
|
|
5
|
+
import Popover from '@material-ui/core/Popover';
|
|
6
|
+
import Paper from '@material-ui/core/Paper';
|
|
7
|
+
|
|
8
|
+
import { color } from '../../render-ui/src/index';
|
|
9
|
+
import Translator from '@pie-lib/translator';
|
|
10
|
+
|
|
11
|
+
const { translator } = Translator;
|
|
12
|
+
|
|
13
|
+
export class ActionsButton extends React.Component {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
super(props);
|
|
16
|
+
this.state = {
|
|
17
|
+
actionsAnchorEl: null,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static propTypes = {
|
|
22
|
+
classes: PropTypes.object.isRequired,
|
|
23
|
+
categories: PropTypes.array,
|
|
24
|
+
addCategory: PropTypes.func.isRequired,
|
|
25
|
+
deleteCategory: PropTypes.func.isRequired,
|
|
26
|
+
language: PropTypes.string.isRequired,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
handleActionsClick = (event) => {
|
|
30
|
+
this.setState({ actionsAnchorEl: event.currentTarget });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
handleActionsClose = () => {
|
|
34
|
+
this.setState({ actionsAnchorEl: null });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
handleAddCategory = () => {
|
|
38
|
+
const { addCategory } = this.props;
|
|
39
|
+
addCategory();
|
|
40
|
+
this.handleActionsClose();
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
handleDeleteCategory = (index) => {
|
|
44
|
+
const { deleteCategory } = this.props;
|
|
45
|
+
deleteCategory(index);
|
|
46
|
+
this.handleActionsClose();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
render() {
|
|
50
|
+
const { classes, categories, language } = this.props;
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<div className={classes.actions}>
|
|
54
|
+
<div role="button" tabIndex={0} className={classes.trigger} onClick={this.handleActionsClick}>
|
|
55
|
+
Actions
|
|
56
|
+
</div>
|
|
57
|
+
<Popover
|
|
58
|
+
open={Boolean(this.state.actionsAnchorEl)}
|
|
59
|
+
anchorEl={this.state.actionsAnchorEl}
|
|
60
|
+
onClose={this.handleActionsClose}
|
|
61
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
|
|
62
|
+
transformOrigin={{ vertical: 'top', horizontal: 'left' }}
|
|
63
|
+
>
|
|
64
|
+
<Paper className={classes.actionsPaper}>
|
|
65
|
+
<Button onClick={() => this.handleAddCategory()}>
|
|
66
|
+
+ {translator.t('charting.add', { lng: language })}
|
|
67
|
+
</Button>
|
|
68
|
+
{categories.length > 0 &&
|
|
69
|
+
categories.map(
|
|
70
|
+
(category, index) =>
|
|
71
|
+
category.deletable &&
|
|
72
|
+
!category.correctness && (
|
|
73
|
+
<Button key={index} onClick={() => this.handleDeleteCategory(index)}>
|
|
74
|
+
{`${translator.t('charting.delete', { lng: language })} <${category.label ||
|
|
75
|
+
translator.t('charting.newLabel', { lng: language })}>`}
|
|
76
|
+
</Button>
|
|
77
|
+
),
|
|
78
|
+
)}
|
|
79
|
+
</Paper>
|
|
80
|
+
</Popover>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const styles = (theme) => ({
|
|
87
|
+
actions: {
|
|
88
|
+
alignSelf: 'flex-end',
|
|
89
|
+
},
|
|
90
|
+
trigger: {
|
|
91
|
+
cursor: 'pointer',
|
|
92
|
+
fontSize: theme.typography.fontSize,
|
|
93
|
+
color: color.tertiary(),
|
|
94
|
+
},
|
|
95
|
+
actionsPaper: {
|
|
96
|
+
padding: theme.spacing.unit,
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
gap: theme.spacing.unit,
|
|
100
|
+
'& button': {
|
|
101
|
+
textTransform: 'none',
|
|
102
|
+
fontSize: theme.typography.fontSize,
|
|
103
|
+
color: color.text(),
|
|
104
|
+
justifyContent: 'flex-start',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export default withStyles(styles)(ActionsButton);
|
package/src/axes.jsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { withStyles } from '@material-ui/core/styles';
|
|
4
4
|
import { types } from '@pie-lib/plot';
|
|
5
|
-
import { color } from '
|
|
5
|
+
import { color } from '../../render-ui/src/index';
|
|
6
6
|
import { AlertDialog } from '@pie-lib/config-ui';
|
|
7
7
|
import { AxisLeft, AxisBottom } from '@vx/axis';
|
|
8
8
|
import { bandKey, getTickValues, getRotateAngle } from './utils';
|
|
@@ -45,14 +45,6 @@ export class TickComponent extends React.Component {
|
|
|
45
45
|
onChangeCategory(index, { ...category, label: newLabel });
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
deleteCategory = (index) => {
|
|
49
|
-
const { categories, onChange } = this.props;
|
|
50
|
-
|
|
51
|
-
if (index >= 0 && categories[index]) {
|
|
52
|
-
onChange([...categories.slice(0, index), ...categories.slice(index + 1)]);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
48
|
changeInteractive = (index, value) => {
|
|
57
49
|
const { categories, onChangeCategory } = this.props;
|
|
58
50
|
const category = categories[index];
|
|
@@ -144,7 +136,7 @@ export class TickComponent extends React.Component {
|
|
|
144
136
|
const { changeEditable, changeInteractive } = chartingOptions || {};
|
|
145
137
|
const index = parseInt(formattedValue.split('-')[0], 10);
|
|
146
138
|
const category = categories[index];
|
|
147
|
-
const {
|
|
139
|
+
const { editable, interactive, label, correctness } = category || {};
|
|
148
140
|
const barX = xBand(bandKey({ label }, index));
|
|
149
141
|
const longestCategory = (categories || []).reduce((a, b) => {
|
|
150
142
|
const lengthA = a && a.label ? a.label.length : 0;
|
|
@@ -185,6 +177,7 @@ export class TickComponent extends React.Component {
|
|
|
185
177
|
rotate={rotate}
|
|
186
178
|
correctness={correctness}
|
|
187
179
|
error={error && error[index]}
|
|
180
|
+
limitCharacters
|
|
188
181
|
/>
|
|
189
182
|
</foreignObject>
|
|
190
183
|
|
|
@@ -194,24 +187,6 @@ export class TickComponent extends React.Component {
|
|
|
194
187
|
</text>
|
|
195
188
|
)}
|
|
196
189
|
|
|
197
|
-
{deletable && !correctness && (
|
|
198
|
-
<line x1={x} y1={0} x2={x} y2={y + 4 + top} className={classes.dottedLine} strokeDasharray="4 2" />
|
|
199
|
-
)}
|
|
200
|
-
|
|
201
|
-
{deletable && !correctness && (
|
|
202
|
-
<svg
|
|
203
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
204
|
-
x={x - 8}
|
|
205
|
-
y={y + 60 + top}
|
|
206
|
-
width={16}
|
|
207
|
-
height={16}
|
|
208
|
-
viewBox="0 0 512 512"
|
|
209
|
-
onClick={() => this.deleteCategory(index)}
|
|
210
|
-
>
|
|
211
|
-
<path d="M128 405.429C128 428.846 147.198 448 170.667 448h170.667C364.802 448 384 428.846 384 405.429V160H128v245.429zM416 96h-80l-26.785-32H202.786L176 96H96v32h320V96z" />
|
|
212
|
-
</svg>
|
|
213
|
-
)}
|
|
214
|
-
|
|
215
190
|
{defineChart && index === 0 && (
|
|
216
191
|
<svg
|
|
217
192
|
x={-55}
|
|
@@ -493,7 +468,7 @@ const ChartAxes = withStyles(
|
|
|
493
468
|
strokeWidth: 2,
|
|
494
469
|
},
|
|
495
470
|
axisLine: {
|
|
496
|
-
stroke: color.
|
|
471
|
+
stroke: color.visualElementsColors.AXIS_LINE_COLOR,
|
|
497
472
|
strokeWidth: 2,
|
|
498
473
|
},
|
|
499
474
|
tick: {
|
|
@@ -501,7 +476,6 @@ const ChartAxes = withStyles(
|
|
|
501
476
|
stroke: color.primaryDark(),
|
|
502
477
|
strokeWidth: 2,
|
|
503
478
|
},
|
|
504
|
-
fill: color.primaryDark(),
|
|
505
479
|
fontFamily: theme.typography.body1.fontFamily,
|
|
506
480
|
fontSize: theme.typography.fontSize,
|
|
507
481
|
textAnchor: 'middle',
|
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 { types } from '@pie-lib/plot';
|
|
4
4
|
import { Group } from '@vx/group';
|
|
5
|
-
import { color } from '
|
|
5
|
+
import { color } from '../../../render-ui/src/index';
|
|
6
6
|
import { Bar as VxBar } from '@vx/shape';
|
|
7
7
|
import { withStyles } from '@material-ui/core/styles/index';
|
|
8
8
|
import debug from 'debug';
|
|
@@ -39,12 +39,12 @@ const hoverHistogramColors = [
|
|
|
39
39
|
'#894A65',
|
|
40
40
|
];
|
|
41
41
|
|
|
42
|
-
const calculateFillColor = (isHovered, barColor, index, hoverHistogramColors) => {
|
|
43
|
-
if (isHovered && barColor) {
|
|
42
|
+
const calculateFillColor = (isHovered, barColor, index, hoverHistogramColors, allowRolloverEvent) => {
|
|
43
|
+
if (isHovered && barColor && allowRolloverEvent) {
|
|
44
44
|
return hoverHistogramColors[index % hoverHistogramColors.length];
|
|
45
45
|
}
|
|
46
|
-
if (isHovered) {
|
|
47
|
-
return color.
|
|
46
|
+
if (isHovered && allowRolloverEvent) {
|
|
47
|
+
return color.visualElementsColors.ROLLOVER_FILL_BAR_COLOR;
|
|
48
48
|
}
|
|
49
49
|
return barColor || null;
|
|
50
50
|
};
|
|
@@ -148,7 +148,8 @@ export class RawBar extends React.Component {
|
|
|
148
148
|
const { scale, range } = graphProps;
|
|
149
149
|
const { dragValue, isHovered } = this.state;
|
|
150
150
|
|
|
151
|
-
const
|
|
151
|
+
const allowRolloverEvent = interactive && !correctness;
|
|
152
|
+
const fillColor = calculateFillColor(isHovered, barColor, index, hoverHistogramColors, allowRolloverEvent);
|
|
152
153
|
const v = Number.isFinite(dragValue) ? dragValue : value;
|
|
153
154
|
const barWidth = xBand.bandwidth();
|
|
154
155
|
const barHeight = scale.y(range.max - v);
|
|
@@ -195,10 +196,7 @@ export class RawBar extends React.Component {
|
|
|
195
196
|
|
|
196
197
|
const Bar = withStyles(() => ({
|
|
197
198
|
bar: {
|
|
198
|
-
fill: color.
|
|
199
|
-
'&:hover': {
|
|
200
|
-
fill: color.primaryDark(),
|
|
201
|
-
},
|
|
199
|
+
fill: color.defaults.TERTIARY,
|
|
202
200
|
},
|
|
203
201
|
}))(RawBar);
|
|
204
202
|
|
package/src/chart-setup.jsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { color } from '
|
|
3
|
+
import { color } from '../../render-ui/src/index';
|
|
4
4
|
import { withStyles } from '@material-ui/core/styles';
|
|
5
5
|
import Typography from '@material-ui/core/Typography';
|
|
6
6
|
import ChartType from './chart-type';
|