@easyv/charts 1.6.8 → 1.6.10
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/lib/components/AnimateData.js +13 -22
- package/lib/components/Axis.js +106 -153
- package/lib/components/Background.js +18 -27
- package/lib/components/Band.js +79 -105
- package/lib/components/BaseLine.js +38 -52
- package/lib/components/Brush.js +31 -49
- package/lib/components/Carousel.js +20 -48
- package/lib/components/CartesianChart.js +136 -195
- package/lib/components/Chart.js +37 -59
- package/lib/components/ChartContainer.js +23 -33
- package/lib/components/ConicalGradient.js +38 -72
- package/lib/components/Control.js +61 -101
- package/lib/components/ExtentData.js +13 -22
- package/lib/components/FilterData.js +20 -32
- package/lib/components/Indicator.js +18 -26
- package/lib/components/Label.js +90 -121
- package/lib/components/Legend.js +48 -74
- package/lib/components/Lighter.js +22 -52
- package/lib/components/Line.js +41 -62
- package/lib/components/LinearGradient.js +16 -23
- package/lib/components/Mapping.js +15 -41
- package/lib/components/Marquee.js +23 -40
- package/lib/components/PieChart.js +352 -456
- package/lib/components/StackData.js +12 -23
- package/lib/components/StereoBar.js +69 -110
- package/lib/components/TextOverflow.js +17 -31
- package/lib/components/Tooltip.js +50 -65
- package/lib/components/index.js +1 -31
- package/lib/components/pieTooltip.js +46 -74
- package/lib/context/index.js +1 -4
- package/lib/css/index.module.css +1 -1
- package/lib/element/ConicGradient.js +31 -37
- package/lib/element/Line.js +11 -16
- package/lib/element/index.js +0 -2
- package/lib/formatter/index.js +0 -2
- package/lib/formatter/legend.js +48 -48
- package/lib/hooks/index.js +0 -9
- package/lib/hooks/useAiData.js +16 -27
- package/lib/hooks/useAnimateData.js +7 -21
- package/lib/hooks/useAxes.js +89 -151
- package/lib/hooks/useCarouselAxisX.js +30 -64
- package/lib/hooks/useExtentData.js +24 -65
- package/lib/hooks/useFilterData.js +16 -42
- package/lib/hooks/useStackData.js +11 -35
- package/lib/hooks/useTooltip.js +29 -47
- package/lib/index.js +2 -17
- package/lib/utils/index.js +138 -325
- package/package.json +1 -1
- package/src/components/Band.tsx +1 -1
- package/src/components/CartesianChart.js +2 -2
- package/src/css/index.module.css +1 -1
- package/src/formatter/legend.js +13 -1
|
@@ -1,37 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
12
|
var _hooks = require("../hooks");
|
|
19
|
-
|
|
20
13
|
var _excluded = ["dataAnimation"],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
var _default = function _default(Component) {
|
|
14
|
+
_excluded2 = ["data", "config", "active"];
|
|
15
|
+
/**
|
|
16
|
+
* 用来做图表数据改变(增长)动画(HOC)
|
|
17
|
+
*/
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
20
|
+
var _default = exports["default"] = function _default(Component) {
|
|
28
21
|
return /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
29
22
|
var data = _ref.data,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
_ref$config = _ref.config,
|
|
24
|
+
dataAnimation = _ref$config.dataAnimation,
|
|
25
|
+
config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
|
|
26
|
+
active = _ref.active,
|
|
27
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
|
|
35
28
|
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, rest, {
|
|
36
29
|
config: config,
|
|
37
30
|
originData: data,
|
|
@@ -39,6 +32,4 @@ var _default = function _default(Component) {
|
|
|
39
32
|
data: (0, _hooks.useAnimateData)(data, dataAnimation, active)
|
|
40
33
|
}));
|
|
41
34
|
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports["default"] = _default;
|
|
35
|
+
};
|
package/lib/components/Axis.js
CHANGED
|
@@ -1,40 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
13
|
var _utils = require("../utils");
|
|
21
|
-
|
|
22
14
|
var _context = require("../context");
|
|
23
|
-
|
|
24
15
|
var _element = require("../element");
|
|
25
|
-
|
|
26
16
|
var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
17
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
|
+
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; }
|
|
20
|
+
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; } /**
|
|
21
|
+
* x, y, z轴
|
|
22
|
+
*/
|
|
36
23
|
var defaultEvent = function defaultEvent() {};
|
|
37
|
-
|
|
38
24
|
var defaultAppearance = {
|
|
39
25
|
angle: 0,
|
|
40
26
|
count: 6,
|
|
@@ -48,21 +34,17 @@ var defaultAlign = {
|
|
|
48
34
|
};
|
|
49
35
|
var defaultOrientation = "bottom";
|
|
50
36
|
var defaultTickSize = 6;
|
|
51
|
-
|
|
52
37
|
var defaultFormatter = function defaultFormatter(d, _ref) {
|
|
53
38
|
var suffix = _ref.suffix;
|
|
54
39
|
return d + suffix;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
var getAxesPath = function getAxesPath(orientation, _ref2, cHeight, cPercent) {
|
|
58
42
|
var width = _ref2.width,
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
height = _ref2.height;
|
|
61
44
|
switch (orientation) {
|
|
62
45
|
case "top":
|
|
63
46
|
case "bottom":
|
|
64
47
|
return "M-0.5, 0H" + width / cPercent;
|
|
65
|
-
|
|
66
48
|
case "left":
|
|
67
49
|
case "right":
|
|
68
50
|
return "M0, -0.5V" + (height + 0.5 - cHeight);
|
|
@@ -78,8 +60,6 @@ var getAxesPath = function getAxesPath(orientation, _ref2, cHeight, cPercent) {
|
|
|
78
60
|
* directionY
|
|
79
61
|
* }
|
|
80
62
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
63
|
var getLayout = function getLayout(orientation, rotate) {
|
|
84
64
|
switch (orientation) {
|
|
85
65
|
case "top":
|
|
@@ -88,21 +68,18 @@ var getLayout = function getLayout(orientation, rotate) {
|
|
|
88
68
|
directionX: 1,
|
|
89
69
|
directionY: -1
|
|
90
70
|
};
|
|
91
|
-
|
|
92
71
|
case "bottom":
|
|
93
72
|
return {
|
|
94
73
|
transform: "translate(-50%,0) rotate(".concat(rotate, "deg)"),
|
|
95
74
|
directionX: 1,
|
|
96
75
|
directionY: 1
|
|
97
76
|
};
|
|
98
|
-
|
|
99
77
|
case "left":
|
|
100
78
|
return {
|
|
101
79
|
transform: "translate(-100%,-50%) rotate(".concat(rotate, "deg)"),
|
|
102
80
|
directionX: -1,
|
|
103
81
|
directionY: 1
|
|
104
82
|
};
|
|
105
|
-
|
|
106
83
|
case "right":
|
|
107
84
|
return {
|
|
108
85
|
transform: "translate(0,-50%) rotate(".concat(rotate, "deg)"),
|
|
@@ -111,24 +88,22 @@ var getLayout = function getLayout(orientation, rotate) {
|
|
|
111
88
|
};
|
|
112
89
|
}
|
|
113
90
|
};
|
|
114
|
-
|
|
115
91
|
var AxisLine = function AxisLine(_ref3) {
|
|
116
92
|
var _ref3$orientation = _ref3.orientation,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
93
|
+
orientation = _ref3$orientation === void 0 ? defaultOrientation : _ref3$orientation,
|
|
94
|
+
_ref3$config = _ref3.config,
|
|
95
|
+
show = _ref3$config.show,
|
|
96
|
+
color = _ref3$config.color,
|
|
97
|
+
lineWidth = _ref3$config.lineWidth,
|
|
98
|
+
cHeight = _ref3$config.cHeight,
|
|
99
|
+
_ref3$isClipAxis = _ref3.isClipAxis,
|
|
100
|
+
isClipAxis = _ref3$isClipAxis === void 0 ? false : _ref3$isClipAxis,
|
|
101
|
+
_ref3$clipAxisRange = _ref3.clipAxisRange,
|
|
102
|
+
clipAxisRange = _ref3$clipAxisRange === void 0 ? [] : _ref3$clipAxisRange,
|
|
103
|
+
_ref3$cPercent = _ref3.cPercent,
|
|
104
|
+
cPercent = _ref3$cPercent === void 0 ? 1 : _ref3$cPercent;
|
|
129
105
|
if (!show) return null;
|
|
130
106
|
var context = (0, _react.useContext)(_context.chartContext);
|
|
131
|
-
|
|
132
107
|
if (isClipAxis) {
|
|
133
108
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clipAxisRange.map(function (range, index) {
|
|
134
109
|
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
@@ -146,25 +121,24 @@ var AxisLine = function AxisLine(_ref3) {
|
|
|
146
121
|
});
|
|
147
122
|
}
|
|
148
123
|
};
|
|
149
|
-
|
|
150
124
|
var Unit = function Unit(_ref4) {
|
|
151
125
|
var _ref4$config = _ref4.config,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
126
|
+
show = _ref4$config.show,
|
|
127
|
+
text = _ref4$config.text,
|
|
128
|
+
_ref4$config$font = _ref4$config.font,
|
|
129
|
+
bold = _ref4$config$font.bold,
|
|
130
|
+
color = _ref4$config$font.color,
|
|
131
|
+
fontFamily = _ref4$config$font.fontFamily,
|
|
132
|
+
fontSize = _ref4$config$font.fontSize,
|
|
133
|
+
italic = _ref4$config$font.italic,
|
|
134
|
+
letterSpacing = _ref4$config$font.letterSpacing,
|
|
135
|
+
_ref4$config$translat = _ref4$config.translate,
|
|
136
|
+
translateX = _ref4$config$translat.x,
|
|
137
|
+
translateY = _ref4$config$translat.y,
|
|
138
|
+
_ref4$config$align = _ref4$config.align,
|
|
139
|
+
_ref4$config$align2 = _ref4$config$align === void 0 ? defaultAlign : _ref4$config$align,
|
|
140
|
+
textAnchor = _ref4$config$align2.textAnchor,
|
|
141
|
+
dataUnit = _ref4.dataUnit;
|
|
168
142
|
if (!show) return null;
|
|
169
143
|
return /*#__PURE__*/_react["default"].createElement("text", {
|
|
170
144
|
className: "__easyv-unit",
|
|
@@ -178,57 +152,52 @@ var Unit = function Unit(_ref4) {
|
|
|
178
152
|
textAnchor: textAnchor
|
|
179
153
|
}, dataUnit || text);
|
|
180
154
|
};
|
|
181
|
-
|
|
182
155
|
var Label = function Label(_ref5) {
|
|
183
156
|
var className = _ref5.className,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
157
|
+
_ref5$orientation = _ref5.orientation,
|
|
158
|
+
orientation = _ref5$orientation === void 0 ? defaultOrientation : _ref5$orientation,
|
|
159
|
+
label = _ref5.label,
|
|
160
|
+
_ref5$iosTrans = _ref5.iosTrans,
|
|
161
|
+
isIOS = _ref5$iosTrans.isIOS,
|
|
162
|
+
iosX = _ref5$iosTrans.x,
|
|
163
|
+
iosY = _ref5$iosTrans.y,
|
|
164
|
+
coordinate = _ref5.coordinate,
|
|
165
|
+
_ref5$formatter = _ref5.formatter,
|
|
166
|
+
formatter = _ref5$formatter === void 0 ? defaultFormatter : _ref5$formatter,
|
|
167
|
+
tickSize = _ref5.tickSize,
|
|
168
|
+
_ref5$rotate = _ref5.rotate,
|
|
169
|
+
rotate = _ref5$rotate === void 0 ? 0 : _ref5$rotate,
|
|
170
|
+
config = _ref5.config,
|
|
171
|
+
_ref5$onClick = _ref5.onClick,
|
|
172
|
+
onClick = _ref5$onClick === void 0 ? defaultEvent : _ref5$onClick,
|
|
173
|
+
_ref5$config = _ref5.config,
|
|
174
|
+
show = _ref5$config.show,
|
|
175
|
+
style = _ref5$config.style,
|
|
176
|
+
_ref5$config$translat = _ref5$config.translate,
|
|
177
|
+
translateX = _ref5$config$translat.x,
|
|
178
|
+
translateY = _ref5$config$translat.y,
|
|
179
|
+
font = _ref5$config.font,
|
|
180
|
+
_ref5$config$textAlig = _ref5$config.textAlign,
|
|
181
|
+
textAlign = _ref5$config$textAlig === void 0 ? "center" : _ref5$config$textAlig,
|
|
182
|
+
_ref5$config$appearan = _ref5$config.appearance,
|
|
183
|
+
_ref5$config$appearan2 = _ref5$config$appearan === void 0 ? defaultAppearance : _ref5$config$appearan,
|
|
184
|
+
width = _ref5$config$appearan2.width,
|
|
185
|
+
speed = _ref5$config$appearan2.speed,
|
|
186
|
+
textOverflow = _ref5$config$appearan2.textOverflow;
|
|
214
187
|
if (!show) return null;
|
|
215
|
-
|
|
216
188
|
var _label = formatter(label, config);
|
|
217
|
-
|
|
218
189
|
var _getLayout = getLayout(orientation, rotate),
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
190
|
+
transform = _getLayout.transform,
|
|
191
|
+
directionX = _getLayout.directionX,
|
|
192
|
+
directionY = _getLayout.directionY;
|
|
223
193
|
var isVertical = orientation == "left" || orientation == "right";
|
|
224
194
|
var x = (isVertical ? tickSize * directionX : coordinate) + translateX * directionX;
|
|
225
195
|
var y = (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
|
|
226
|
-
|
|
227
196
|
var _style = style && ((0, _typeof2["default"])(style) == "object" ? style : style(_label));
|
|
228
|
-
|
|
229
197
|
return /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
230
198
|
width: "1",
|
|
231
|
-
height: "1"
|
|
199
|
+
height: "1"
|
|
200
|
+
// x={x}
|
|
232
201
|
// y={y}
|
|
233
202
|
,
|
|
234
203
|
style: {
|
|
@@ -259,58 +228,52 @@ var Label = function Label(_ref5) {
|
|
|
259
228
|
}
|
|
260
229
|
})));
|
|
261
230
|
};
|
|
262
|
-
|
|
263
|
-
var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
|
|
231
|
+
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
|
|
264
232
|
var orientation = _ref6.orientation,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
233
|
+
scaler = _ref6.scaler,
|
|
234
|
+
_ref6$tickSize = _ref6.tickSize,
|
|
235
|
+
tickSize = _ref6$tickSize === void 0 ? defaultTickSize : _ref6$tickSize,
|
|
236
|
+
ticks = _ref6.ticks,
|
|
237
|
+
formatter = _ref6.formatter,
|
|
238
|
+
rotate = _ref6.rotate,
|
|
239
|
+
triggerClick = _ref6.triggerClick,
|
|
240
|
+
_ref6$config = _ref6.config,
|
|
241
|
+
on = _ref6$config.on,
|
|
242
|
+
label = _ref6$config.label,
|
|
243
|
+
axisLine = _ref6$config.axisLine,
|
|
244
|
+
tickLine = _ref6$config.tickLine,
|
|
245
|
+
gridLine = _ref6$config.gridLine,
|
|
246
|
+
unit = _ref6$config.unit,
|
|
247
|
+
_ref6$margin = _ref6.margin,
|
|
248
|
+
marginLeft = _ref6$margin.marginLeft,
|
|
249
|
+
marginTop = _ref6$margin.marginTop,
|
|
250
|
+
positions = _ref6.positions,
|
|
251
|
+
xLineRange = _ref6.xLineRange,
|
|
252
|
+
dataUnit = _ref6.dataUnit,
|
|
253
|
+
range = _ref6.range,
|
|
254
|
+
axisType = _ref6.axisType,
|
|
255
|
+
_ref6$isClipAxis = _ref6.isClipAxis,
|
|
256
|
+
isClipAxis = _ref6$isClipAxis === void 0 ? false : _ref6$isClipAxis,
|
|
257
|
+
yLineRange = _ref6.yLineRange,
|
|
258
|
+
clipAxisRange = _ref6.clipAxisRange,
|
|
259
|
+
controlInfo = _ref6.controlInfo,
|
|
260
|
+
rawTicks = _ref6.rawTicks;
|
|
293
261
|
if (!(on && ticks.length > 0)) return null;
|
|
294
|
-
|
|
295
262
|
var _useContext = (0, _react.useContext)(_context.chartContext),
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
263
|
+
width = _useContext.width,
|
|
264
|
+
height = _useContext.height,
|
|
265
|
+
isIOS = _useContext.isIOS;
|
|
300
266
|
var cHeight = controlInfo.cHeight,
|
|
301
|
-
|
|
302
|
-
|
|
267
|
+
isC = controlInfo.isC,
|
|
268
|
+
cPercent = controlInfo.cPercent;
|
|
303
269
|
var x = orientation == "right" ? width : 0;
|
|
304
270
|
var y = orientation == "bottom" ? height - cHeight : 0;
|
|
305
|
-
|
|
306
271
|
function drawAxisTickLine() {
|
|
307
272
|
var draw = function draw(ticks, scaler) {
|
|
308
273
|
return ticks.map(function (tick, index) {
|
|
309
274
|
var coordinate = scaler(tick);
|
|
310
275
|
if (isNaN(coordinate)) return null;
|
|
311
|
-
|
|
312
276
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
313
|
-
|
|
314
277
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
315
278
|
orientation: orientation,
|
|
316
279
|
coordinate: coordinate,
|
|
@@ -329,7 +292,6 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
329
292
|
})));
|
|
330
293
|
});
|
|
331
294
|
};
|
|
332
|
-
|
|
333
295
|
if (isClipAxis) {
|
|
334
296
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
|
|
335
297
|
return draw(ticks, scaler[index]);
|
|
@@ -340,15 +302,12 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
340
302
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
|
|
341
303
|
}
|
|
342
304
|
}
|
|
343
|
-
|
|
344
305
|
function drawLabel() {
|
|
345
306
|
var draw = function draw(ticks, scaler) {
|
|
346
307
|
return ticks.map(function (tick, index) {
|
|
347
308
|
var coordinate = scaler(tick);
|
|
348
309
|
if (isNaN(coordinate)) return null;
|
|
349
|
-
|
|
350
310
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
351
|
-
|
|
352
311
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
353
312
|
orientation: orientation,
|
|
354
313
|
coordinate: coordinate,
|
|
@@ -379,7 +338,6 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
379
338
|
}, gridCoord)));
|
|
380
339
|
});
|
|
381
340
|
};
|
|
382
|
-
|
|
383
341
|
if (isClipAxis) {
|
|
384
342
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
|
|
385
343
|
return draw(ticks, scaler[index]);
|
|
@@ -390,10 +348,9 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
390
348
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
|
|
391
349
|
}
|
|
392
350
|
}
|
|
393
|
-
|
|
394
351
|
return /*#__PURE__*/_react["default"].createElement("g", null, axisLine && tickLine && !isC && /*#__PURE__*/_react["default"].createElement("g", null, axisLine && (positions && positions.length ? positions.map(function (_ref7, index) {
|
|
395
352
|
var x = _ref7.x,
|
|
396
|
-
|
|
353
|
+
y = _ref7.y;
|
|
397
354
|
return /*#__PURE__*/_react["default"].createElement("g", {
|
|
398
355
|
key: index,
|
|
399
356
|
transform: "translate(" + x + ", " + y + ")"
|
|
@@ -406,9 +363,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
406
363
|
}), tickLine && ticks.map(function (tick, index) {
|
|
407
364
|
var coordinate = scaler(tick);
|
|
408
365
|
if (isNaN(coordinate)) return null;
|
|
409
|
-
|
|
410
366
|
var _tickSize = tickLine.tickSize || tickSize;
|
|
411
|
-
|
|
412
367
|
var gridCoord = (0, _utils.getGridCoord)({
|
|
413
368
|
orientation: orientation,
|
|
414
369
|
coordinate: coordinate,
|
|
@@ -457,6 +412,4 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
457
412
|
config: unit,
|
|
458
413
|
dataUnit: dataUnit
|
|
459
414
|
})))));
|
|
460
|
-
}));
|
|
461
|
-
|
|
462
|
-
exports["default"] = _default;
|
|
415
|
+
}));
|
|
@@ -1,43 +1,36 @@
|
|
|
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"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
var _utils = require("../utils");
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* 轴类图背景
|
|
18
13
|
*/
|
|
19
|
-
var _default = function _default(_ref) {
|
|
14
|
+
var _default = exports["default"] = function _default(_ref) {
|
|
20
15
|
var _ref$axis = _ref.axis,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
ticks = _ref$axis.ticks,
|
|
17
|
+
scaler = _ref$axis.scaler,
|
|
18
|
+
step = _ref$axis.step,
|
|
19
|
+
direction = _ref$axis.direction,
|
|
20
|
+
bandLength = _ref.bandLength,
|
|
21
|
+
_ref$config = _ref.config,
|
|
22
|
+
background = _ref$config.background,
|
|
23
|
+
paddingInner = _ref$config.seriesIntervalWidth,
|
|
24
|
+
paddingOuter = _ref$config.paddingInner,
|
|
25
|
+
length = _ref.length;
|
|
31
26
|
var isVertical = direction === 'vertical';
|
|
32
|
-
|
|
33
27
|
var _getSeriesInfo = (0, _utils.getSeriesInfo)({
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
step: step,
|
|
29
|
+
bandLength: bandLength,
|
|
30
|
+
paddingInner: paddingInner,
|
|
31
|
+
paddingOuter: paddingOuter
|
|
32
|
+
}),
|
|
33
|
+
bandwidth = _getSeriesInfo.width;
|
|
41
34
|
var size = isVertical ? {
|
|
42
35
|
width: length,
|
|
43
36
|
height: bandwidth
|
|
@@ -55,6 +48,4 @@ var _default = function _default(_ref) {
|
|
|
55
48
|
stroke: "none"
|
|
56
49
|
}));
|
|
57
50
|
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
exports["default"] = _default;
|
|
51
|
+
};
|