@easyv/charts 1.0.44 → 1.0.48

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 (65) hide show
  1. package/.babelrc +8 -8
  2. package/lib/components/AnimateData.js +2 -2
  3. package/lib/components/Axis.js +12 -12
  4. package/lib/components/Background.js +2 -2
  5. package/lib/components/Carousel.js +4 -2
  6. package/lib/components/Chart.js +2 -2
  7. package/lib/components/ConicalGradient.js +21 -21
  8. package/lib/components/Indicator.js +2 -2
  9. package/lib/components/Label.js +1 -1
  10. package/lib/components/LinearGradient.js +2 -2
  11. package/lib/components/PieChart.js +326 -139
  12. package/lib/css/index.module.css +42 -42
  13. package/lib/css/piechart.module.css +27 -0
  14. package/lib/formatter/legend.js +3 -2
  15. package/lib/hooks/useAnimateData.js +5 -5
  16. package/lib/hooks/useAxes.js +5 -5
  17. package/lib/hooks/useCarouselAxisX.js +5 -5
  18. package/lib/hooks/useExtentData.js +6 -6
  19. package/lib/hooks/useFilterData.js +5 -5
  20. package/lib/hooks/useStackData.js +5 -5
  21. package/lib/hooks/useTooltip.js +10 -10
  22. package/lib/utils/index.js +1 -1
  23. package/package.json +34 -34
  24. package/src/components/AnimateData.tsx +24 -24
  25. package/src/components/Axis.tsx +333 -333
  26. package/src/components/Background.tsx +45 -45
  27. package/src/components/Band.tsx +160 -160
  28. package/src/components/Brush.js +159 -159
  29. package/src/components/Carousel.tsx +144 -142
  30. package/src/components/Chart.js +99 -101
  31. package/src/components/ChartContainer.tsx +63 -63
  32. package/src/components/ConicalGradient.js +258 -258
  33. package/src/components/ExtentData.js +17 -17
  34. package/src/components/FilterData.js +23 -23
  35. package/src/components/Indicator.js +13 -13
  36. package/src/components/Label.js +194 -194
  37. package/src/components/Legend.js +158 -158
  38. package/src/components/Lighter.jsx +162 -162
  39. package/src/components/Line.js +126 -126
  40. package/src/components/LinearGradient.js +29 -29
  41. package/src/components/Mapping.js +71 -72
  42. package/src/components/PieChart.js +876 -709
  43. package/src/components/StackData.js +20 -20
  44. package/src/components/StereoBar.tsx +298 -298
  45. package/src/components/Tooltip.js +116 -116
  46. package/src/components/index.js +49 -49
  47. package/src/context/index.js +2 -2
  48. package/src/css/index.module.css +42 -42
  49. package/src/css/piechart.module.css +27 -0
  50. package/src/element/Line.tsx +33 -33
  51. package/src/element/index.ts +3 -3
  52. package/src/formatter/index.js +1 -1
  53. package/src/formatter/legend.js +87 -87
  54. package/src/hooks/index.js +17 -17
  55. package/src/hooks/useAnimateData.ts +62 -62
  56. package/src/hooks/useAxes.js +143 -143
  57. package/src/hooks/useCarouselAxisX.js +163 -163
  58. package/src/hooks/useExtentData.js +88 -88
  59. package/src/hooks/useFilterData.js +65 -65
  60. package/src/hooks/useStackData.js +100 -100
  61. package/src/hooks/useTooltip.ts +96 -96
  62. package/src/index.js +6 -6
  63. package/src/types/index.d.ts +59 -59
  64. package/src/utils/index.js +640 -641
  65. package/tsconfig.json +22 -22
@@ -1,116 +1,116 @@
1
- /**
2
- * 提示框
3
- */
4
- import { memo } from 'react';
5
- import { getFontStyle, getMargin, getTranslate3d } from '../utils';
6
- import { getIcon } from '../utils';
7
-
8
- export default memo(
9
- ({
10
- x: position,
11
- tickName: x,
12
- data,
13
- series,
14
- config: {
15
- tip: {
16
- data: {
17
- xAxis,
18
- xAxis: { align, font, translate: translateXAxis },
19
- lineHeight,
20
- data: dataConfig,
21
- data: { name, value },
22
- },
23
- image,
24
- margin,
25
- size: { width, height },
26
- translate: translateTip,
27
- },
28
- },
29
- formatter,
30
- isVertical,
31
- }) => {
32
- const translate3d = isVertical
33
- ? {
34
- ...translateTip,
35
- y: translateTip.x + position,
36
- }
37
- : {
38
- ...translateTip,
39
- x: translateTip.x + position,
40
- };
41
- return (
42
- <div
43
- className='__easyv-tooltip'
44
- style={{
45
- pointerEvents: 'none',
46
- transform: getTranslate3d(translate3d),
47
- width,
48
- height,
49
- padding: getMargin(margin),
50
- background: image
51
- ? '50% 50% / 100% 100% no-repeat url(' +
52
- window.appConfig.ASSETS_URL +
53
- image +
54
- ')'
55
- : 'rgba(48, 55, 66, 0.85)',
56
- }}
57
- >
58
- {formatter ? (
59
- formatter({
60
- series,
61
- lineHeight,
62
- x: { x, config: xAxis },
63
- data: { data, config: dataConfig },
64
- })
65
- ) : (
66
- <dl
67
- style={{
68
- display: 'flex',
69
- flexDirection: 'column',
70
- justifyContent: 'space-between',
71
- height: '100%',
72
- }}
73
- >
74
- <dt
75
- style={{
76
- textAlign: align,
77
- transform: getTranslate3d(translateXAxis),
78
- ...font,
79
- }}
80
- >
81
- {x}
82
- </dt>
83
- {data.map(({ y, s }, index) => {
84
- const { type, icon, displayName } = series.find(
85
- (series) => series.name == s
86
- );
87
- const _icon = getIcon(type, icon);
88
- return (
89
- <dd
90
- style={{
91
- display: 'flex',
92
- justifyContent: 'space-between',
93
- lineHeight: lineHeight + 'px',
94
- }}
95
- key={index}
96
- >
97
- <span
98
- style={{
99
- display: 'flex',
100
- alignItems: 'center',
101
- gap: icon.iconGap,
102
- }}
103
- >
104
- <span style={_icon} />
105
- <span style={getFontStyle(name)}>{displayName || s}</span>
106
- </span>
107
- <span style={getFontStyle(value)}>{y}</span>
108
- </dd>
109
- );
110
- })}
111
- </dl>
112
- )}
113
- </div>
114
- );
115
- }
116
- );
1
+ /**
2
+ * 提示框
3
+ */
4
+ import { memo } from 'react';
5
+ import { getFontStyle, getMargin, getTranslate3d } from '../utils';
6
+ import { getIcon } from '../utils';
7
+
8
+ export default memo(
9
+ ({
10
+ x: position,
11
+ tickName: x,
12
+ data,
13
+ series,
14
+ config: {
15
+ tip: {
16
+ data: {
17
+ xAxis,
18
+ xAxis: { align, font, translate: translateXAxis },
19
+ lineHeight,
20
+ data: dataConfig,
21
+ data: { name, value },
22
+ },
23
+ image,
24
+ margin,
25
+ size: { width, height },
26
+ translate: translateTip,
27
+ },
28
+ },
29
+ formatter,
30
+ isVertical,
31
+ }) => {
32
+ const translate3d = isVertical
33
+ ? {
34
+ ...translateTip,
35
+ y: translateTip.x + position,
36
+ }
37
+ : {
38
+ ...translateTip,
39
+ x: translateTip.x + position,
40
+ };
41
+ return (
42
+ <div
43
+ className='__easyv-tooltip'
44
+ style={{
45
+ pointerEvents: 'none',
46
+ transform: getTranslate3d(translate3d),
47
+ width,
48
+ height,
49
+ padding: getMargin(margin),
50
+ background: image
51
+ ? '50% 50% / 100% 100% no-repeat url(' +
52
+ window.appConfig.ASSETS_URL +
53
+ image +
54
+ ')'
55
+ : 'rgba(48, 55, 66, 0.85)',
56
+ }}
57
+ >
58
+ {formatter ? (
59
+ formatter({
60
+ series,
61
+ lineHeight,
62
+ x: { x, config: xAxis },
63
+ data: { data, config: dataConfig },
64
+ })
65
+ ) : (
66
+ <dl
67
+ style={{
68
+ display: 'flex',
69
+ flexDirection: 'column',
70
+ justifyContent: 'space-between',
71
+ height: '100%',
72
+ }}
73
+ >
74
+ <dt
75
+ style={{
76
+ textAlign: align,
77
+ transform: getTranslate3d(translateXAxis),
78
+ ...font,
79
+ }}
80
+ >
81
+ {x}
82
+ </dt>
83
+ {data.map(({ y, s }, index) => {
84
+ const { type, icon, displayName } = series.find(
85
+ (series) => series.name == s
86
+ );
87
+ const _icon = getIcon(type, icon);
88
+ return (
89
+ <dd
90
+ style={{
91
+ display: 'flex',
92
+ justifyContent: 'space-between',
93
+ lineHeight: lineHeight + 'px',
94
+ }}
95
+ key={index}
96
+ >
97
+ <span
98
+ style={{
99
+ display: 'flex',
100
+ alignItems: 'center',
101
+ gap: icon.iconGap,
102
+ }}
103
+ >
104
+ <span style={_icon} />
105
+ <span style={getFontStyle(name)}>{displayName || s}</span>
106
+ </span>
107
+ <span style={getFontStyle(value)}>{y}</span>
108
+ </dd>
109
+ );
110
+ })}
111
+ </dl>
112
+ )}
113
+ </div>
114
+ );
115
+ }
116
+ );
@@ -1,49 +1,49 @@
1
- import Mapping from './Mapping';
2
- import AnimateData from './AnimateData';
3
- import FilterData from './FilterData';
4
- import ExtentData from './ExtentData';
5
- import StackData from './StackData';
6
- import ChartContainer from './ChartContainer';
7
- import Legend from './Legend';
8
- import Axis from './Axis';
9
- import Tooltip from './Tooltip';
10
- import Indicator from './Indicator';
11
- import Band from './Band';
12
- import Line from './Line';
13
- import Background from './Background';
14
- import LinearGradient from './LinearGradient';
15
- import Brush from './Brush';
16
- import Label from './Label';
17
- import StereoBar from './StereoBar';
18
- import Carousel from './Carousel';
19
- import Chart from './Chart';
20
- import ConicalGradient from './ConicalGradient';
21
- import CartesianChart from './CartesianChart';
22
- import PieChart from './PieChart';
23
-
24
- const Area = Line;
25
- export {
26
- Mapping,
27
- AnimateData,
28
- FilterData,
29
- StackData,
30
- ExtentData,
31
- ChartContainer,
32
- Legend,
33
- Tooltip,
34
- Axis,
35
- Indicator,
36
- Band,
37
- Line,
38
- Area,
39
- Background,
40
- LinearGradient,
41
- Brush,
42
- Label,
43
- StereoBar,
44
- Carousel,
45
- CartesianChart,
46
- PieChart,
47
- Chart,
48
- ConicalGradient,
49
- };
1
+ import Mapping from './Mapping';
2
+ import AnimateData from './AnimateData';
3
+ import FilterData from './FilterData';
4
+ import ExtentData from './ExtentData';
5
+ import StackData from './StackData';
6
+ import ChartContainer from './ChartContainer';
7
+ import Legend from './Legend';
8
+ import Axis from './Axis';
9
+ import Tooltip from './Tooltip';
10
+ import Indicator from './Indicator';
11
+ import Band from './Band';
12
+ import Line from './Line';
13
+ import Background from './Background';
14
+ import LinearGradient from './LinearGradient';
15
+ import Brush from './Brush';
16
+ import Label from './Label';
17
+ import StereoBar from './StereoBar';
18
+ import Carousel from './Carousel';
19
+ import Chart from './Chart';
20
+ import ConicalGradient from './ConicalGradient';
21
+ import CartesianChart from './CartesianChart';
22
+ import PieChart from './PieChart';
23
+
24
+ const Area = Line;
25
+ export {
26
+ Mapping,
27
+ AnimateData,
28
+ FilterData,
29
+ StackData,
30
+ ExtentData,
31
+ ChartContainer,
32
+ Legend,
33
+ Tooltip,
34
+ Axis,
35
+ Indicator,
36
+ Band,
37
+ Line,
38
+ Area,
39
+ Background,
40
+ LinearGradient,
41
+ Brush,
42
+ Label,
43
+ StereoBar,
44
+ Carousel,
45
+ CartesianChart,
46
+ PieChart,
47
+ Chart,
48
+ ConicalGradient,
49
+ };
@@ -1,2 +1,2 @@
1
- import { createContext } from 'react';
2
- export const chartContext = createContext();
1
+ import { createContext } from 'react';
2
+ export const chartContext = createContext();
@@ -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: 50% 25% 25%;
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
- }
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: 50% 25% 25%;
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
+ }
@@ -0,0 +1,27 @@
1
+ /*甜甜圈图专用css*/
2
+ .label-line {
3
+ stroke-dasharray: 100;
4
+ stroke-dashoffset: 100;
5
+ animation: dash 800ms ease forwards;
6
+ }
7
+
8
+ .label-text {
9
+ opacity: 0;
10
+ animation: show 800ms ease forwards;
11
+ }
12
+
13
+ .inner-arc {
14
+ animation: dash 2s ease forwards;
15
+ }
16
+
17
+ @keyframes dash {
18
+ 100% {
19
+ stroke-dashoffset: 0%;
20
+ }
21
+ }
22
+
23
+ @keyframes show {
24
+ 100% {
25
+ opacity: 1;
26
+ }
27
+ }
@@ -1,33 +1,33 @@
1
- import React from 'react';
2
-
3
- type Props = {
4
- config: ChartLine;
5
- x1: number;
6
- x2: number;
7
- y1: number;
8
- y2: number;
9
- className: string;
10
- };
11
-
12
- export default ({
13
- config: { show, color, lineWidth, strokeDasharray },
14
- x1,
15
- x2,
16
- y1,
17
- y2,
18
- className,
19
- }: Props) => {
20
- if (!show) return null;
21
- return (
22
- <line
23
- className={className}
24
- x1={x1}
25
- x2={x2}
26
- y1={y1}
27
- y2={y2}
28
- stroke={color}
29
- strokeWidth={lineWidth}
30
- strokeDasharray={strokeDasharray}
31
- />
32
- );
33
- };
1
+ import React from 'react';
2
+
3
+ type Props = {
4
+ config: ChartLine;
5
+ x1: number;
6
+ x2: number;
7
+ y1: number;
8
+ y2: number;
9
+ className: string;
10
+ };
11
+
12
+ export default ({
13
+ config: { show, color, lineWidth, strokeDasharray },
14
+ x1,
15
+ x2,
16
+ y1,
17
+ y2,
18
+ className,
19
+ }: Props) => {
20
+ if (!show) return null;
21
+ return (
22
+ <line
23
+ className={className}
24
+ x1={x1}
25
+ x2={x2}
26
+ y1={y1}
27
+ y2={y2}
28
+ stroke={color}
29
+ strokeWidth={lineWidth}
30
+ strokeDasharray={strokeDasharray}
31
+ />
32
+ );
33
+ };
@@ -1,3 +1,3 @@
1
- import Line from './Line';
2
-
3
- export { Line };
1
+ import Line from './Line';
2
+
3
+ export { Line };
@@ -1 +1 @@
1
- export * from './legend';
1
+ export * from './legend';