@easyv/charts 1.3.27 → 1.3.28

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 (49) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/lib/components/Background.js +2 -2
  5. package/lib/components/ConicalGradient.js +21 -21
  6. package/lib/components/Indicator.js +2 -2
  7. package/lib/components/Lighter.js +179 -179
  8. package/lib/components/LinearGradient.js +2 -2
  9. package/lib/components/PieChart.js +3 -40
  10. package/lib/css/index.module.css +41 -41
  11. package/lib/css/piechart.module.css +26 -26
  12. package/lib/element/ConicGradient.js +72 -72
  13. package/lib/hooks/useAnimateData.js +5 -5
  14. package/lib/hooks/useFilterData.js +5 -5
  15. package/lib/hooks/useStackData.js +5 -5
  16. package/lib/hooks/useTooltip.js +10 -10
  17. package/package.json +1 -1
  18. package/src/components/Background.tsx +62 -62
  19. package/src/components/Band.tsx +192 -192
  20. package/src/components/Brush.js +159 -159
  21. package/src/components/Chart.js +99 -99
  22. package/src/components/ChartContainer.tsx +63 -63
  23. package/src/components/ConicalGradient.js +258 -258
  24. package/src/components/ExtentData.js +17 -17
  25. package/src/components/Indicator.js +13 -13
  26. package/src/components/Label.js +225 -225
  27. package/src/components/Lighter.jsx +173 -173
  28. package/src/components/Line.js +150 -150
  29. package/src/components/LinearGradient.js +29 -29
  30. package/src/components/PieChart.js +6 -51
  31. package/src/components/StereoBar.tsx +307 -307
  32. package/src/components/index.js +55 -55
  33. package/src/context/index.js +2 -2
  34. package/src/css/index.module.css +41 -41
  35. package/src/css/piechart.module.css +26 -26
  36. package/src/element/ConicGradient.jsx +55 -55
  37. package/src/element/Line.tsx +33 -33
  38. package/src/element/index.ts +3 -3
  39. package/src/formatter/index.js +1 -1
  40. package/src/formatter/legend.js +90 -90
  41. package/src/hooks/index.js +17 -17
  42. package/src/hooks/useAnimateData.ts +67 -67
  43. package/src/hooks/useFilterData.js +72 -72
  44. package/src/hooks/useStackData.js +101 -101
  45. package/src/hooks/useTooltip.ts +96 -96
  46. package/src/index.js +6 -6
  47. package/src/types/index.d.ts +67 -67
  48. package/src/utils/index.js +757 -757
  49. package/tsconfig.json +23 -23
@@ -1,29 +1,29 @@
1
- /**
2
- * svg渐变滤镜
3
- */
4
- export default ({
5
- id,
6
- colors,
7
- rotate = 0,
8
- gradientUnits,
9
- position: [x1, y1, x2, y2] = [0, 0, 0, 1],
10
- }) => (
11
- <linearGradient
12
- x1={x1}
13
- y1={y1}
14
- x2={x2}
15
- y2={y2}
16
- id={id}
17
- gradientUnits={gradientUnits}
18
- gradientTransform={'rotate(' + rotate + ', .5, .5)'}
19
- >
20
- {colors.map(({ offset, color, stopOpacity = 1 }, index) => (
21
- <stop
22
- key={index}
23
- offset={offset}
24
- stopColor={color}
25
- stopOpacity={stopOpacity}
26
- />
27
- ))}
28
- </linearGradient>
29
- );
1
+ /**
2
+ * svg渐变滤镜
3
+ */
4
+ export default ({
5
+ id,
6
+ colors,
7
+ rotate = 0,
8
+ gradientUnits,
9
+ position: [x1, y1, x2, y2] = [0, 0, 0, 1],
10
+ }) => (
11
+ <linearGradient
12
+ x1={x1}
13
+ y1={y1}
14
+ x2={x2}
15
+ y2={y2}
16
+ id={id}
17
+ gradientUnits={gradientUnits}
18
+ gradientTransform={'rotate(' + rotate + ', .5, .5)'}
19
+ >
20
+ {colors.map(({ offset, color, stopOpacity = 1 }, index) => (
21
+ <stop
22
+ key={index}
23
+ offset={offset}
24
+ stopColor={color}
25
+ stopOpacity={stopOpacity}
26
+ />
27
+ ))}
28
+ </linearGradient>
29
+ );
@@ -330,7 +330,7 @@ const Component = memo(
330
330
 
331
331
  //此处判断data中的y是否都为零,方便饼图都为零时展示
332
332
 
333
- let arcs = 0
333
+ let arcs = 0;
334
334
  data.forEach(function(item){
335
335
  judgeData+=item.y
336
336
  });
@@ -340,8 +340,7 @@ const Component = memo(
340
340
  } else {
341
341
  arcs = arcsFunc(data)
342
342
  }
343
-
344
-
343
+
345
344
  //const arcs = arcsFunc(data); 此处是原本的传输饼图data流程
346
345
  const legendDataWithPercent = getDataWithPercent(arcs, legendPrecision);
347
346
  const _legendDataWithPercent = sortPie(legendDataWithPercent, order);
@@ -379,7 +378,7 @@ const Component = memo(
379
378
  const seriesLength = series.size;
380
379
  if (!seriesLength) return [];
381
380
  const _series = [...series.values()];
382
- if(_series.length<arcs.length) console.warn("请检查数据中是否存在相同的s")
381
+ if(_series.length<arcs.length) console.warn("请检查数据中是否存在相同的s");
383
382
  return arcs.map((arc, index) => getArc(radius, arc, _series[index%_series.length]));
384
383
  }, [series, arcs, radius]);
385
384
  const onClick = useCallback(
@@ -945,63 +944,18 @@ const Label = ({
945
944
  judge,
946
945
  animation,
947
946
  }) => {
948
- // const [labels, setLabels] = useState(null);
949
- // const [opacity, setOpacity] = useState(0);
950
- // console.log('judeg1111',judge)
951
947
  const _arcs = useMemo(
952
948
  () => getDataWithPercent(arcs, precision),
953
949
  [arcs, precision]
954
950
  );
955
-
956
951
  //数据做出容错
957
952
  if (judge == 0) {
958
953
  _arcs.forEach((d) => {
959
954
  d.percent=0
960
955
  })
961
956
  }
962
-
963
- // useEffect(() => {
964
- // if (labels) {
965
- // const children = [...labels.children];
966
- // const bbox = children.reduce(
967
- // (prev, current) => {
968
- // const { topRight, bottomRight, bottomLeft, topLeft } = prev;
969
- // const { x, y, height } = current.getBBox();
970
-
971
- // current._y1 = y;
972
- // current._y2 = y + height;
973
- // current._delta = 0;
974
-
975
- // if (x > 0) {
976
- // if (y > 0) {
977
- // bottomRight.push(current);
978
- // } else {
979
- // topRight.push(current);
980
- // }
981
- // } else {
982
- // if (y > 0) {
983
- // bottomLeft.push(current);
984
- // } else {
985
- // topLeft.push(current);
986
- // }
987
- // }
988
- // return prev;
989
- // },
990
- // {
991
- // topRight: [],
992
- // bottomRight: [],
993
- // bottomLeft: [],
994
- // topLeft: [],
995
- // }
996
- // );
997
- // console.log('bbox: ', bbox);
998
- // }
999
- // }, [labels]);
1000
-
1001
957
  return (
1002
- <g
1003
- // style={{ opacity }} ref={setLabels}
1004
- >
958
+ <g>
1005
959
  {_arcs.map(
1006
960
  (
1007
961
  {
@@ -1012,6 +966,7 @@ const Label = ({
1012
966
  linear: { stops },
1013
967
  },
1014
968
  },
969
+ data,
1015
970
  displayName,
1016
971
  value,
1017
972
  percent,
@@ -1099,7 +1054,7 @@ const Label = ({
1099
1054
  dy={!!(_showName && mode == 'vertical') ? '1.5em' : ''}
1100
1055
  style={getFontStyle(valueFont, 'svg')}
1101
1056
  >
1102
- {value}
1057
+ {data.y}
1103
1058
  </tspan>
1104
1059
  {showSuffix && (
1105
1060
  <tspan