@easyv/charts 1.4.25 → 1.4.26

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.
Files changed (91) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/commitlint.config.js +1 -1
  5. package/lib/components/AnimateData.js +8 -16
  6. package/lib/components/Axis.js +86 -133
  7. package/lib/components/Background.js +18 -26
  8. package/lib/components/Band.js +72 -98
  9. package/lib/components/BaseLine.js +33 -46
  10. package/lib/components/Brush.js +29 -46
  11. package/lib/components/Carousel.js +13 -40
  12. package/lib/components/CartesianChart.js +98 -146
  13. package/lib/components/Chart.js +23 -36
  14. package/lib/components/ChartContainer.js +18 -27
  15. package/lib/components/ConicalGradient.js +56 -89
  16. package/lib/components/Control.js +12 -28
  17. package/lib/components/ExtentData.js +9 -17
  18. package/lib/components/FilterData.js +16 -27
  19. package/lib/components/Indicator.js +23 -30
  20. package/lib/components/Label.js +96 -126
  21. package/lib/components/Legend.js +41 -66
  22. package/lib/components/Lighter.js +21 -50
  23. package/lib/components/Line.js +39 -59
  24. package/lib/components/LinearGradient.js +16 -22
  25. package/lib/components/Mapping.js +9 -34
  26. package/lib/components/Marquee.js +14 -30
  27. package/lib/components/PieChart.js +457 -487
  28. package/lib/components/StackData.js +8 -18
  29. package/lib/components/StereoBar.js +65 -105
  30. package/lib/components/TextOverflow.js +8 -21
  31. package/lib/components/Tooltip.js +41 -55
  32. package/lib/components/index.js +7 -28
  33. package/lib/components/pieTooltip.js +132 -0
  34. package/lib/context/index.js +0 -2
  35. package/lib/css/index.module.css +42 -42
  36. package/lib/css/piechart.module.css +26 -26
  37. package/lib/element/ConicGradient.js +29 -35
  38. package/lib/element/Line.js +9 -13
  39. package/lib/element/index.js +0 -2
  40. package/lib/formatter/index.js +0 -2
  41. package/lib/formatter/legend.js +30 -41
  42. package/lib/hooks/index.js +0 -9
  43. package/lib/hooks/useAiData.js +12 -20
  44. package/lib/hooks/useAnimateData.js +8 -21
  45. package/lib/hooks/useAxes.js +67 -117
  46. package/lib/hooks/useCarouselAxisX.js +27 -60
  47. package/lib/hooks/useExtentData.js +14 -46
  48. package/lib/hooks/useFilterData.js +13 -34
  49. package/lib/hooks/useStackData.js +12 -35
  50. package/lib/hooks/useTooltip.js +36 -53
  51. package/lib/index.js +0 -15
  52. package/lib/utils/index.js +95 -247
  53. package/package.json +55 -55
  54. package/src/components/Background.tsx +61 -61
  55. package/src/components/Band.tsx +274 -274
  56. package/src/components/Brush.js +159 -159
  57. package/src/components/CartesianChart.js +1 -1
  58. package/src/components/Chart.js +99 -99
  59. package/src/components/ChartContainer.tsx +71 -71
  60. package/src/components/ConicalGradient.js +258 -258
  61. package/src/components/Control.jsx +51 -51
  62. package/src/components/ExtentData.js +17 -17
  63. package/src/components/Indicator.js +61 -61
  64. package/src/components/Label.js +275 -275
  65. package/src/components/Legend.js +165 -165
  66. package/src/components/Lighter.jsx +173 -173
  67. package/src/components/Line.js +150 -150
  68. package/src/components/LinearGradient.js +29 -29
  69. package/src/components/Marquee.tsx +1 -1
  70. package/src/components/PieChart.js +403 -260
  71. package/src/components/PieTooltip.jsx +134 -0
  72. package/src/components/StereoBar.tsx +307 -307
  73. package/src/components/index.js +59 -57
  74. package/src/context/index.js +2 -2
  75. package/src/css/index.module.css +42 -42
  76. package/src/css/piechart.module.css +26 -26
  77. package/src/element/ConicGradient.jsx +55 -55
  78. package/src/element/Line.tsx +33 -33
  79. package/src/element/index.ts +3 -3
  80. package/src/formatter/index.js +1 -1
  81. package/src/formatter/legend.js +92 -92
  82. package/src/hooks/index.js +20 -20
  83. package/src/hooks/useAnimateData.ts +67 -67
  84. package/src/hooks/useCarouselAxisX.js +1 -1
  85. package/src/hooks/useFilterData.js +72 -72
  86. package/src/hooks/useStackData.js +101 -101
  87. package/src/hooks/useTooltip.ts +100 -100
  88. package/src/index.js +6 -6
  89. package/src/types/index.d.ts +67 -67
  90. package/src/utils/index.js +757 -757
  91. package/tsconfig.json +23 -23
package/.babelrc CHANGED
@@ -1,8 +1,8 @@
1
- {
2
- "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3
- "plugins": [
4
- "@babel/plugin-proposal-export-default-from",
5
- "@babel/plugin-transform-runtime",
6
- "@babel/plugin-proposal-class-properties"
7
- ]
8
- }
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3
+ "plugins": [
4
+ "@babel/plugin-proposal-export-default-from",
5
+ "@babel/plugin-transform-runtime",
6
+ "@babel/plugin-proposal-class-properties"
7
+ ]
8
+ }
package/.husky/commit-msg CHANGED
@@ -1,4 +1,4 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
4
  yarn commitlint --edit $1
package/CHANGELOG.md CHANGED
@@ -1,18 +1,18 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ### [1.1.1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/compare/v1.1.0...v1.1.1) (2022-04-13)
6
-
7
- ## 1.1.0 (2022-04-02)
8
-
9
-
10
- ### Features
11
-
12
- * 轴标签,label支持样式传入 ([749a595](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/749a595a96b95917dafdc1766f63efec73398d64))
13
- * axis轴标签支持点击触发回调 ([1f636e1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1f636e1840f4f3b48c2b9765ce6087759d82fb17))
14
-
15
-
16
- ### Bug Fixes
17
-
18
- * **band组件:** 修复foreignObject在Safari浏览器下的位置诡异偏离问题 ([1a65d54](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1a65d54abbcf6c9e84cc85cc8b6a9d28b24fa4c4))
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [1.1.1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/compare/v1.1.0...v1.1.1) (2022-04-13)
6
+
7
+ ## 1.1.0 (2022-04-02)
8
+
9
+
10
+ ### Features
11
+
12
+ * 轴标签,label支持样式传入 ([749a595](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/749a595a96b95917dafdc1766f63efec73398d64))
13
+ * axis轴标签支持点击触发回调 ([1f636e1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1f636e1840f4f3b48c2b9765ce6087759d82fb17))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **band组件:** 修复foreignObject在Safari浏览器下的位置诡异偏离问题 ([1a65d54](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1a65d54abbcf6c9e84cc85cc8b6a9d28b24fa4c4))
@@ -1 +1 @@
1
- module.exports = {extends: ['@commitlint/config-conventional']}
1
+ module.exports = {extends: ['@commitlint/config-conventional']}
@@ -1,36 +1,29 @@
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
- _excluded2 = ["data", "config"];
22
-
14
+ _excluded2 = ["data", "config"];
15
+ /**
16
+ * 用来做图表数据改变(增长)动画(HOC)
17
+ */
23
18
  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
-
25
19
  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
-
27
20
  var _default = function _default(Component) {
28
21
  return /*#__PURE__*/(0, _react.memo)(function (_ref) {
29
22
  var data = _ref.data,
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);
23
+ _ref$config = _ref.config,
24
+ dataAnimation = _ref$config.dataAnimation,
25
+ config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
26
+ rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
34
27
  return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, rest, {
35
28
  config: config,
36
29
  originData: data,
@@ -38,5 +31,4 @@ var _default = function _default(Component) {
38
31
  }));
39
32
  });
40
33
  };
41
-
42
34
  exports["default"] = _default;
@@ -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
17
  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
-
30
18
  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
-
32
19
  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; }
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
-
20
+ 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; } /**
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) {
58
42
  var width = _ref2.width,
59
- height = _ref2.height;
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;
65
-
66
48
  case "left":
67
49
  case "right":
68
50
  return "M0, -0.5V" + (height + 0.5);
@@ -78,8 +60,6 @@ var getAxesPath = function getAxesPath(orientation, _ref2) {
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,23 +88,21 @@ 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
- 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;
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
+ _ref3$isClipAxis = _ref3.isClipAxis,
99
+ isClipAxis = _ref3$isClipAxis === void 0 ? false : _ref3$isClipAxis,
100
+ _ref3$clipAxisRange = _ref3.clipAxisRange,
101
+ clipAxisRange = _ref3$clipAxisRange === void 0 ? [] : _ref3$clipAxisRange;
126
102
  if (!show) return null;
127
103
  var context = (0, _react.useContext)(_context.chartContext);
128
104
  var width = context.width,
129
- height = context.height;
130
-
105
+ height = context.height;
131
106
  if (isClipAxis) {
132
107
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, clipAxisRange.map(function (range, index) {
133
108
  return /*#__PURE__*/_react["default"].createElement("path", {
@@ -145,24 +120,23 @@ var AxisLine = function AxisLine(_ref3) {
145
120
  });
146
121
  }
147
122
  };
148
-
149
123
  var Unit = function Unit(_ref4) {
150
124
  var _ref4$config = _ref4.config,
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;
125
+ show = _ref4$config.show,
126
+ text = _ref4$config.text,
127
+ _ref4$config$font = _ref4$config.font,
128
+ bold = _ref4$config$font.bold,
129
+ color = _ref4$config$font.color,
130
+ fontFamily = _ref4$config$font.fontFamily,
131
+ fontSize = _ref4$config$font.fontSize,
132
+ italic = _ref4$config$font.italic,
133
+ letterSpacing = _ref4$config$font.letterSpacing,
134
+ _ref4$config$translat = _ref4$config.translate,
135
+ translateX = _ref4$config$translat.x,
136
+ translateY = _ref4$config$translat.y,
137
+ _ref4$config$align = _ref4$config.align,
138
+ _ref4$config$align2 = _ref4$config$align === void 0 ? defaultAlign : _ref4$config$align,
139
+ textAnchor = _ref4$config$align2.textAnchor;
166
140
  if (!show) return null;
167
141
  return /*#__PURE__*/_react["default"].createElement("text", {
168
142
  className: "__easyv-unit",
@@ -176,48 +150,42 @@ var Unit = function Unit(_ref4) {
176
150
  textAnchor: textAnchor
177
151
  }, text);
178
152
  };
179
-
180
153
  var Label = function Label(_ref5) {
181
154
  var className = _ref5.className,
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;
155
+ _ref5$orientation = _ref5.orientation,
156
+ orientation = _ref5$orientation === void 0 ? defaultOrientation : _ref5$orientation,
157
+ label = _ref5.label,
158
+ coordinate = _ref5.coordinate,
159
+ _ref5$formatter = _ref5.formatter,
160
+ formatter = _ref5$formatter === void 0 ? defaultFormatter : _ref5$formatter,
161
+ tickSize = _ref5.tickSize,
162
+ _ref5$rotate = _ref5.rotate,
163
+ rotate = _ref5$rotate === void 0 ? 0 : _ref5$rotate,
164
+ config = _ref5.config,
165
+ _ref5$onClick = _ref5.onClick,
166
+ onClick = _ref5$onClick === void 0 ? defaultEvent : _ref5$onClick,
167
+ _ref5$config = _ref5.config,
168
+ show = _ref5$config.show,
169
+ style = _ref5$config.style,
170
+ _ref5$config$translat = _ref5$config.translate,
171
+ translateX = _ref5$config$translat.x,
172
+ translateY = _ref5$config$translat.y,
173
+ font = _ref5$config.font,
174
+ _ref5$config$appearan = _ref5$config.appearance,
175
+ _ref5$config$appearan2 = _ref5$config$appearan === void 0 ? defaultAppearance : _ref5$config$appearan,
176
+ width = _ref5$config$appearan2.width,
177
+ speed = _ref5$config$appearan2.speed,
178
+ textOverflow = _ref5$config$appearan2.textOverflow;
206
179
  if (!show) return null;
207
-
208
180
  var _label = formatter(label, config);
209
-
210
181
  var _getLayout = getLayout(orientation, rotate),
211
- transform = _getLayout.transform,
212
- directionX = _getLayout.directionX,
213
- directionY = _getLayout.directionY;
214
-
182
+ transform = _getLayout.transform,
183
+ directionX = _getLayout.directionX,
184
+ directionY = _getLayout.directionY;
215
185
  var isVertical = orientation == "left" || orientation == "right";
216
186
  var x = (isVertical ? tickSize * directionX : coordinate) + translateX * directionX;
217
187
  var y = (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
218
-
219
188
  var _style = style && ((0, _typeof2["default"])(style) == "object" ? style : style(_label));
220
-
221
189
  return /*#__PURE__*/_react["default"].createElement("foreignObject", {
222
190
  width: "1",
223
191
  height: "1",
@@ -245,53 +213,47 @@ var Label = function Label(_ref5) {
245
213
  }
246
214
  })));
247
215
  };
248
-
249
216
  var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
250
217
  var orientation = _ref6.orientation,
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
- range = _ref6.range,
269
- axisType = _ref6.axisType,
270
- _ref6$isClipAxis = _ref6.isClipAxis,
271
- isClipAxis = _ref6$isClipAxis === void 0 ? false : _ref6$isClipAxis,
272
- yLineRange = _ref6.yLineRange,
273
- clipAxisRange = _ref6.clipAxisRange,
274
- isControlChart = _ref6.isControlChart,
275
- controlConfig = _ref6.controlConfig,
276
- controlEnd = _ref6.controlEnd,
277
- rawTicks = _ref6.rawTicks;
218
+ scaler = _ref6.scaler,
219
+ _ref6$tickSize = _ref6.tickSize,
220
+ tickSize = _ref6$tickSize === void 0 ? defaultTickSize : _ref6$tickSize,
221
+ ticks = _ref6.ticks,
222
+ formatter = _ref6.formatter,
223
+ rotate = _ref6.rotate,
224
+ triggerClick = _ref6.triggerClick,
225
+ _ref6$config = _ref6.config,
226
+ on = _ref6$config.on,
227
+ label = _ref6$config.label,
228
+ axisLine = _ref6$config.axisLine,
229
+ tickLine = _ref6$config.tickLine,
230
+ gridLine = _ref6$config.gridLine,
231
+ unit = _ref6$config.unit,
232
+ config = _ref6.config,
233
+ positions = _ref6.positions,
234
+ xLineRange = _ref6.xLineRange,
235
+ range = _ref6.range,
236
+ axisType = _ref6.axisType,
237
+ _ref6$isClipAxis = _ref6.isClipAxis,
238
+ isClipAxis = _ref6$isClipAxis === void 0 ? false : _ref6$isClipAxis,
239
+ yLineRange = _ref6.yLineRange,
240
+ clipAxisRange = _ref6.clipAxisRange,
241
+ isControlChart = _ref6.isControlChart,
242
+ controlConfig = _ref6.controlConfig,
243
+ controlEnd = _ref6.controlEnd,
244
+ rawTicks = _ref6.rawTicks;
278
245
  if (!(on && ticks.length > 0)) return null;
279
-
280
246
  var _useContext = (0, _react.useContext)(_context.chartContext),
281
- width = _useContext.width,
282
- height = _useContext.height;
283
-
247
+ width = _useContext.width,
248
+ height = _useContext.height;
284
249
  var x = orientation == "right" ? width : 0;
285
250
  var y = orientation == "bottom" ? height : 0;
286
-
287
251
  function drawAxisTickLine() {
288
252
  var draw = function draw(ticks, scaler) {
289
253
  return ticks.map(function (tick, index) {
290
254
  var coordinate = scaler(tick);
291
255
  if (isNaN(coordinate)) return null;
292
-
293
256
  var _tickSize = tickLine.tickSize || tickSize;
294
-
295
257
  var gridCoord = (0, _utils.getGridCoord)({
296
258
  orientation: orientation,
297
259
  coordinate: coordinate,
@@ -310,7 +272,6 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
310
272
  })));
311
273
  });
312
274
  };
313
-
314
275
  if (isClipAxis) {
315
276
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
316
277
  return draw(ticks, scaler[index]);
@@ -319,15 +280,12 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
319
280
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
320
281
  }
321
282
  }
322
-
323
283
  function drawLabel() {
324
284
  var draw = function draw(ticks, scaler) {
325
285
  return ticks.map(function (tick, index) {
326
286
  var coordinate = scaler(tick);
327
287
  if (isNaN(coordinate)) return null;
328
-
329
288
  var _tickSize = tickLine.tickSize || tickSize;
330
-
331
289
  var gridCoord = (0, _utils.getGridCoord)({
332
290
  orientation: orientation,
333
291
  coordinate: coordinate,
@@ -353,7 +311,6 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
353
311
  }, gridCoord)));
354
312
  });
355
313
  };
356
-
357
314
  if (isClipAxis) {
358
315
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, ticks.map(function (ticks, index) {
359
316
  return draw(ticks, scaler[index]);
@@ -364,10 +321,9 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
364
321
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, draw(ticks, scaler));
365
322
  }
366
323
  }
367
-
368
324
  return /*#__PURE__*/_react["default"].createElement("g", null, axisLine && tickLine && /*#__PURE__*/_react["default"].createElement("g", null, axisLine && (positions && positions.length ? positions.map(function (_ref7, index) {
369
325
  var x = _ref7.x,
370
- y = _ref7.y;
326
+ y = _ref7.y;
371
327
  return /*#__PURE__*/_react["default"].createElement("g", {
372
328
  key: index,
373
329
  transform: "translate(" + x + ", " + y + ")"
@@ -378,9 +334,7 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
378
334
  }), tickLine && ticks.map(function (tick, index) {
379
335
  var coordinate = scaler(tick);
380
336
  if (isNaN(coordinate)) return null;
381
-
382
337
  var _tickSize = tickLine.tickSize || tickSize;
383
-
384
338
  var gridCoord = (0, _utils.getGridCoord)({
385
339
  orientation: orientation,
386
340
  coordinate: coordinate,
@@ -418,5 +372,4 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
418
372
  config: unit
419
373
  })))));
420
374
  }));
421
-
422
375
  exports["default"] = _default;
@@ -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
- /**
17
- * 轴类图背景
11
+ /**
12
+ * 轴类图背景
18
13
  */
19
14
  var _default = function _default(_ref) {
20
15
  var _ref$axis = _ref.axis,
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;
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
- step: step,
35
- bandLength: bandLength,
36
- paddingInner: paddingInner,
37
- paddingOuter: paddingOuter
38
- }),
39
- bandwidth = _getSeriesInfo.width;
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
@@ -56,5 +49,4 @@ var _default = function _default(_ref) {
56
49
  }));
57
50
  });
58
51
  };
59
-
60
52
  exports["default"] = _default;