@pie-lib/charting 5.36.2-next.0 → 5.38.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 +26 -15
- 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 +38 -43
- 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 +43 -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 +29 -22
- 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 +16 -9
- 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/lib/axes.js
CHANGED
|
@@ -1,92 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = exports.TickComponent = exports.RawChartAxes = void 0;
|
|
9
|
-
|
|
10
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
24
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
15
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
29
|
-
|
|
30
|
-
var _styles = require("@material-ui/core/styles");
|
|
31
|
-
|
|
17
|
+
var _styles = require("@mui/material/styles");
|
|
32
18
|
var _axis = require("@vx/axis");
|
|
33
|
-
|
|
34
|
-
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
35
|
-
|
|
19
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
36
20
|
var _plot = require("@pie-lib/plot");
|
|
37
|
-
|
|
38
21
|
var _renderUi = require("@pie-lib/render-ui");
|
|
39
|
-
|
|
40
22
|
var _configUi = require("@pie-lib/config-ui");
|
|
41
|
-
|
|
42
23
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
43
|
-
|
|
44
24
|
var _correctnessIndicators = require("./common/correctness-indicators");
|
|
45
|
-
|
|
46
25
|
var _utils = require("./utils");
|
|
47
|
-
|
|
48
26
|
var _markLabel = _interopRequireDefault(require("./mark-label"));
|
|
49
|
-
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
30
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
31
|
+
var StyledErrorText = (0, _styles.styled)('text')(function (_ref) {
|
|
32
|
+
var theme = _ref.theme;
|
|
33
|
+
return {
|
|
34
|
+
fontSize: theme.typography.fontSize - 2,
|
|
35
|
+
fill: theme.palette.error.main
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
var StyledCheckbox = (0, _styles.styled)(_Checkbox["default"])(function () {
|
|
39
|
+
return {
|
|
40
|
+
color: "".concat(_renderUi.color.tertiary(), " !important")
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
var StyledAxesGroup = (0, _styles.styled)('g')(function (_ref2) {
|
|
44
|
+
var _theme$typography$bod;
|
|
45
|
+
var theme = _ref2.theme;
|
|
46
|
+
return {
|
|
47
|
+
'& .vx-axis-line': {
|
|
48
|
+
stroke: _renderUi.color.visualElementsColors.AXIS_LINE_COLOR,
|
|
49
|
+
strokeWidth: 2
|
|
50
|
+
},
|
|
51
|
+
'& .vx-axis-tick': {
|
|
52
|
+
fill: _renderUi.color.visualElementsColors.AXIS_TICK_COLOR,
|
|
53
|
+
'& line': {
|
|
54
|
+
stroke: _renderUi.color.visualElementsColors.AXIS_TICK_COLOR,
|
|
55
|
+
strokeWidth: 2
|
|
56
|
+
},
|
|
57
|
+
fontFamily: (_theme$typography$bod = theme.typography.body1) === null || _theme$typography$bod === void 0 ? void 0 : _theme$typography$bod.fontFamily,
|
|
58
|
+
fontSize: theme.typography.fontSize,
|
|
59
|
+
textAnchor: 'middle'
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
var correctnessIconStyles = function correctnessIconStyles(theme) {
|
|
64
|
+
return {
|
|
65
|
+
borderRadius: theme.spacing(2),
|
|
66
|
+
color: _renderUi.color.defaults.WHITE,
|
|
67
|
+
fontSize: '16px',
|
|
68
|
+
width: '16px',
|
|
69
|
+
height: '16px',
|
|
70
|
+
padding: '2px',
|
|
71
|
+
border: "1px solid ".concat(_renderUi.color.defaults.WHITE),
|
|
72
|
+
boxSizing: 'unset' // to override the default border-box in IBX
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
var incorrectIconStyles = {
|
|
76
|
+
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
77
|
+
};
|
|
78
|
+
var correctIconStyles = {
|
|
79
|
+
backgroundColor: _renderUi.color.correct()
|
|
80
|
+
};
|
|
81
|
+
var TickComponent = exports.TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
63
82
|
function TickComponent(props) {
|
|
64
83
|
var _this;
|
|
65
|
-
|
|
66
84
|
(0, _classCallCheck2["default"])(this, TickComponent);
|
|
67
|
-
_this =
|
|
68
|
-
(0, _defineProperty2["default"])(
|
|
85
|
+
_this = _callSuper(this, TickComponent, [props]);
|
|
86
|
+
(0, _defineProperty2["default"])(_this, "handleAlertDialog", function (open, callback) {
|
|
69
87
|
return _this.setState({
|
|
70
88
|
dialog: {
|
|
71
89
|
open: open
|
|
72
90
|
}
|
|
73
91
|
}, callback);
|
|
74
92
|
});
|
|
75
|
-
(0, _defineProperty2["default"])(
|
|
93
|
+
(0, _defineProperty2["default"])(_this, "changeCategory", function (index, newLabel) {
|
|
76
94
|
var _this$props = _this.props,
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
categories = _this$props.categories,
|
|
96
|
+
onChangeCategory = _this$props.onChangeCategory;
|
|
79
97
|
var category = categories[index];
|
|
80
98
|
onChangeCategory(index, _objectSpread(_objectSpread({}, category), {}, {
|
|
81
99
|
label: newLabel
|
|
82
100
|
}));
|
|
83
101
|
});
|
|
84
|
-
(0, _defineProperty2["default"])(
|
|
102
|
+
(0, _defineProperty2["default"])(_this, "changeInteractive", function (index, value) {
|
|
85
103
|
var _this$props2 = _this.props,
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
categories = _this$props2.categories,
|
|
105
|
+
onChangeCategory = _this$props2.onChangeCategory;
|
|
88
106
|
var category = categories[index];
|
|
89
|
-
|
|
90
107
|
if (!value) {
|
|
91
108
|
_this.setState({
|
|
92
109
|
dialog: {
|
|
@@ -109,12 +126,11 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
109
126
|
}));
|
|
110
127
|
}
|
|
111
128
|
});
|
|
112
|
-
(0, _defineProperty2["default"])(
|
|
129
|
+
(0, _defineProperty2["default"])(_this, "changeEditable", function (index, value) {
|
|
113
130
|
var _this$props3 = _this.props,
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
categories = _this$props3.categories,
|
|
132
|
+
onChangeCategory = _this$props3.onChangeCategory;
|
|
116
133
|
var category = categories[index];
|
|
117
|
-
|
|
118
134
|
if (!value) {
|
|
119
135
|
_this.setState({
|
|
120
136
|
dialog: {
|
|
@@ -137,26 +153,21 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
137
153
|
}));
|
|
138
154
|
}
|
|
139
155
|
});
|
|
140
|
-
(0, _defineProperty2["default"])(
|
|
156
|
+
(0, _defineProperty2["default"])(_this, "splitText", function (text, maxChar) {
|
|
141
157
|
var chunks = [];
|
|
142
|
-
|
|
143
158
|
while ((text || '').length > 0) {
|
|
144
159
|
var indexToSplit = void 0;
|
|
145
|
-
|
|
146
160
|
if (text.length > maxChar) {
|
|
147
161
|
indexToSplit = text.lastIndexOf(' ', maxChar);
|
|
148
|
-
|
|
149
162
|
if (indexToSplit === -1) {
|
|
150
163
|
indexToSplit = maxChar;
|
|
151
164
|
}
|
|
152
165
|
} else {
|
|
153
166
|
indexToSplit = text.length;
|
|
154
167
|
}
|
|
155
|
-
|
|
156
168
|
chunks.push(text.substring(0, indexToSplit));
|
|
157
169
|
text = text.substring(indexToSplit).trim();
|
|
158
170
|
}
|
|
159
|
-
|
|
160
171
|
return chunks;
|
|
161
172
|
});
|
|
162
173
|
_this.state = {
|
|
@@ -166,8 +177,8 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
166
177
|
};
|
|
167
178
|
return _this;
|
|
168
179
|
}
|
|
169
|
-
|
|
170
|
-
(0, _createClass2["default"])(TickComponent, [{
|
|
180
|
+
(0, _inherits2["default"])(TickComponent, _React$Component);
|
|
181
|
+
return (0, _createClass2["default"])(TickComponent, [{
|
|
171
182
|
key: "componentDidUpdate",
|
|
172
183
|
value: function componentDidUpdate(prevProps) {
|
|
173
184
|
if (this.props.autoFocus && !prevProps.autoFocus) {
|
|
@@ -178,47 +189,46 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
178
189
|
key: "render",
|
|
179
190
|
value: function render() {
|
|
180
191
|
var _this2 = this;
|
|
181
|
-
|
|
182
192
|
var _this$props4 = this.props,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
showCorrectness = _this$props4.showCorrectness;
|
|
202
|
-
|
|
193
|
+
categories = _this$props4.categories,
|
|
194
|
+
xBand = _this$props4.xBand,
|
|
195
|
+
bandWidth = _this$props4.bandWidth,
|
|
196
|
+
barWidth = _this$props4.barWidth,
|
|
197
|
+
rotate = _this$props4.rotate,
|
|
198
|
+
top = _this$props4.top,
|
|
199
|
+
graphProps = _this$props4.graphProps,
|
|
200
|
+
defineChart = _this$props4.defineChart,
|
|
201
|
+
chartingOptions = _this$props4.chartingOptions,
|
|
202
|
+
x = _this$props4.x,
|
|
203
|
+
y = _this$props4.y,
|
|
204
|
+
formattedValue = _this$props4.formattedValue,
|
|
205
|
+
changeInteractiveEnabled = _this$props4.changeInteractiveEnabled,
|
|
206
|
+
changeEditableEnabled = _this$props4.changeEditableEnabled,
|
|
207
|
+
error = _this$props4.error,
|
|
208
|
+
autoFocus = _this$props4.autoFocus,
|
|
209
|
+
hiddenLabelRef = _this$props4.hiddenLabelRef,
|
|
210
|
+
showCorrectness = _this$props4.showCorrectness;
|
|
203
211
|
if (!formattedValue) {
|
|
204
212
|
return null;
|
|
205
213
|
}
|
|
206
214
|
|
|
215
|
+
// Create classes object for TickCorrectnessIndicator compatibility
|
|
216
|
+
var classes = {
|
|
217
|
+
correctnessIcon: correctnessIconStyles,
|
|
218
|
+
incorrectIcon: incorrectIconStyles,
|
|
219
|
+
correctIcon: correctIconStyles
|
|
220
|
+
};
|
|
207
221
|
var dialog = this.state.dialog;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
changeInteractive = _ref.changeInteractive;
|
|
212
|
-
|
|
222
|
+
var _ref3 = chartingOptions || {},
|
|
223
|
+
changeEditable = _ref3.changeEditable,
|
|
224
|
+
changeInteractive = _ref3.changeInteractive;
|
|
213
225
|
var index = parseInt(formattedValue.split('-')[0], 10);
|
|
214
226
|
var category = categories[index];
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
correctness = _ref2.correctness;
|
|
221
|
-
|
|
227
|
+
var _ref4 = category || {},
|
|
228
|
+
editable = _ref4.editable,
|
|
229
|
+
interactive = _ref4.interactive,
|
|
230
|
+
label = _ref4.label,
|
|
231
|
+
correctness = _ref4.correctness;
|
|
222
232
|
var barX = xBand((0, _utils.bandKey)({
|
|
223
233
|
label: label
|
|
224
234
|
}, index));
|
|
@@ -265,8 +275,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
265
275
|
interactive: interactive,
|
|
266
276
|
classes: classes
|
|
267
277
|
})
|
|
268
|
-
})), error && index === 0 && /*#__PURE__*/_react["default"].createElement(
|
|
269
|
-
className: classes.error,
|
|
278
|
+
})), error && index === 0 && /*#__PURE__*/_react["default"].createElement(StyledErrorText, {
|
|
270
279
|
y: y + 23,
|
|
271
280
|
height: 6,
|
|
272
281
|
textAnchor: "start"
|
|
@@ -318,8 +327,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
318
327
|
pointerEvents: 'visible',
|
|
319
328
|
overflow: 'visible'
|
|
320
329
|
}
|
|
321
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
322
|
-
className: classes.customColor,
|
|
330
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
|
|
323
331
|
style: {
|
|
324
332
|
position: 'fixed'
|
|
325
333
|
},
|
|
@@ -336,8 +344,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
336
344
|
pointerEvents: 'visible',
|
|
337
345
|
overflow: 'visible'
|
|
338
346
|
}
|
|
339
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
340
|
-
className: classes.customColor,
|
|
347
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
|
|
341
348
|
style: {
|
|
342
349
|
position: 'fixed'
|
|
343
350
|
},
|
|
@@ -363,10 +370,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
363
370
|
})));
|
|
364
371
|
}
|
|
365
372
|
}]);
|
|
366
|
-
return TickComponent;
|
|
367
373
|
}(_react["default"].Component);
|
|
368
|
-
|
|
369
|
-
exports.TickComponent = TickComponent;
|
|
370
374
|
(0, _defineProperty2["default"])(TickComponent, "propTypes", {
|
|
371
375
|
defineChart: _propTypes["default"].bool,
|
|
372
376
|
error: _propTypes["default"].any
|
|
@@ -384,7 +388,6 @@ TickComponent.propTypes = {
|
|
|
384
388
|
formattedValue: _propTypes["default"].string,
|
|
385
389
|
onChangeCategory: _propTypes["default"].func,
|
|
386
390
|
onChange: _propTypes["default"].func,
|
|
387
|
-
classes: _propTypes["default"].object,
|
|
388
391
|
error: _propTypes["default"].object,
|
|
389
392
|
defineChart: _propTypes["default"].bool,
|
|
390
393
|
chartingOptions: _propTypes["default"].object,
|
|
@@ -394,45 +397,36 @@ TickComponent.propTypes = {
|
|
|
394
397
|
onAutoFocusUsed: _propTypes["default"].func,
|
|
395
398
|
showCorrectness: _propTypes["default"].bool
|
|
396
399
|
};
|
|
397
|
-
|
|
398
|
-
var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
399
|
-
(0, _inherits2["default"])(RawChartAxes, _React$Component2);
|
|
400
|
-
|
|
401
|
-
var _super2 = _createSuper(RawChartAxes);
|
|
402
|
-
|
|
400
|
+
var RawChartAxes = exports.RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
403
401
|
function RawChartAxes() {
|
|
404
402
|
var _this3;
|
|
405
|
-
|
|
406
403
|
(0, _classCallCheck2["default"])(this, RawChartAxes);
|
|
407
|
-
|
|
408
404
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
409
405
|
args[_key] = arguments[_key];
|
|
410
406
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
|
|
407
|
+
_this3 = _callSuper(this, RawChartAxes, [].concat(args));
|
|
408
|
+
(0, _defineProperty2["default"])(_this3, "state", {
|
|
414
409
|
height: 0,
|
|
415
410
|
width: 0
|
|
416
411
|
});
|
|
417
412
|
return _this3;
|
|
418
413
|
}
|
|
419
|
-
|
|
420
|
-
(0, _createClass2["default"])(RawChartAxes, [{
|
|
414
|
+
(0, _inherits2["default"])(RawChartAxes, _React$Component2);
|
|
415
|
+
return (0, _createClass2["default"])(RawChartAxes, [{
|
|
421
416
|
key: "componentDidMount",
|
|
422
417
|
value: function componentDidMount() {
|
|
423
418
|
if (this.hiddenLabelRef) {
|
|
424
419
|
var boundingClientRect = this.hiddenLabelRef.getBoundingClientRect();
|
|
425
|
-
var hiddenEl = this.hiddenLabelRef.current;
|
|
420
|
+
var hiddenEl = this.hiddenLabelRef.current;
|
|
426
421
|
|
|
422
|
+
// same logic used in dropdown.jsx for hidden labels width calculation
|
|
427
423
|
if (hiddenEl) {
|
|
428
424
|
var containsLatex = hiddenEl.querySelector('[data-latex], [data-raw]');
|
|
429
425
|
var hasMathJax = hiddenEl.querySelector('mjx-container');
|
|
430
426
|
var mathHandled = hiddenEl.querySelector('[data-math-handled="true"]');
|
|
431
|
-
|
|
432
427
|
if (containsLatex && (!mathHandled || !hasMathJax)) {
|
|
433
428
|
(0, _mathRendering.renderMath)(this.hiddenLabelRef);
|
|
434
429
|
}
|
|
435
|
-
|
|
436
430
|
this.setState({
|
|
437
431
|
height: Math.floor(boundingClientRect.height),
|
|
438
432
|
width: Math.floor(boundingClientRect.width)
|
|
@@ -445,7 +439,6 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
|
445
439
|
value: function componentDidUpdate(prevProps, prevState, snapshot) {
|
|
446
440
|
if (this.hiddenLabelRef) {
|
|
447
441
|
var width = Math.floor(this.hiddenLabelRef.getBoundingClientRect().width);
|
|
448
|
-
|
|
449
442
|
if (width !== this.state.width) {
|
|
450
443
|
this.setState({
|
|
451
444
|
width: width
|
|
@@ -457,69 +450,59 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
|
457
450
|
key: "render",
|
|
458
451
|
value: function render() {
|
|
459
452
|
var _this4 = this;
|
|
460
|
-
|
|
461
453
|
var _this$props5 = this.props,
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
range = _ref3$range === void 0 ? {} : _ref3$range,
|
|
489
|
-
_ref3$domain = _ref3.domain,
|
|
490
|
-
domain = _ref3$domain === void 0 ? {} : _ref3$domain,
|
|
491
|
-
_ref3$size = _ref3.size,
|
|
492
|
-
size = _ref3$size === void 0 ? {} : _ref3$size;
|
|
493
|
-
|
|
454
|
+
graphProps = _this$props5.graphProps,
|
|
455
|
+
xBand = _this$props5.xBand,
|
|
456
|
+
leftAxis = _this$props5.leftAxis,
|
|
457
|
+
onChange = _this$props5.onChange,
|
|
458
|
+
onChangeCategory = _this$props5.onChangeCategory,
|
|
459
|
+
_this$props5$categori = _this$props5.categories,
|
|
460
|
+
categories = _this$props5$categori === void 0 ? [] : _this$props5$categori,
|
|
461
|
+
top = _this$props5.top,
|
|
462
|
+
defineChart = _this$props5.defineChart,
|
|
463
|
+
chartingOptions = _this$props5.chartingOptions,
|
|
464
|
+
changeInteractiveEnabled = _this$props5.changeInteractiveEnabled,
|
|
465
|
+
changeEditableEnabled = _this$props5.changeEditableEnabled,
|
|
466
|
+
theme = _this$props5.theme,
|
|
467
|
+
autoFocus = _this$props5.autoFocus,
|
|
468
|
+
onAutoFocusUsed = _this$props5.onAutoFocusUsed,
|
|
469
|
+
error = _this$props5.error,
|
|
470
|
+
showCorrectness = _this$props5.showCorrectness;
|
|
471
|
+
var _ref5 = graphProps || {},
|
|
472
|
+
_ref5$scale = _ref5.scale,
|
|
473
|
+
scale = _ref5$scale === void 0 ? {} : _ref5$scale,
|
|
474
|
+
_ref5$range = _ref5.range,
|
|
475
|
+
range = _ref5$range === void 0 ? {} : _ref5$range,
|
|
476
|
+
_ref5$domain = _ref5.domain,
|
|
477
|
+
domain = _ref5$domain === void 0 ? {} : _ref5$domain,
|
|
478
|
+
_ref5$size = _ref5.size,
|
|
479
|
+
size = _ref5$size === void 0 ? {} : _ref5$size;
|
|
494
480
|
var _this$state = this.state,
|
|
495
|
-
|
|
496
|
-
|
|
481
|
+
height = _this$state.height,
|
|
482
|
+
width = _this$state.width;
|
|
497
483
|
var bottomScale = xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);
|
|
498
|
-
var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();
|
|
499
|
-
|
|
484
|
+
var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();
|
|
485
|
+
// for chartType "line", bandWidth will be 0, so we have to calculate it
|
|
500
486
|
var barWidth = bandWidth || scale.x && scale.x(domain.max) / categories.length;
|
|
501
487
|
var rowTickValues = (0, _utils.getTickValues)(_objectSpread(_objectSpread({}, range), {}, {
|
|
502
488
|
step: range.labelStep
|
|
503
489
|
}));
|
|
504
|
-
var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
|
|
505
|
-
|
|
506
|
-
var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height);
|
|
507
|
-
|
|
490
|
+
var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
|
|
491
|
+
// this mostly applies for labels that are not editable
|
|
492
|
+
var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height);
|
|
493
|
+
// this applies for labels that are editable
|
|
508
494
|
var rotateBecauseOfWidth = width > barWidth ? 25 : 0;
|
|
509
|
-
|
|
510
495
|
var getTickLabelProps = function getTickLabelProps(value) {
|
|
511
496
|
return {
|
|
512
497
|
dy: 4,
|
|
513
498
|
dx: -10 - (value.toLocaleString().length || 1) * 5
|
|
514
499
|
};
|
|
515
500
|
};
|
|
516
|
-
|
|
517
501
|
var getTickComponent = function getTickComponent(props) {
|
|
518
502
|
var properties = {
|
|
519
503
|
hiddenLabelRef: function hiddenLabelRef(ref) {
|
|
520
504
|
_this4.hiddenLabelRef = ref;
|
|
521
505
|
},
|
|
522
|
-
classes: classes,
|
|
523
506
|
categories: categories,
|
|
524
507
|
xBand: xBand,
|
|
525
508
|
bandWidth: bandWidth,
|
|
@@ -543,21 +526,15 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
|
543
526
|
};
|
|
544
527
|
return /*#__PURE__*/_react["default"].createElement(TickComponent, properties);
|
|
545
528
|
};
|
|
546
|
-
|
|
547
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
|
|
529
|
+
return /*#__PURE__*/_react["default"].createElement(StyledAxesGroup, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
|
|
548
530
|
scale: scale.y,
|
|
549
|
-
className: axis,
|
|
550
|
-
axisLineClassName: axisLine,
|
|
551
531
|
tickLength: 10,
|
|
552
|
-
tickClassName: tick,
|
|
553
532
|
tickFormat: function tickFormat(value) {
|
|
554
533
|
return value;
|
|
555
534
|
},
|
|
556
535
|
tickValues: rowTickValues,
|
|
557
536
|
tickLabelProps: getTickLabelProps
|
|
558
537
|
}), /*#__PURE__*/_react["default"].createElement(_axis.AxisBottom, {
|
|
559
|
-
axisLineClassName: axisLine,
|
|
560
|
-
tickClassName: tick,
|
|
561
538
|
scale: bottomScale,
|
|
562
539
|
labelProps: {
|
|
563
540
|
y: 60 + top
|
|
@@ -577,13 +554,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
|
|
|
577
554
|
}));
|
|
578
555
|
}
|
|
579
556
|
}]);
|
|
580
|
-
return RawChartAxes;
|
|
581
557
|
}(_react["default"].Component);
|
|
582
|
-
|
|
583
|
-
exports.RawChartAxes = RawChartAxes;
|
|
584
558
|
(0, _defineProperty2["default"])(RawChartAxes, "propTypes", {
|
|
585
559
|
bottomScale: _propTypes["default"].func,
|
|
586
|
-
classes: _propTypes["default"].object.isRequired,
|
|
587
560
|
categories: _propTypes["default"].array,
|
|
588
561
|
defineChart: _propTypes["default"].bool,
|
|
589
562
|
error: _propTypes["default"].any,
|
|
@@ -601,62 +574,9 @@ exports.RawChartAxes = RawChartAxes;
|
|
|
601
574
|
onAutoFocusUsed: _propTypes["default"].func,
|
|
602
575
|
showCorrectness: _propTypes["default"].bool
|
|
603
576
|
});
|
|
604
|
-
var ChartAxes = (0, _styles.
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
},
|
|
610
|
-
axisLine: {
|
|
611
|
-
stroke: _renderUi.color.visualElementsColors.AXIS_LINE_COLOR,
|
|
612
|
-
strokeWidth: 2
|
|
613
|
-
},
|
|
614
|
-
tick: {
|
|
615
|
-
'& > line': {
|
|
616
|
-
stroke: _renderUi.color.primaryDark(),
|
|
617
|
-
strokeWidth: 2
|
|
618
|
-
},
|
|
619
|
-
fontFamily: theme.typography.body1.fontFamily,
|
|
620
|
-
fontSize: theme.typography.fontSize,
|
|
621
|
-
textAnchor: 'middle'
|
|
622
|
-
},
|
|
623
|
-
dottedLine: {
|
|
624
|
-
stroke: _renderUi.color.primaryLight(),
|
|
625
|
-
opacity: 0.2
|
|
626
|
-
},
|
|
627
|
-
error: {
|
|
628
|
-
fontSize: theme.typography.fontSize - 2,
|
|
629
|
-
fill: theme.palette.error.main
|
|
630
|
-
},
|
|
631
|
-
customColor: {
|
|
632
|
-
color: "".concat(_renderUi.color.tertiary(), " !important")
|
|
633
|
-
},
|
|
634
|
-
correctnessIcon: {
|
|
635
|
-
borderRadius: theme.spacing.unit * 2,
|
|
636
|
-
color: _renderUi.color.defaults.WHITE,
|
|
637
|
-
fontSize: '16px',
|
|
638
|
-
width: '16px',
|
|
639
|
-
height: '16px',
|
|
640
|
-
padding: '2px',
|
|
641
|
-
border: "1px solid ".concat(_renderUi.color.defaults.WHITE),
|
|
642
|
-
boxSizing: 'unset' // to override the default border-box in IBX
|
|
643
|
-
|
|
644
|
-
},
|
|
645
|
-
incorrectIcon: {
|
|
646
|
-
backgroundColor: _renderUi.color.incorrectWithIcon()
|
|
647
|
-
},
|
|
648
|
-
correctIcon: {
|
|
649
|
-
backgroundColor: _renderUi.color.correct()
|
|
650
|
-
},
|
|
651
|
-
tickContainer: {
|
|
652
|
-
display: 'flex',
|
|
653
|
-
flexDirection: 'column',
|
|
654
|
-
alignItems: 'center'
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
}, {
|
|
658
|
-
withTheme: true
|
|
659
|
-
})(RawChartAxes);
|
|
660
|
-
var _default = ChartAxes;
|
|
661
|
-
exports["default"] = _default;
|
|
577
|
+
var ChartAxes = (0, _styles.styled)(RawChartAxes)(function (_ref6) {
|
|
578
|
+
var theme = _ref6.theme;
|
|
579
|
+
return {};
|
|
580
|
+
});
|
|
581
|
+
var _default = exports["default"] = ChartAxes;
|
|
662
582
|
//# sourceMappingURL=axes.js.map
|