@easyv/charts 1.4.16 → 1.4.18
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/.husky/commit-msg +1 -1
- package/lib/components/AnimateData.js +16 -8
- package/lib/components/Axis.js +128 -82
- package/lib/components/Background.js +24 -16
- package/lib/components/Band.js +89 -62
- package/lib/components/BaseLine.js +41 -29
- package/lib/components/Brush.js +46 -29
- package/lib/components/Carousel.js +40 -13
- package/lib/components/CartesianChart.js +98 -78
- package/lib/components/Chart.js +36 -23
- package/lib/components/ChartContainer.js +27 -18
- package/lib/components/ConicalGradient.js +68 -35
- package/lib/components/ExtentData.js +17 -9
- package/lib/components/FilterData.js +27 -16
- package/lib/components/Indicator.js +8 -6
- package/lib/components/Label.js +123 -83
- package/lib/components/Legend.js +66 -41
- package/lib/components/Lighter.js +48 -19
- package/lib/components/Line.js +59 -39
- package/lib/components/LinearGradient.js +20 -14
- package/lib/components/Mapping.js +34 -9
- package/lib/components/Marquee.js +30 -14
- package/lib/components/PieChart.js +400 -306
- package/lib/components/StackData.js +18 -8
- package/lib/components/StereoBar.js +105 -65
- package/lib/components/TextOverflow.js +25 -9
- package/lib/components/Tooltip.js +55 -41
- package/lib/components/index.js +27 -0
- package/lib/context/index.js +2 -0
- package/lib/element/ConicGradient.js +35 -29
- package/lib/element/Line.js +13 -9
- package/lib/element/index.js +2 -0
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/legend.js +41 -30
- package/lib/hooks/index.js +8 -0
- package/lib/hooks/useAnimateData.js +16 -3
- package/lib/hooks/useAxes.js +115 -65
- package/lib/hooks/useCarouselAxisX.js +56 -26
- package/lib/hooks/useExtentData.js +46 -14
- package/lib/hooks/useFilterData.js +29 -8
- package/lib/hooks/useStackData.js +30 -7
- package/lib/hooks/useTooltip.js +43 -26
- package/lib/index.js +15 -0
- package/lib/utils/index.js +247 -95
- package/package.json +1 -1
- package/src/components/CartesianChart.js +6 -6
- package/src/components/Label.js +8 -2
- package/src/components/TextOverflow.tsx +4 -1
package/.husky/commit-msg
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports["default"] = void 0;
|
|
11
|
+
|
|
9
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
10
14
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
11
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
12
18
|
var _hooks = require("../hooks");
|
|
19
|
+
|
|
13
20
|
var _excluded = ["dataAnimation"],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* 用来做图表数据改变(增长)动画(HOC)
|
|
17
|
-
*/
|
|
21
|
+
_excluded2 = ["data", "config"];
|
|
22
|
+
|
|
18
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
+
|
|
19
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
+
|
|
20
27
|
var _default = function _default(Component) {
|
|
21
28
|
return /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
22
29
|
var data = _ref.data,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
_ref$config = _ref.config,
|
|
31
|
+
dataAnimation = _ref$config.dataAnimation,
|
|
32
|
+
config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
|
|
33
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
|
|
27
34
|
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, rest, {
|
|
28
35
|
config: config,
|
|
29
36
|
originData: data,
|
|
@@ -31,4 +38,5 @@ var _default = function _default(Component) {
|
|
|
31
38
|
}));
|
|
32
39
|
});
|
|
33
40
|
};
|
|
41
|
+
|
|
34
42
|
exports["default"] = _default;
|
package/lib/components/Axis.js
CHANGED
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports["default"] = void 0;
|
|
11
|
+
|
|
9
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
10
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
11
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
+
|
|
12
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
13
20
|
var _utils = require("../utils");
|
|
21
|
+
|
|
14
22
|
var _context = require("../context");
|
|
23
|
+
|
|
15
24
|
var _element = require("../element");
|
|
25
|
+
|
|
16
26
|
var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
|
|
27
|
+
|
|
17
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
18
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
19
32
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
|
+
|
|
23
36
|
var defaultEvent = function defaultEvent() {};
|
|
37
|
+
|
|
24
38
|
var defaultAppearance = {
|
|
25
39
|
angle: 0,
|
|
26
40
|
count: 6,
|
|
@@ -34,17 +48,21 @@ var defaultAlign = {
|
|
|
34
48
|
};
|
|
35
49
|
var defaultOrientation = "bottom";
|
|
36
50
|
var defaultTickSize = 6;
|
|
51
|
+
|
|
37
52
|
var defaultFormatter = function defaultFormatter(d, _ref) {
|
|
38
53
|
var suffix = _ref.suffix;
|
|
39
54
|
return d + suffix;
|
|
40
55
|
};
|
|
56
|
+
|
|
41
57
|
var getAxesPath = function getAxesPath(orientation, _ref2) {
|
|
42
58
|
var width = _ref2.width,
|
|
43
|
-
|
|
59
|
+
height = _ref2.height;
|
|
60
|
+
|
|
44
61
|
switch (orientation) {
|
|
45
62
|
case "top":
|
|
46
63
|
case "bottom":
|
|
47
64
|
return "M-0.5, 0H" + width;
|
|
65
|
+
|
|
48
66
|
case "left":
|
|
49
67
|
case "right":
|
|
50
68
|
return "M0, -0.5V" + (height + 0.5);
|
|
@@ -60,6 +78,8 @@ var getAxesPath = function getAxesPath(orientation, _ref2) {
|
|
|
60
78
|
* directionY
|
|
61
79
|
* }
|
|
62
80
|
*/
|
|
81
|
+
|
|
82
|
+
|
|
63
83
|
var getLayout = function getLayout(orientation, rotate) {
|
|
64
84
|
switch (orientation) {
|
|
65
85
|
case "top":
|
|
@@ -68,18 +88,21 @@ var getLayout = function getLayout(orientation, rotate) {
|
|
|
68
88
|
directionX: 1,
|
|
69
89
|
directionY: -1
|
|
70
90
|
};
|
|
91
|
+
|
|
71
92
|
case "bottom":
|
|
72
93
|
return {
|
|
73
94
|
transform: "translate(-50%,0) rotate(".concat(rotate, "deg)"),
|
|
74
95
|
directionX: 1,
|
|
75
96
|
directionY: 1
|
|
76
97
|
};
|
|
98
|
+
|
|
77
99
|
case "left":
|
|
78
100
|
return {
|
|
79
101
|
transform: "translate(-100%,-50%) rotate(".concat(rotate, "deg)"),
|
|
80
102
|
directionX: -1,
|
|
81
103
|
directionY: 1
|
|
82
104
|
};
|
|
105
|
+
|
|
83
106
|
case "right":
|
|
84
107
|
return {
|
|
85
108
|
transform: "translate(0,-50%) rotate(".concat(rotate, "deg)"),
|
|
@@ -88,21 +111,23 @@ var getLayout = function getLayout(orientation, rotate) {
|
|
|
88
111
|
};
|
|
89
112
|
}
|
|
90
113
|
};
|
|
114
|
+
|
|
91
115
|
var AxisLine = function AxisLine(_ref3) {
|
|
92
116
|
var _ref3$orientation = _ref3.orientation,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
orientation = _ref3$orientation === void 0 ? defaultOrientation : _ref3$orientation,
|
|
118
|
+
_ref3$config = _ref3.config,
|
|
119
|
+
show = _ref3$config.show,
|
|
120
|
+
color = _ref3$config.color,
|
|
121
|
+
lineWidth = _ref3$config.lineWidth,
|
|
122
|
+
_ref3$isClipAxis = _ref3.isClipAxis,
|
|
123
|
+
isClipAxis = _ref3$isClipAxis === void 0 ? false : _ref3$isClipAxis,
|
|
124
|
+
_ref3$clipAxisRange = _ref3.clipAxisRange,
|
|
125
|
+
clipAxisRange = _ref3$clipAxisRange === void 0 ? [] : _ref3$clipAxisRange;
|
|
102
126
|
if (!show) return null;
|
|
103
127
|
var context = (0, _react.useContext)(_context.chartContext);
|
|
104
128
|
var width = context.width,
|
|
105
|
-
|
|
129
|
+
height = context.height;
|
|
130
|
+
|
|
106
131
|
if (isClipAxis) {
|
|
107
132
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clipAxisRange.map(function (range, index) {
|
|
108
133
|
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
@@ -120,23 +145,24 @@ var AxisLine = function AxisLine(_ref3) {
|
|
|
120
145
|
});
|
|
121
146
|
}
|
|
122
147
|
};
|
|
148
|
+
|
|
123
149
|
var Unit = function Unit(_ref4) {
|
|
124
150
|
var _ref4$config = _ref4.config,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
151
|
+
show = _ref4$config.show,
|
|
152
|
+
text = _ref4$config.text,
|
|
153
|
+
_ref4$config$font = _ref4$config.font,
|
|
154
|
+
bold = _ref4$config$font.bold,
|
|
155
|
+
color = _ref4$config$font.color,
|
|
156
|
+
fontFamily = _ref4$config$font.fontFamily,
|
|
157
|
+
fontSize = _ref4$config$font.fontSize,
|
|
158
|
+
italic = _ref4$config$font.italic,
|
|
159
|
+
letterSpacing = _ref4$config$font.letterSpacing,
|
|
160
|
+
_ref4$config$translat = _ref4$config.translate,
|
|
161
|
+
translateX = _ref4$config$translat.x,
|
|
162
|
+
translateY = _ref4$config$translat.y,
|
|
163
|
+
_ref4$config$align = _ref4$config.align;
|
|
164
|
+
_ref4$config$align = _ref4$config$align === void 0 ? defaultAlign : _ref4$config$align;
|
|
165
|
+
var textAnchor = _ref4$config$align.textAnchor;
|
|
140
166
|
if (!show) return null;
|
|
141
167
|
return /*#__PURE__*/_react["default"].createElement("text", {
|
|
142
168
|
className: "__easyv-unit",
|
|
@@ -150,42 +176,48 @@ var Unit = function Unit(_ref4) {
|
|
|
150
176
|
textAnchor: textAnchor
|
|
151
177
|
}, text);
|
|
152
178
|
};
|
|
179
|
+
|
|
153
180
|
var Label = function Label(_ref5) {
|
|
154
181
|
var className = _ref5.className,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
_ref5$orientation = _ref5.orientation,
|
|
183
|
+
orientation = _ref5$orientation === void 0 ? defaultOrientation : _ref5$orientation,
|
|
184
|
+
label = _ref5.label,
|
|
185
|
+
coordinate = _ref5.coordinate,
|
|
186
|
+
_ref5$formatter = _ref5.formatter,
|
|
187
|
+
formatter = _ref5$formatter === void 0 ? defaultFormatter : _ref5$formatter,
|
|
188
|
+
tickSize = _ref5.tickSize,
|
|
189
|
+
_ref5$rotate = _ref5.rotate,
|
|
190
|
+
rotate = _ref5$rotate === void 0 ? 0 : _ref5$rotate,
|
|
191
|
+
config = _ref5.config,
|
|
192
|
+
_ref5$onClick = _ref5.onClick,
|
|
193
|
+
onClick = _ref5$onClick === void 0 ? defaultEvent : _ref5$onClick,
|
|
194
|
+
_ref5$config = _ref5.config,
|
|
195
|
+
show = _ref5$config.show,
|
|
196
|
+
style = _ref5$config.style,
|
|
197
|
+
_ref5$config$translat = _ref5$config.translate,
|
|
198
|
+
translateX = _ref5$config$translat.x,
|
|
199
|
+
translateY = _ref5$config$translat.y,
|
|
200
|
+
font = _ref5$config.font,
|
|
201
|
+
_ref5$config$appearan = _ref5$config.appearance;
|
|
202
|
+
_ref5$config$appearan = _ref5$config$appearan === void 0 ? defaultAppearance : _ref5$config$appearan;
|
|
203
|
+
var width = _ref5$config$appearan.width,
|
|
204
|
+
speed = _ref5$config$appearan.speed,
|
|
205
|
+
textOverflow = _ref5$config$appearan.textOverflow;
|
|
179
206
|
if (!show) return null;
|
|
207
|
+
|
|
180
208
|
var _label = formatter(label, config);
|
|
209
|
+
|
|
181
210
|
var _getLayout = getLayout(orientation, rotate),
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
211
|
+
transform = _getLayout.transform,
|
|
212
|
+
directionX = _getLayout.directionX,
|
|
213
|
+
directionY = _getLayout.directionY;
|
|
214
|
+
|
|
185
215
|
var isVertical = orientation == "left" || orientation == "right";
|
|
186
216
|
var x = (isVertical ? tickSize * directionX : coordinate) + translateX * directionX;
|
|
187
217
|
var y = (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
|
|
218
|
+
|
|
188
219
|
var _style = style && ((0, _typeof2["default"])(style) == "object" ? style : style(_label));
|
|
220
|
+
|
|
189
221
|
return /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
190
222
|
width: "1",
|
|
191
223
|
height: "1",
|
|
@@ -213,41 +245,47 @@ var Label = function Label(_ref5) {
|
|
|
213
245
|
}
|
|
214
246
|
})));
|
|
215
247
|
};
|
|
248
|
+
|
|
216
249
|
var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
217
250
|
var orientation = _ref6.orientation,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
251
|
+
scaler = _ref6.scaler,
|
|
252
|
+
_ref6$tickSize = _ref6.tickSize,
|
|
253
|
+
tickSize = _ref6$tickSize === void 0 ? defaultTickSize : _ref6$tickSize,
|
|
254
|
+
ticks = _ref6.ticks,
|
|
255
|
+
formatter = _ref6.formatter,
|
|
256
|
+
rotate = _ref6.rotate,
|
|
257
|
+
triggerClick = _ref6.triggerClick,
|
|
258
|
+
_ref6$config = _ref6.config,
|
|
259
|
+
on = _ref6$config.on,
|
|
260
|
+
label = _ref6$config.label,
|
|
261
|
+
axisLine = _ref6$config.axisLine,
|
|
262
|
+
tickLine = _ref6$config.tickLine,
|
|
263
|
+
gridLine = _ref6$config.gridLine,
|
|
264
|
+
unit = _ref6$config.unit,
|
|
265
|
+
config = _ref6.config,
|
|
266
|
+
positions = _ref6.positions,
|
|
267
|
+
xLineRange = _ref6.xLineRange,
|
|
268
|
+
_ref6$isClipAxis = _ref6.isClipAxis,
|
|
269
|
+
isClipAxis = _ref6$isClipAxis === void 0 ? false : _ref6$isClipAxis,
|
|
270
|
+
yLineRange = _ref6.yLineRange,
|
|
271
|
+
clipAxisRange = _ref6.clipAxisRange;
|
|
239
272
|
if (!(on && ticks.length > 0)) return null;
|
|
273
|
+
|
|
240
274
|
var _useContext = (0, _react.useContext)(_context.chartContext),
|
|
241
|
-
|
|
242
|
-
|
|
275
|
+
width = _useContext.width,
|
|
276
|
+
height = _useContext.height;
|
|
277
|
+
|
|
243
278
|
var x = orientation == "right" ? width : 0;
|
|
244
279
|
var y = orientation == "bottom" ? height : 0;
|
|
280
|
+
|
|
245
281
|
function drawYAxisTickLine() {
|
|
246
282
|
var draw = function draw(ticks, scaler) {
|
|
247
283
|
return ticks.map(function (tick, index) {
|
|
248
284
|
var coordinate = scaler(tick);
|
|
249
285
|
if (isNaN(coordinate)) return null;
|
|
286
|
+
|
|
250
287
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
288
|
+
|
|
251
289
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
252
290
|
orientation: orientation,
|
|
253
291
|
coordinate: coordinate,
|
|
@@ -266,6 +304,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
266
304
|
})));
|
|
267
305
|
});
|
|
268
306
|
};
|
|
307
|
+
|
|
269
308
|
if (isClipAxis) {
|
|
270
309
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
|
|
271
310
|
return draw(ticks, scaler[index]);
|
|
@@ -274,12 +313,15 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
274
313
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
|
|
275
314
|
}
|
|
276
315
|
}
|
|
316
|
+
|
|
277
317
|
function drawLabel() {
|
|
278
318
|
var draw = function draw(ticks, scaler) {
|
|
279
319
|
return ticks.map(function (tick, index) {
|
|
280
320
|
var coordinate = scaler(tick);
|
|
281
321
|
if (isNaN(coordinate)) return null;
|
|
322
|
+
|
|
282
323
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
324
|
+
|
|
283
325
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
284
326
|
orientation: orientation,
|
|
285
327
|
coordinate: coordinate,
|
|
@@ -305,6 +347,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
305
347
|
}, gridCoord)));
|
|
306
348
|
});
|
|
307
349
|
};
|
|
350
|
+
|
|
308
351
|
if (isClipAxis) {
|
|
309
352
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
|
|
310
353
|
return draw(ticks, scaler[index]);
|
|
@@ -313,11 +356,11 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
313
356
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
|
|
314
357
|
}
|
|
315
358
|
}
|
|
316
|
-
|
|
317
|
-
// 依据positions来区分x轴y轴,有position为x轴
|
|
359
|
+
|
|
360
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, axisLine && tickLine && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, axisLine && ( // 依据positions来区分x轴y轴,有position为x轴
|
|
318
361
|
positions && positions.length ? positions.map(function (_ref7, index) {
|
|
319
362
|
var x = _ref7.x,
|
|
320
|
-
|
|
363
|
+
y = _ref7.y;
|
|
321
364
|
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
322
365
|
key: index,
|
|
323
366
|
transform: "translate(" + x + ", " + y + ")"
|
|
@@ -327,7 +370,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
327
370
|
}), tickLine && ticks.map(function (tick, index) {
|
|
328
371
|
var coordinate = scaler(tick);
|
|
329
372
|
if (isNaN(coordinate)) return null;
|
|
373
|
+
|
|
330
374
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
375
|
+
|
|
331
376
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
332
377
|
orientation: orientation,
|
|
333
378
|
coordinate: coordinate,
|
|
@@ -358,4 +403,5 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref6) {
|
|
|
358
403
|
config: unit
|
|
359
404
|
})));
|
|
360
405
|
});
|
|
406
|
+
|
|
361
407
|
exports["default"] = _default;
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
9
12
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
10
14
|
var _utils = require("../utils");
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* 轴类图背景
|
|
13
18
|
*/
|
|
14
19
|
var _default = function _default(_ref) {
|
|
15
20
|
var _ref$axis = _ref.axis,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
ticks = _ref$axis.ticks,
|
|
22
|
+
scaler = _ref$axis.scaler,
|
|
23
|
+
step = _ref$axis.step,
|
|
24
|
+
direction = _ref$axis.direction,
|
|
25
|
+
bandLength = _ref.bandLength,
|
|
26
|
+
_ref$config = _ref.config,
|
|
27
|
+
background = _ref$config.background,
|
|
28
|
+
paddingInner = _ref$config.seriesIntervalWidth,
|
|
29
|
+
paddingOuter = _ref$config.paddingInner,
|
|
30
|
+
length = _ref.length;
|
|
26
31
|
var isVertical = direction === 'vertical';
|
|
32
|
+
|
|
27
33
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
step: step,
|
|
35
|
+
bandLength: bandLength,
|
|
36
|
+
paddingInner: paddingInner,
|
|
37
|
+
paddingOuter: paddingOuter
|
|
38
|
+
}),
|
|
39
|
+
bandwidth = _getSeriesInfo.width;
|
|
40
|
+
|
|
34
41
|
var size = isVertical ? {
|
|
35
42
|
width: length,
|
|
36
43
|
height: bandwidth
|
|
@@ -49,4 +56,5 @@ var _default = function _default(_ref) {
|
|
|
49
56
|
}));
|
|
50
57
|
});
|
|
51
58
|
};
|
|
59
|
+
|
|
52
60
|
exports["default"] = _default;
|