@easyv/charts 1.5.2 → 1.5.4

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.
@@ -22,7 +22,7 @@ var _react = _interopRequireWildcard(require("react"));
22
22
  var _d3v = require("d3v7");
23
23
 
24
24
  var _excluded = ["animation"],
25
- _excluded2 = ["config", "data"];
25
+ _excluded2 = ["config", "data", "active"];
26
26
 
27
27
  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); }
28
28
 
@@ -60,6 +60,7 @@ var _default = function _default(Component) {
60
60
  config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
61
61
  _ref$data = _ref.data,
62
62
  data = _ref$data === void 0 ? [] : _ref$data,
63
+ active = _ref.active,
63
64
  rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
64
65
  var dataLength = data.length;
65
66
 
@@ -103,11 +104,11 @@ var _default = function _default(Component) {
103
104
  }
104
105
  }, [animationOn, interval, dataLength]);
105
106
  (0, _react.useEffect)(function () {
106
- carousel && carousel();
107
+ active && carousel && carousel();
107
108
  return function () {
108
109
  timer.current && timer.current.stop();
109
110
  };
110
- }, [carousel]);
111
+ }, [carousel, active]);
111
112
  var onEvent = (0, _react.useCallback)(function (_ref3) {
112
113
  var currentIndex = _ref3.currentIndex,
113
114
  type = _ref3.type;
@@ -159,7 +159,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
159
159
  }, type == 'pie' ? /*#__PURE__*/_react["default"].createElement(_.PieChart, (0, _extends2["default"])({
160
160
  id: id,
161
161
  config: config,
162
- data: data
162
+ data: data,
163
+ active: active
163
164
  }, props)) : /*#__PURE__*/_react["default"].createElement(_.CartesianChart, (0, _extends2["default"])({
164
165
  id: id,
165
166
  config: config,
@@ -316,18 +316,20 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
316
316
  _ref5$config$animatio = _ref5$config.animation,
317
317
  on = _ref5$config$animatio.on,
318
318
  _ref5$config$animatio2 = _ref5$config$animatio.current,
319
- _ref5$config$animatio3 = _ref5$config$animatio2.heighten,
320
- heighten = _ref5$config$animatio3 === void 0 ? 0 : _ref5$config$animatio3,
321
- _ref5$config$animatio4 = _ref5$config$animatio2.opacity,
322
- opacity = _ref5$config$animatio4 === void 0 ? 0 : _ref5$config$animatio4,
323
- _ref5$config$animatio5 = _ref5$config$animatio2.width,
324
- radiusWidthAdd = _ref5$config$animatio5 === void 0 ? 0 : _ref5$config$animatio5,
319
+ _ref5$config$animatio3 = _ref5$config$animatio2.widthen,
320
+ widthen = _ref5$config$animatio3 === void 0 ? 0 : _ref5$config$animatio3,
321
+ _ref5$config$animatio4 = _ref5$config$animatio2.heighten,
322
+ heighten = _ref5$config$animatio4 === void 0 ? 0 : _ref5$config$animatio4,
323
+ _ref5$config$animatio5 = _ref5$config$animatio2.opacity,
324
+ opacity = _ref5$config$animatio5 === void 0 ? 0 : _ref5$config$animatio5,
325
+ _ref5$config$animatio6 = _ref5$config$animatio2.width,
326
+ radiusWidthAdd = _ref5$config$animatio6 === void 0 ? 0 : _ref5$config$animatio6,
325
327
  animateColor = _ref5$config$animatio2.color,
326
328
  animateCTS = _ref5$config$animatio2.textStyle,
327
- _ref5$config$animatio6 = _ref5$config$animatio2.gap,
328
- gap = _ref5$config$animatio6 === void 0 ? 0 : _ref5$config$animatio6,
329
- _ref5$config$animatio7 = _ref5$config$animatio.rotate,
330
- rotate = _ref5$config$animatio7 === void 0 ? 0 : _ref5$config$animatio7,
329
+ _ref5$config$animatio7 = _ref5$config$animatio2.gap,
330
+ gap = _ref5$config$animatio7 === void 0 ? 0 : _ref5$config$animatio7,
331
+ _ref5$config$animatio8 = _ref5$config$animatio.rotate,
332
+ rotate = _ref5$config$animatio8 === void 0 ? 0 : _ref5$config$animatio8,
331
333
  _ref5$config$tooltip = _ref5$config.tooltip,
332
334
  tooltip = _ref5$config$tooltip === void 0 ? {} : _ref5$config$tooltip,
333
335
  config = _ref5.config,
@@ -701,8 +703,9 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
701
703
  var prev = index == prevIndex.current;
702
704
  var offset = current ? y : prev ? 1 - y : 0;
703
705
  var fillOpacity = animateColor ? 1 : current ? opacity / 100 : 1;
706
+ var deltaWidthen = offset * widthen;
704
707
  var deltaHeighten = offset * heighten;
705
- var path = arc.innerRadius(innerRadius + deltaHeighten).outerRadius(outerRadius + deltaHeighten)(value);
708
+ var path = arc.innerRadius(innerRadius + deltaWidthen).outerRadius(outerRadius + deltaHeighten + deltaWidthen)(value);
706
709
  var pie = (0, _utils.getColorList)(series.color);
707
710
  var currentPie = animateColor ? (0, _utils.getColorList)(animateColor) : (0, _utils.getColorList)(series.color);
708
711
  var textPath = "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -36,6 +36,7 @@ export default (Component: ComponentType<any>) =>
36
36
  ({
37
37
  config: { animation, ...config },
38
38
  data = [],
39
+ active,
39
40
  ...rest
40
41
  }: {
41
42
  data: DataType[];
@@ -77,11 +78,11 @@ export default (Component: ComponentType<any>) =>
77
78
  }, [animationOn, interval, dataLength]);
78
79
 
79
80
  useEffect(() => {
80
- carousel && carousel();
81
+ active && carousel && carousel();
81
82
  return () => {
82
83
  timer.current && timer.current.stop();
83
84
  };
84
- }, [carousel]);
85
+ }, [carousel, active]);
85
86
  interface Event{
86
87
  currentIndex:number,
87
88
  type:string
@@ -90,6 +90,8 @@ const Chart = memo(
90
90
  [id, chartWidth, chartHeight, triggerOnRelative, svg, onEmit]
91
91
  );
92
92
 
93
+
94
+
93
95
  useEffect(()=>{
94
96
  const activeHandler=(e)=>{
95
97
  const { dynamicData = true } = e;
@@ -121,7 +123,7 @@ const Chart = memo(
121
123
  return (
122
124
  <chartContext.Provider value={context}>
123
125
  {type == 'pie' ? (
124
- <PieChart id={id} config={config} data={data} {...props} />
126
+ <PieChart id={id} config={config} data={data} active={active} {...props} />
125
127
  ) : (
126
128
  <CartesianChart id={id} config={config} data={data} active={active} {...props} />
127
129
  )}
@@ -272,6 +272,7 @@ const Component = memo(
272
272
  animation: {
273
273
  on,
274
274
  current: {
275
+ widthen = 0,
275
276
  heighten = 0,
276
277
  opacity = 0,
277
278
  width: radiusWidthAdd = 0,
@@ -679,10 +680,11 @@ const Component = memo(
679
680
  : current
680
681
  ? opacity / 100
681
682
  : 1;
683
+ const deltaWidthen = offset * widthen;
682
684
  const deltaHeighten = offset * heighten;
683
685
  const path = arc
684
- .innerRadius(innerRadius + deltaHeighten)
685
- .outerRadius(outerRadius + deltaHeighten)(value);
686
+ .innerRadius(innerRadius + deltaWidthen)
687
+ .outerRadius(outerRadius + deltaHeighten + deltaWidthen)(value);
686
688
  const pie = getColorList(series.color);
687
689
  const currentPie = animateColor
688
690
  ? getColorList(animateColor)