@easyv/charts 1.2.12 → 1.3.1

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 (76) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/lib/components/Axis.js +10 -10
  5. package/lib/components/Background.js +13 -3
  6. package/lib/components/Band.js +8 -8
  7. package/lib/components/Carousel.js +2 -2
  8. package/lib/components/CartesianChart.js +5 -1
  9. package/lib/components/ConicalGradient.js +21 -21
  10. package/lib/components/Indicator.js +2 -2
  11. package/lib/components/Label.js +11 -12
  12. package/lib/components/Lighter.js +179 -179
  13. package/lib/components/LinearGradient.js +2 -2
  14. package/lib/components/Marquee.js +26 -28
  15. package/lib/components/StackData.js +2 -4
  16. package/lib/components/StereoBar.js +14 -14
  17. package/lib/components/TextOverflow.js +3 -3
  18. package/lib/css/index.module.css +41 -41
  19. package/lib/css/piechart.module.css +26 -26
  20. package/lib/element/ConicGradient.js +72 -72
  21. package/lib/hooks/useAnimateData.js +5 -5
  22. package/lib/hooks/useAxes.js +5 -5
  23. package/lib/hooks/useCarouselAxisX.js +5 -5
  24. package/lib/hooks/useExtentData.js +10 -8
  25. package/lib/hooks/useFilterData.js +5 -5
  26. package/lib/hooks/useStackData.js +11 -10
  27. package/lib/hooks/useTooltip.js +10 -10
  28. package/lib/utils/index.js +68 -41
  29. package/package.json +54 -53
  30. package/src/components/AnimateData.tsx +24 -24
  31. package/src/components/Axis.tsx +354 -354
  32. package/src/components/Background.tsx +62 -45
  33. package/src/components/Band.tsx +169 -173
  34. package/src/components/BaseLine.js +82 -82
  35. package/src/components/Brush.js +159 -159
  36. package/src/components/Carousel.tsx +144 -144
  37. package/src/components/CartesianChart.js +33 -22
  38. package/src/components/Chart.js +99 -99
  39. package/src/components/ChartContainer.tsx +63 -63
  40. package/src/components/ConicalGradient.js +258 -258
  41. package/src/components/ExtentData.js +17 -17
  42. package/src/components/FilterData.js +23 -23
  43. package/src/components/Indicator.js +13 -13
  44. package/src/components/Label.js +225 -206
  45. package/src/components/Legend.js +158 -158
  46. package/src/components/Lighter.jsx +173 -173
  47. package/src/components/Line.js +145 -145
  48. package/src/components/LinearGradient.js +29 -29
  49. package/src/components/Mapping.js +71 -71
  50. package/src/components/Marquee.js +88 -94
  51. package/src/components/PieChart.js +1278 -1278
  52. package/src/components/StackData.js +16 -20
  53. package/src/components/StereoBar.tsx +307 -311
  54. package/src/components/TextOverflow.js +51 -51
  55. package/src/components/Tooltip.js +169 -169
  56. package/src/components/index.js +55 -55
  57. package/src/context/index.js +2 -2
  58. package/src/css/index.module.css +41 -41
  59. package/src/css/piechart.module.css +26 -26
  60. package/src/element/ConicGradient.jsx +55 -55
  61. package/src/element/Line.tsx +33 -33
  62. package/src/element/index.ts +3 -3
  63. package/src/formatter/index.js +1 -1
  64. package/src/formatter/legend.js +90 -90
  65. package/src/hooks/index.js +17 -17
  66. package/src/hooks/useAnimateData.ts +67 -67
  67. package/src/hooks/useAxes.js +144 -144
  68. package/src/hooks/useCarouselAxisX.js +163 -163
  69. package/src/hooks/useExtentData.js +89 -88
  70. package/src/hooks/useFilterData.js +72 -72
  71. package/src/hooks/useStackData.js +101 -100
  72. package/src/hooks/useTooltip.ts +96 -96
  73. package/src/index.js +6 -6
  74. package/src/types/index.d.ts +67 -67
  75. package/src/utils/index.js +738 -714
  76. package/tsconfig.json +23 -23
@@ -1,180 +1,180 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
-
16
- var _react = _interopRequireWildcard(require("react"));
17
-
18
- var _d3v = require("d3v7");
19
-
20
- var _utils = require("../utils");
21
-
22
- var _svgPathProperties = require("svg-path-properties");
23
-
24
- /**
25
- * 区域图发光跟踪路径
26
- */
27
- var _default = function _default(_ref) {
28
- var d = _ref.path,
29
- config = _ref.config,
30
- _ref$config = _ref.config,
31
- curveLength = _ref$config.length,
32
- width = _ref$config.width,
33
- fill = _ref$config.fill,
34
- unitStep = _ref$config.unitStep;
35
- var pointIndexRef = (0, _react.useRef)(0);
36
- var raf = (0, _react.useRef)(null);
37
-
38
- var _useState = (0, _react.useState)([]),
39
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
40
- points = _useState2[0],
41
- setPoints = _useState2[1];
42
-
43
- var _useState3 = (0, _react.useState)(null),
44
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
45
- lighter = _useState4[0],
46
- setLighter = _useState4[1];
47
-
48
- var pointLength = points.length;
49
- var totalLength = getLength(pointLength, curveLength);
50
- var easingFunc = easing.linear;
51
- var interpolateList = (0, _react.useMemo)(function () {
52
- return getColorsInterpolate((0, _utils.getColorList)(fill));
53
- }, [fill]);
54
- var drawLigher = (0, _react.useCallback)(function () {
55
- var STEP = 2;
56
- var LOOP = false;
57
-
58
- if (lighter && lighter.children) {
59
- var currentPointLength = pointIndexRef.current;
60
- var pointIndex = currentPointLength >= totalLength ? LOOP ? curveLength : 0 : currentPointLength + unitStep + Math.floor(easingFunc(pointIndexRef.current / totalLength) * STEP);
61
- var overstep = pointIndex - pointLength;
62
- var startIndex = getPointIndex(pointIndex, pointLength, curveLength);
63
- var endIndex = getPointIndex(pointIndex + curveLength, pointLength, curveLength);
64
- var overstepPoints = LOOP && overstep > 0 ? points.slice(0, overstep) : [];
65
- drawCircle(Array.from(lighter.children), [].concat((0, _toConsumableArray2["default"])(points.slice(startIndex, endIndex)), (0, _toConsumableArray2["default"])(overstepPoints)), interpolateList);
66
- pointIndexRef.current = pointIndex;
67
- }
68
-
69
- raf.current = requestAnimationFrame(drawLigher);
70
- }, [lighter, totalLength, curveLength, unitStep, points, interpolateList]);
71
- (0, _react.useEffect)(function () {
72
- var path = new _svgPathProperties.svgPathProperties(d);
73
- var totalLength = path.getTotalLength();
74
- var points = [];
75
-
76
- for (var i = 0; i < totalLength; i++) {
77
- var _path$getPointAtLengt = path.getPointAtLength(i),
78
- x = _path$getPointAtLengt.x,
79
- y = _path$getPointAtLengt.y;
80
-
81
- points.push({
82
- index: i,
83
- x: x,
84
- y: y
85
- });
86
- }
87
-
88
- setPoints(points);
89
- }, [d, config]);
90
- (0, _react.useEffect)(function () {
91
- raf.current = requestAnimationFrame(drawLigher);
92
- return function () {
93
- cancelAnimationFrame(raf.current);
94
- };
95
- }, [drawLigher]);
96
- return /*#__PURE__*/_react["default"].createElement("g", {
97
- ref: setLighter
98
- }, points.map(function (_ref2, index) {
99
- var x = _ref2.x,
100
- y = _ref2.y;
101
- return /*#__PURE__*/_react["default"].createElement("circle", {
102
- cx: x,
103
- cy: y,
104
- key: index,
105
- r: width,
106
- fill: "none"
107
- });
108
- }));
109
- };
110
-
111
- exports["default"] = _default;
112
-
113
- var drawCircle = function drawCircle(children, points, interpolateList) {
114
- var pointLength = points.length; // const [startPoint] = points;
115
- // const startIndex = startPoint ? startPoint.index : 0;
116
-
117
- children.forEach(function (child, index) {
118
- var pointIndex = points.findIndex(function (_ref3) {
119
- var i = _ref3.index;
120
- return i == index;
121
- });
122
- child.setAttribute('fill', pointIndex > -1 ? getColor(pointIndex / pointLength, //TODO: 颜色插值尚需完善
123
- interpolateList) : 'none');
124
- });
125
- };
126
-
127
- var getColor = function getColor(x, interpolateList) {
128
- return interpolateList(x);
129
- };
130
-
131
- var getLength = function getLength(pointLength, length) {
132
- if (length > pointLength) {
133
- return pointLength * 2;
134
- }
135
-
136
- return pointLength + length;
137
- };
138
-
139
- var getColorsInterpolate = function getColorsInterpolate(colors) {
140
- var length = colors.length;
141
- if (!!(length < 2)) return (0, _d3v.scaleLinear)().domain([0, 1]).range([colors[0].color || '#000', colors[0].color || '#000']);
142
- var linear = (0, _d3v.scaleLinear)().domain(colors.map(function (d) {
143
- return d.offset;
144
- })).range(colors.map(function (d) {
145
- return d.color;
146
- }));
147
- return linear;
148
- };
149
-
150
- var easing = {
151
- linear: function linear() {
152
- return 0;
153
- },
154
- easeIn: function easeIn(k) {
155
- return Math.pow(k, 3);
156
- },
157
- easeOut: function easeOut(k) {
158
- return 1 - easing.easeIn(1 - k);
159
- },
160
- easeInOut: function easeInOut(k) {
161
- return k < 0.5 ? easing.easeIn(k * 2) / 2 : 1 - easing.easeIn(2 - 2 * k) / 2;
162
- },
163
- easeOutIn: function easeOutIn(k) {
164
- return k < 0.5 ? 0.5 * (1 - easing.easeIn(1 - 2 * k)) : 0.5 * easing.easeIn(k * 2 - 1) + 0.5;
165
- }
166
- };
167
-
168
- var getPointIndex = function getPointIndex(pointIndex, pointLength, curveLength) {
169
- var index = pointIndex - curveLength;
170
-
171
- if (index < 0) {
172
- return 0;
173
- }
174
-
175
- if (index >= pointLength) {
176
- return pointLength - 1;
177
- }
178
-
179
- return index;
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _react = _interopRequireWildcard(require("react"));
17
+
18
+ var _d3v = require("d3v7");
19
+
20
+ var _utils = require("../utils");
21
+
22
+ var _svgPathProperties = require("svg-path-properties");
23
+
24
+ /**
25
+ * 区域图发光跟踪路径
26
+ */
27
+ var _default = function _default(_ref) {
28
+ var d = _ref.path,
29
+ config = _ref.config,
30
+ _ref$config = _ref.config,
31
+ curveLength = _ref$config.length,
32
+ width = _ref$config.width,
33
+ fill = _ref$config.fill,
34
+ unitStep = _ref$config.unitStep;
35
+ var pointIndexRef = (0, _react.useRef)(0);
36
+ var raf = (0, _react.useRef)(null);
37
+
38
+ var _useState = (0, _react.useState)([]),
39
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
40
+ points = _useState2[0],
41
+ setPoints = _useState2[1];
42
+
43
+ var _useState3 = (0, _react.useState)(null),
44
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
45
+ lighter = _useState4[0],
46
+ setLighter = _useState4[1];
47
+
48
+ var pointLength = points.length;
49
+ var totalLength = getLength(pointLength, curveLength);
50
+ var easingFunc = easing.linear;
51
+ var interpolateList = (0, _react.useMemo)(function () {
52
+ return getColorsInterpolate((0, _utils.getColorList)(fill));
53
+ }, [fill]);
54
+ var drawLigher = (0, _react.useCallback)(function () {
55
+ var STEP = 2;
56
+ var LOOP = false;
57
+
58
+ if (lighter && lighter.children) {
59
+ var currentPointLength = pointIndexRef.current;
60
+ var pointIndex = currentPointLength >= totalLength ? LOOP ? curveLength : 0 : currentPointLength + unitStep + Math.floor(easingFunc(pointIndexRef.current / totalLength) * STEP);
61
+ var overstep = pointIndex - pointLength;
62
+ var startIndex = getPointIndex(pointIndex, pointLength, curveLength);
63
+ var endIndex = getPointIndex(pointIndex + curveLength, pointLength, curveLength);
64
+ var overstepPoints = LOOP && overstep > 0 ? points.slice(0, overstep) : [];
65
+ drawCircle(Array.from(lighter.children), [].concat((0, _toConsumableArray2["default"])(points.slice(startIndex, endIndex)), (0, _toConsumableArray2["default"])(overstepPoints)), interpolateList);
66
+ pointIndexRef.current = pointIndex;
67
+ }
68
+
69
+ raf.current = requestAnimationFrame(drawLigher);
70
+ }, [lighter, totalLength, curveLength, unitStep, points, interpolateList]);
71
+ (0, _react.useEffect)(function () {
72
+ var path = new _svgPathProperties.svgPathProperties(d);
73
+ var totalLength = path.getTotalLength();
74
+ var points = [];
75
+
76
+ for (var i = 0; i < totalLength; i++) {
77
+ var _path$getPointAtLengt = path.getPointAtLength(i),
78
+ x = _path$getPointAtLengt.x,
79
+ y = _path$getPointAtLengt.y;
80
+
81
+ points.push({
82
+ index: i,
83
+ x: x,
84
+ y: y
85
+ });
86
+ }
87
+
88
+ setPoints(points);
89
+ }, [d, config]);
90
+ (0, _react.useEffect)(function () {
91
+ raf.current = requestAnimationFrame(drawLigher);
92
+ return function () {
93
+ cancelAnimationFrame(raf.current);
94
+ };
95
+ }, [drawLigher]);
96
+ return /*#__PURE__*/_react["default"].createElement("g", {
97
+ ref: setLighter
98
+ }, points.map(function (_ref2, index) {
99
+ var x = _ref2.x,
100
+ y = _ref2.y;
101
+ return /*#__PURE__*/_react["default"].createElement("circle", {
102
+ cx: x,
103
+ cy: y,
104
+ key: index,
105
+ r: width,
106
+ fill: "none"
107
+ });
108
+ }));
109
+ };
110
+
111
+ exports["default"] = _default;
112
+
113
+ var drawCircle = function drawCircle(children, points, interpolateList) {
114
+ var pointLength = points.length; // const [startPoint] = points;
115
+ // const startIndex = startPoint ? startPoint.index : 0;
116
+
117
+ children.forEach(function (child, index) {
118
+ var pointIndex = points.findIndex(function (_ref3) {
119
+ var i = _ref3.index;
120
+ return i == index;
121
+ });
122
+ child.setAttribute('fill', pointIndex > -1 ? getColor(pointIndex / pointLength, //TODO: 颜色插值尚需完善
123
+ interpolateList) : 'none');
124
+ });
125
+ };
126
+
127
+ var getColor = function getColor(x, interpolateList) {
128
+ return interpolateList(x);
129
+ };
130
+
131
+ var getLength = function getLength(pointLength, length) {
132
+ if (length > pointLength) {
133
+ return pointLength * 2;
134
+ }
135
+
136
+ return pointLength + length;
137
+ };
138
+
139
+ var getColorsInterpolate = function getColorsInterpolate(colors) {
140
+ var length = colors.length;
141
+ if (!!(length < 2)) return (0, _d3v.scaleLinear)().domain([0, 1]).range([colors[0].color || '#000', colors[0].color || '#000']);
142
+ var linear = (0, _d3v.scaleLinear)().domain(colors.map(function (d) {
143
+ return d.offset;
144
+ })).range(colors.map(function (d) {
145
+ return d.color;
146
+ }));
147
+ return linear;
148
+ };
149
+
150
+ var easing = {
151
+ linear: function linear() {
152
+ return 0;
153
+ },
154
+ easeIn: function easeIn(k) {
155
+ return Math.pow(k, 3);
156
+ },
157
+ easeOut: function easeOut(k) {
158
+ return 1 - easing.easeIn(1 - k);
159
+ },
160
+ easeInOut: function easeInOut(k) {
161
+ return k < 0.5 ? easing.easeIn(k * 2) / 2 : 1 - easing.easeIn(2 - 2 * k) / 2;
162
+ },
163
+ easeOutIn: function easeOutIn(k) {
164
+ return k < 0.5 ? 0.5 * (1 - easing.easeIn(1 - 2 * k)) : 0.5 * easing.easeIn(k * 2 - 1) + 0.5;
165
+ }
166
+ };
167
+
168
+ var getPointIndex = function getPointIndex(pointIndex, pointLength, curveLength) {
169
+ var index = pointIndex - curveLength;
170
+
171
+ if (index < 0) {
172
+ return 0;
173
+ }
174
+
175
+ if (index >= pointLength) {
176
+ return pointLength - 1;
177
+ }
178
+
179
+ return index;
180
180
  };
@@ -9,8 +9,8 @@ exports["default"] = void 0;
9
9
 
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
11
 
12
- /**
13
- * svg渐变滤镜
12
+ /**
13
+ * svg渐变滤镜
14
14
  */
15
15
  var _default = function _default(_ref) {
16
16
  var id = _ref.id,
@@ -9,15 +9,17 @@ exports["default"] = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
12
14
  var _react = require("react");
13
15
 
14
16
  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; }
15
17
 
16
18
  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; }
17
19
 
18
- /**
19
- * 文字跑马灯组件
20
- * eg: <Marquee value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
20
+ /**
21
+ * 文字跑马灯组件
22
+ * eg: <Marquee value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
21
23
  */
22
24
  var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
23
25
  var value = props.value,
@@ -25,33 +27,27 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
25
27
  _props$speed = props.speed,
26
28
  speed = _props$speed === void 0 ? 5 : _props$speed;
27
29
  var dom = (0, _react.useRef)(null);
28
- var content = (0, _react.useRef)(null); //dom和content盒子对象,避免speed变化时重新获取盒子对象
30
+ var content = (0, _react.useRef)(null);
29
31
 
30
- var domRect = (0, _react.useRef)(null);
31
- var contentRect = (0, _react.useRef)(null); //文本变化时,需要重新计算dom和content的宽高
32
+ var _useState = (0, _react.useState)(false),
33
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
34
+ fresh = _useState2[0],
35
+ setFresh = _useState2[1];
32
36
 
33
- var textList = (0, _react.useMemo)(function () {
37
+ var textList = (0, _react.useRef)([value]);
38
+ var duration = (0, _react.useRef)(10 / speed);
39
+ (0, _react.useEffect)(function () {
34
40
  if (dom.current && content.current) {
35
- var dom_ = dom.current;
36
- domRect.current = dom_.getBoundingClientRect();
37
- var content_ = content.current;
38
- contentRect.current = content_.getBoundingClientRect();
41
+ var domRectWidth = dom.current.getBoundingClientRect().width;
42
+ var contentRectWidth = content.current.getBoundingClientRect().width;
39
43
 
40
- if (domRect.current.width < contentRect.current.width) {
41
- return [value, value];
44
+ if (domRectWidth < contentRectWidth) {
45
+ textList.current = [value, value];
46
+ duration.current = contentRectWidth / domRectWidth / speed * 10;
47
+ setFresh(!fresh);
42
48
  }
43
49
  }
44
-
45
- return [value];
46
- }, [value]); //value和speed变化时,直接更新duration
47
-
48
- var duration = (0, _react.useMemo)(function () {
49
- if (domRect.current && contentRect.current && domRect.current.width < contentRect.current.width) {
50
- return contentRect.current.width / domRect.current.width / speed * 10;
51
- }
52
-
53
- return 5;
54
- }, [speed]); //在head标签中注入keyframes动画
50
+ }, [value, speed]); //在head标签中注入keyframes动画
55
51
 
56
52
  (0, _react.useEffect)(function () {
57
53
  var md_marquee = document.getElementById('md_marquee'); //先查找是否已经存在md_marquee
@@ -68,24 +64,26 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
68
64
  document.getElementsByTagName('head')[0].appendChild(_style);
69
65
  }
70
66
  }, []);
67
+ var overflow = textList.current.length == 2;
71
68
  return /*#__PURE__*/React.createElement("span", {
72
69
  style: _objectSpread(_objectSpread({
73
70
  width: '100%'
74
71
  }, style), {}, {
75
72
  display: 'flex',
76
73
  whiteSpace: 'nowrap',
77
- overflow: 'hidden'
74
+ overflow: 'hidden',
75
+ justifyContent: overflow ? "start" : style.justifyContent || ""
78
76
  }),
79
77
  ref: dom
80
- }, textList.map(function (item, itemIndex) {
78
+ }, textList.current.map(function (item, itemIndex) {
81
79
  return /*#__PURE__*/React.createElement("span", {
82
80
  key: itemIndex,
83
- style: textList.length == 2 ? {
81
+ style: overflow ? {
84
82
  //如果文本数量为2,则需要滚动
85
83
  animationName: 'md_marquee',
86
84
  animationTimingFunction: 'linear',
87
85
  animationIterationCount: 'infinite',
88
- animationDuration: duration + 's'
86
+ animationDuration: duration.current + 's'
89
87
  } : {},
90
88
  ref: itemIndex == 0 ? content : null
91
89
  }, "\xA0", item);
@@ -32,15 +32,13 @@ var _default = function _default(Component) {
32
32
  data = _ref.data,
33
33
  props = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
34
34
 
35
- var _series = (0, _hooks.useStackData)({
35
+ var _config = (0, _hooks.useStackData)({
36
36
  series: series,
37
37
  data: data
38
38
  });
39
39
 
40
40
  return /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, {
41
- config: _objectSpread(_objectSpread({}, config), {}, {
42
- series: _series
43
- }),
41
+ config: _objectSpread(_objectSpread({}, config), _config),
44
42
  data: data
45
43
  }));
46
44
  });
@@ -111,22 +111,22 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
111
111
  yScaler = _ref3.yAxis.scaler,
112
112
  fieldName = _ref3.fieldName;
113
113
  if (!data.length) return null;
114
- var bandwidth = (0, _utils.getBandwidth)(step, paddingOuter);
115
114
 
116
- var _getBandSeriesStepAnd = (0, _utils.getBandSeriesStepAndWidth)({
117
- width: bandwidth,
115
+ var _getSeriesInfo = (0, _utils.getSeriesInfo)({
116
+ step: step,
117
+ bandLength: bandLength,
118
118
  paddingInner: paddingInner,
119
- bandLength: bandLength
119
+ paddingOuter: paddingOuter
120
120
  }),
121
- seriesStep = _getBandSeriesStepAnd.seriesStep,
122
- seriesWidth = _getBandSeriesStepAnd.seriesWidth;
121
+ seriesWidth = _getSeriesInfo.seriesWidth,
122
+ seriesStep = _getSeriesInfo.seriesStep,
123
+ seriesStart = _getSeriesInfo.seriesStart;
123
124
 
124
125
  var _data = showHighlight ? getHighlightData(data, extent) : data;
125
126
 
126
- var offset = (seriesWidth + paddingInner * seriesStep) * bandLength - paddingInner * seriesStep;
127
127
  var isVertical = direction === 'vertical';
128
- var highlightColor = parseMultiColorToSVG(highlightFill, "highlight_gradient_" + id + "_" + fieldName);
129
- var color = parseMultiColorToSVG(fill, "gradient_" + id + "_" + fieldName);
128
+ var highlightColor = parseMultiColorToSVG(highlightFill, 'highlight_gradient_' + id + '_' + fieldName);
129
+ var color = parseMultiColorToSVG(fill, 'gradient_' + id + '_' + fieldName);
130
130
  return /*#__PURE__*/_react["default"].createElement("g", {
131
131
  className: "__easyv-band"
132
132
  }, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("filter", {
@@ -165,7 +165,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref3) {
165
165
 
166
166
  var y1 = yScaler(isVertical ? end : start);
167
167
  var y2 = yScaler(isVertical ? start : end);
168
- var positionX = xScaler(x) + seriesStep * index - offset / 2;
168
+ var positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
169
169
  if (isNaN(positionX)) return null;
170
170
  var positionY = y < 0 ? y1 : y2;
171
171
  var attr = getAttr({
@@ -253,7 +253,7 @@ function deg2rad(deg) {
253
253
  }
254
254
 
255
255
  function deepCopy(obj) {
256
- if ((0, _typeof2["default"])(obj) == "object") {
256
+ if ((0, _typeof2["default"])(obj) == 'object') {
257
257
  var o;
258
258
 
259
259
  if (Array.isArray(obj)) {
@@ -278,7 +278,7 @@ function deepCopy(obj) {
278
278
  }
279
279
 
280
280
  function parseMultiColorToSVG(config, id) {
281
- if (config.type == "linear") {
281
+ if (config.type == 'linear') {
282
282
  var _config$linear = config.linear,
283
283
  stops = _config$linear.stops,
284
284
  opacity = _config$linear.opacity;
@@ -302,14 +302,14 @@ function parseMultiColorToSVG(config, id) {
302
302
 
303
303
  return {
304
304
  fill: "url(#".concat(id, ")"),
305
- def: /*#__PURE__*/_react["default"].createElement("linearGradient", {
305
+ def: /*#__PURE__*/_react["default"].createElement('linearGradient', {
306
306
  id: id,
307
307
  x2: start[0],
308
308
  y2: start[1],
309
309
  x1: end[0],
310
310
  y1: end[1]
311
311
  }, _stops.map(function (e) {
312
- return /*#__PURE__*/_react["default"].createElement("stop", {
312
+ return /*#__PURE__*/_react["default"].createElement('stop', {
313
313
  key: e.offset,
314
314
  offset: e.offset / 100,
315
315
  stopColor: e.color,
@@ -17,9 +17,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
17
17
 
18
18
  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; }
19
19
 
20
- /**
21
- * 文本溢出组件
22
- * eg: <TextOverflow type={溢出形式} value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
20
+ /**
21
+ * 文本溢出组件
22
+ * eg: <TextOverflow type={溢出形式} value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
23
23
  */
24
24
  var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
25
25
  var type = props.type,
@@ -1,42 +1,42 @@
1
- .rotateClockwise {
2
- animation-name: rotateClockwise;
3
- }
4
-
5
- @keyframes rotateClockwise {
6
- 0% {
7
- transform: rotate(0deg);
8
- }
9
- 100% {
10
- transform: rotate(360deg);
11
- }
12
- }
13
-
14
- .rotateCounterClockwise {
15
- animation-name: rotateCounterClockwise;
16
- }
17
-
18
- @keyframes rotateCounterClockwise {
19
- 0% {
20
- transform: rotate(360deg);
21
- }
22
- 100% {
23
- transform: rotate(0deg);
24
- }
25
- }
26
-
27
- .showAllStyle {
28
- display: grid;
29
- width: 100%;
30
- grid-template-columns: 40% 30% 30%;
31
- align-items: center;
32
- flex-direction: row;
33
- justify-content: space-between;
34
- }
35
-
36
- .notShowAllStyle {
37
- display: flex;
38
- width: 100%;
39
- align-items: center;
40
- flex-direction: row;
41
- justify-content: space-between;
1
+ .rotateClockwise {
2
+ animation-name: rotateClockwise;
3
+ }
4
+
5
+ @keyframes rotateClockwise {
6
+ 0% {
7
+ transform: rotate(0deg);
8
+ }
9
+ 100% {
10
+ transform: rotate(360deg);
11
+ }
12
+ }
13
+
14
+ .rotateCounterClockwise {
15
+ animation-name: rotateCounterClockwise;
16
+ }
17
+
18
+ @keyframes rotateCounterClockwise {
19
+ 0% {
20
+ transform: rotate(360deg);
21
+ }
22
+ 100% {
23
+ transform: rotate(0deg);
24
+ }
25
+ }
26
+
27
+ .showAllStyle {
28
+ display: grid;
29
+ width: 100%;
30
+ grid-template-columns: 40% 30% 30%;
31
+ align-items: center;
32
+ flex-direction: row;
33
+ justify-content: space-between;
34
+ }
35
+
36
+ .notShowAllStyle {
37
+ display: flex;
38
+ width: 100%;
39
+ align-items: center;
40
+ flex-direction: row;
41
+ justify-content: space-between;
42
42
  }