@easyv/charts 1.3.3 → 1.3.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.
Files changed (71) 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 +2 -2
  6. package/lib/components/Carousel.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 +10 -11
  10. package/lib/components/Lighter.js +179 -179
  11. package/lib/components/LinearGradient.js +2 -2
  12. package/lib/components/Marquee.js +3 -3
  13. package/lib/components/TextOverflow.js +3 -3
  14. package/lib/css/index.module.css +41 -41
  15. package/lib/css/piechart.module.css +26 -26
  16. package/lib/element/ConicGradient.js +72 -72
  17. package/lib/hooks/useAnimateData.js +5 -5
  18. package/lib/hooks/useAxes.js +5 -5
  19. package/lib/hooks/useCarouselAxisX.js +5 -5
  20. package/lib/hooks/useExtentData.js +6 -6
  21. package/lib/hooks/useFilterData.js +5 -5
  22. package/lib/hooks/useStackData.js +5 -5
  23. package/lib/hooks/useTooltip.js +10 -10
  24. package/lib/utils/index.js +48 -48
  25. package/package.json +54 -54
  26. package/src/components/AnimateData.tsx +24 -24
  27. package/src/components/Axis.tsx +354 -354
  28. package/src/components/Background.tsx +62 -62
  29. package/src/components/Band.tsx +169 -169
  30. package/src/components/BaseLine.js +82 -82
  31. package/src/components/Brush.js +159 -159
  32. package/src/components/Carousel.tsx +144 -144
  33. package/src/components/Chart.js +99 -99
  34. package/src/components/ChartContainer.tsx +63 -63
  35. package/src/components/ConicalGradient.js +258 -258
  36. package/src/components/ExtentData.js +17 -17
  37. package/src/components/FilterData.js +23 -23
  38. package/src/components/Indicator.js +13 -13
  39. package/src/components/Label.js +228 -225
  40. package/src/components/Legend.js +158 -158
  41. package/src/components/Lighter.jsx +173 -173
  42. package/src/components/Line.js +145 -145
  43. package/src/components/LinearGradient.js +29 -29
  44. package/src/components/Mapping.js +71 -71
  45. package/src/components/Marquee.js +88 -88
  46. package/src/components/PieChart.js +1278 -1278
  47. package/src/components/StackData.js +16 -16
  48. package/src/components/StereoBar.tsx +307 -307
  49. package/src/components/TextOverflow.js +51 -51
  50. package/src/components/Tooltip.js +169 -169
  51. package/src/components/index.js +55 -55
  52. package/src/context/index.js +2 -2
  53. package/src/css/index.module.css +41 -41
  54. package/src/css/piechart.module.css +26 -26
  55. package/src/element/ConicGradient.jsx +55 -55
  56. package/src/element/Line.tsx +33 -33
  57. package/src/element/index.ts +3 -3
  58. package/src/formatter/index.js +1 -1
  59. package/src/formatter/legend.js +90 -90
  60. package/src/hooks/index.js +17 -17
  61. package/src/hooks/useAnimateData.ts +67 -67
  62. package/src/hooks/useAxes.js +144 -144
  63. package/src/hooks/useCarouselAxisX.js +163 -163
  64. package/src/hooks/useExtentData.js +89 -89
  65. package/src/hooks/useFilterData.js +72 -72
  66. package/src/hooks/useStackData.js +101 -101
  67. package/src/hooks/useTooltip.ts +96 -96
  68. package/src/index.js +6 -6
  69. package/src/types/index.d.ts +67 -67
  70. package/src/utils/index.js +738 -738
  71. package/tsconfig.json +23 -23
@@ -1,51 +1,51 @@
1
- import { memo } from 'react';
2
- import Marquee from './Marquee'
3
- /**
4
- * 文本溢出组件
5
- * eg: <TextOverflow type={溢出形式} value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
6
- */
7
-
8
- export default memo((props) => {
9
- const {
10
- type, //形式:跑马灯marquee /省略号 ellipsis/换行 break-word
11
- value, // 文本
12
- style, // 样式
13
- speed = 5, // 动画速度
14
- } = props;
15
-
16
- const getTextOverflow = (type) => {
17
- switch (type) {
18
- case 'ellipsis':
19
- return {
20
- overflow: 'hidden',
21
- textOverflow: 'ellipsis',
22
- whiteSpace: 'nowrap',
23
- };
24
- case 'break-word':
25
- return {
26
- wordBreak: 'break-all',
27
- wordWrap: 'break-word',
28
- };
29
- case 'marquee':
30
- return {
31
- whiteSpace: 'nowrap',
32
- };
33
- }
34
- };
35
-
36
-
37
- const styles = {
38
- ...getTextOverflow(type),
39
- ...style
40
- }
41
-
42
-
43
- return type == 'marquee' ? (
44
- <Marquee
45
- value={value}
46
- speed={speed}
47
- style={styles} />
48
- ) : (
49
- <div style={styles} title={value || null}> {value}</div>
50
- );
51
- });
1
+ import { memo } from 'react';
2
+ import Marquee from './Marquee'
3
+ /**
4
+ * 文本溢出组件
5
+ * eg: <TextOverflow type={溢出形式} value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
6
+ */
7
+
8
+ export default memo((props) => {
9
+ const {
10
+ type, //形式:跑马灯marquee /省略号 ellipsis/换行 break-word
11
+ value, // 文本
12
+ style, // 样式
13
+ speed = 5, // 动画速度
14
+ } = props;
15
+
16
+ const getTextOverflow = (type) => {
17
+ switch (type) {
18
+ case 'ellipsis':
19
+ return {
20
+ overflow: 'hidden',
21
+ textOverflow: 'ellipsis',
22
+ whiteSpace: 'nowrap',
23
+ };
24
+ case 'break-word':
25
+ return {
26
+ wordBreak: 'break-all',
27
+ wordWrap: 'break-word',
28
+ };
29
+ case 'marquee':
30
+ return {
31
+ whiteSpace: 'nowrap',
32
+ };
33
+ }
34
+ };
35
+
36
+
37
+ const styles = {
38
+ ...getTextOverflow(type),
39
+ ...style
40
+ }
41
+
42
+
43
+ return type == 'marquee' ? (
44
+ <Marquee
45
+ value={value}
46
+ speed={speed}
47
+ style={styles} />
48
+ ) : (
49
+ <div style={styles} title={value || null}> {value}</div>
50
+ );
51
+ });
@@ -1,169 +1,169 @@
1
- /**
2
- * 提示框
3
- */
4
- import { memo, useMemo } from 'react';
5
- import { getFontStyle, getMargin, getTranslate3d } from '../utils';
6
- import { getIcon } from '../utils';
7
- export default memo(
8
- ({
9
- x: position,
10
- tickName: x,
11
- marginLeft,
12
- marginTop,
13
- data,
14
- series,
15
- config: {
16
- tip: {
17
- data: {
18
- xAxis,
19
- xAxis: { align, font, translate: translateXAxis },
20
- data: dataConfig,
21
- data: { lineHeight, iconSize, name, value, suffix },
22
- },
23
- image,
24
- margin,
25
- size: { width: tipWidth, height: tipHeight },
26
- translate: translateTip,
27
- },
28
- },
29
- formatter,
30
- isVertical,
31
- width,
32
- height,
33
- }) => {
34
- const tipPosition = useMemo(() => {
35
- const translate3d = isVertical
36
- ? {
37
- ...translateTip,
38
- y: translateTip.y + position + marginTop,
39
- }
40
- : {
41
- ...translateTip,
42
- x: translateTip.x + position + marginLeft,
43
- };
44
-
45
- if (translate3d.x + tipWidth > width) {
46
- const newPositon = position + marginLeft - tipWidth - translateTip.x;
47
- translate3d.x = newPositon >= 0 ? newPositon : 0;
48
- }
49
- if (translate3d.y + tipHeight > height) {
50
- const newPositon = position + marginTop - tipHeight - translateTip.y;
51
- translate3d.y = newPositon <= 0 ? newPositon : height - tipHeight;
52
- }
53
- return getTranslate3d(translate3d);
54
- }, [
55
- width,
56
- height,
57
- marginLeft,
58
- marginTop,
59
- position,
60
- tipWidth,
61
- tipHeight,
62
- translateTip,
63
- ]);
64
-
65
- return (
66
- <div
67
- className='__easyv-tooltip'
68
- style={{
69
- pointerEvents: 'none',
70
- transform: tipPosition,
71
- width: tipWidth,
72
- height: tipHeight,
73
- padding: getMargin(margin),
74
- background: image
75
- ? '50% 50% / 100% 100% no-repeat url(' +
76
- window.appConfig.ASSETS_URL +
77
- image +
78
- ')'
79
- : 'rgba(48, 55, 66, 0.85)',
80
- ...getFontStyle(font),
81
- }}
82
- >
83
- {formatter ? (
84
- formatter({
85
- series,
86
- x: { x, config: xAxis },
87
- data: { data, config: dataConfig },
88
- })
89
- ) : (
90
- <dl
91
- style={{
92
- display: 'flex',
93
- flexDirection: 'column',
94
- justifyContent: 'space-between',
95
- height: '100%',
96
- }}
97
- >
98
- <dt
99
- style={{
100
- textAlign: align,
101
- transform: getTranslate3d(translateXAxis),
102
- ...font,
103
- }}
104
- >
105
- {x}
106
- </dt>
107
- {data.map(({ showY, s }, index) => {
108
- const { type, icon, displayName } = series.find(
109
- (series) => series.name == s
110
- );
111
- const {
112
- show: showSuffix,
113
- content,
114
- font: suffiixFont,
115
- translate: suffixTranslate,
116
- } = suffix;
117
- const tmp = new Map();
118
- Object.values(content).forEach((item) => {
119
- tmp.set(item['suffix'].name, item['suffix'].suffix);
120
- });
121
- const _icon = getIcon(type, icon);
122
- return (
123
- <dd
124
- style={{
125
- display: 'flex',
126
- justifyContent: 'space-between',
127
- lineHeight: lineHeight + 'px',
128
- }}
129
- key={index}
130
- >
131
- <span
132
- style={{
133
- border: '1px solid red',
134
- display: 'flex',
135
- alignItems: 'center',
136
- gap: icon.iconGap,
137
- }}
138
- >
139
- <span
140
- style={{
141
- ..._icon,
142
- width: iconSize + 'px',
143
- height: iconSize + 'px',
144
- }}
145
- />
146
- <span style={getFontStyle(name)}>{displayName || s}</span>
147
- </span>
148
- <span style={getFontStyle(value)}>
149
- {showY}
150
- {showSuffix && (
151
- <span
152
- style={{
153
- ...getFontStyle(suffiixFont),
154
- transform: getTranslate3d(suffixTranslate),
155
- }}
156
- >
157
- {tmp.get(s)}
158
- </span>
159
- )}
160
- </span>
161
- </dd>
162
- );
163
- })}
164
- </dl>
165
- )}
166
- </div>
167
- );
168
- }
169
- );
1
+ /**
2
+ * 提示框
3
+ */
4
+ import { memo, useMemo } from 'react';
5
+ import { getFontStyle, getMargin, getTranslate3d } from '../utils';
6
+ import { getIcon } from '../utils';
7
+ export default memo(
8
+ ({
9
+ x: position,
10
+ tickName: x,
11
+ marginLeft,
12
+ marginTop,
13
+ data,
14
+ series,
15
+ config: {
16
+ tip: {
17
+ data: {
18
+ xAxis,
19
+ xAxis: { align, font, translate: translateXAxis },
20
+ data: dataConfig,
21
+ data: { lineHeight, iconSize, name, value, suffix },
22
+ },
23
+ image,
24
+ margin,
25
+ size: { width: tipWidth, height: tipHeight },
26
+ translate: translateTip,
27
+ },
28
+ },
29
+ formatter,
30
+ isVertical,
31
+ width,
32
+ height,
33
+ }) => {
34
+ const tipPosition = useMemo(() => {
35
+ const translate3d = isVertical
36
+ ? {
37
+ ...translateTip,
38
+ y: translateTip.y + position + marginTop,
39
+ }
40
+ : {
41
+ ...translateTip,
42
+ x: translateTip.x + position + marginLeft,
43
+ };
44
+
45
+ if (translate3d.x + tipWidth > width) {
46
+ const newPositon = position + marginLeft - tipWidth - translateTip.x;
47
+ translate3d.x = newPositon >= 0 ? newPositon : 0;
48
+ }
49
+ if (translate3d.y + tipHeight > height) {
50
+ const newPositon = position + marginTop - tipHeight - translateTip.y;
51
+ translate3d.y = newPositon <= 0 ? newPositon : height - tipHeight;
52
+ }
53
+ return getTranslate3d(translate3d);
54
+ }, [
55
+ width,
56
+ height,
57
+ marginLeft,
58
+ marginTop,
59
+ position,
60
+ tipWidth,
61
+ tipHeight,
62
+ translateTip,
63
+ ]);
64
+
65
+ return (
66
+ <div
67
+ className='__easyv-tooltip'
68
+ style={{
69
+ pointerEvents: 'none',
70
+ transform: tipPosition,
71
+ width: tipWidth,
72
+ height: tipHeight,
73
+ padding: getMargin(margin),
74
+ background: image
75
+ ? '50% 50% / 100% 100% no-repeat url(' +
76
+ window.appConfig.ASSETS_URL +
77
+ image +
78
+ ')'
79
+ : 'rgba(48, 55, 66, 0.85)',
80
+ ...getFontStyle(font),
81
+ }}
82
+ >
83
+ {formatter ? (
84
+ formatter({
85
+ series,
86
+ x: { x, config: xAxis },
87
+ data: { data, config: dataConfig },
88
+ })
89
+ ) : (
90
+ <dl
91
+ style={{
92
+ display: 'flex',
93
+ flexDirection: 'column',
94
+ justifyContent: 'space-between',
95
+ height: '100%',
96
+ }}
97
+ >
98
+ <dt
99
+ style={{
100
+ textAlign: align,
101
+ transform: getTranslate3d(translateXAxis),
102
+ ...font,
103
+ }}
104
+ >
105
+ {x}
106
+ </dt>
107
+ {data.map(({ showY, s }, index) => {
108
+ const { type, icon, displayName } = series.find(
109
+ (series) => series.name == s
110
+ );
111
+ const {
112
+ show: showSuffix,
113
+ content,
114
+ font: suffiixFont,
115
+ translate: suffixTranslate,
116
+ } = suffix;
117
+ const tmp = new Map();
118
+ Object.values(content).forEach((item) => {
119
+ tmp.set(item['suffix'].name, item['suffix'].suffix);
120
+ });
121
+ const _icon = getIcon(type, icon);
122
+ return (
123
+ <dd
124
+ style={{
125
+ display: 'flex',
126
+ justifyContent: 'space-between',
127
+ lineHeight: lineHeight + 'px',
128
+ }}
129
+ key={index}
130
+ >
131
+ <span
132
+ style={{
133
+ border: '1px solid red',
134
+ display: 'flex',
135
+ alignItems: 'center',
136
+ gap: icon.iconGap,
137
+ }}
138
+ >
139
+ <span
140
+ style={{
141
+ ..._icon,
142
+ width: iconSize + 'px',
143
+ height: iconSize + 'px',
144
+ }}
145
+ />
146
+ <span style={getFontStyle(name)}>{displayName || s}</span>
147
+ </span>
148
+ <span style={getFontStyle(value)}>
149
+ {showY}
150
+ {showSuffix && (
151
+ <span
152
+ style={{
153
+ ...getFontStyle(suffiixFont),
154
+ transform: getTranslate3d(suffixTranslate),
155
+ }}
156
+ >
157
+ {tmp.get(s)}
158
+ </span>
159
+ )}
160
+ </span>
161
+ </dd>
162
+ );
163
+ })}
164
+ </dl>
165
+ )}
166
+ </div>
167
+ );
168
+ }
169
+ );
@@ -1,55 +1,55 @@
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 Lighter from './Lighter';
13
- import Line from './Line';
14
- import Background from './Background';
15
- import LinearGradient from './LinearGradient';
16
- import Brush from './Brush';
17
- import Label from './Label';
18
- import StereoBar from './StereoBar';
19
- import Carousel from './Carousel';
20
- import Chart from './Chart';
21
- import ConicalGradient from './ConicalGradient';
22
- import CartesianChart from './CartesianChart';
23
- import PieChart from './PieChart';
24
- import TextOverflow from './TextOverflow';
25
- import BaseLine from './BaseLine';
26
-
27
- const Area = Line;
28
- export {
29
- Mapping,
30
- AnimateData,
31
- FilterData,
32
- StackData,
33
- ExtentData,
34
- ChartContainer,
35
- Legend,
36
- Tooltip,
37
- Axis,
38
- Indicator,
39
- Band,
40
- Lighter,
41
- Line,
42
- Area,
43
- Background,
44
- LinearGradient,
45
- Brush,
46
- Label,
47
- StereoBar,
48
- Carousel,
49
- CartesianChart,
50
- PieChart,
51
- TextOverflow,
52
- Chart,
53
- ConicalGradient,
54
- BaseLine,
55
- };
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 Lighter from './Lighter';
13
+ import Line from './Line';
14
+ import Background from './Background';
15
+ import LinearGradient from './LinearGradient';
16
+ import Brush from './Brush';
17
+ import Label from './Label';
18
+ import StereoBar from './StereoBar';
19
+ import Carousel from './Carousel';
20
+ import Chart from './Chart';
21
+ import ConicalGradient from './ConicalGradient';
22
+ import CartesianChart from './CartesianChart';
23
+ import PieChart from './PieChart';
24
+ import TextOverflow from './TextOverflow';
25
+ import BaseLine from './BaseLine';
26
+
27
+ const Area = Line;
28
+ export {
29
+ Mapping,
30
+ AnimateData,
31
+ FilterData,
32
+ StackData,
33
+ ExtentData,
34
+ ChartContainer,
35
+ Legend,
36
+ Tooltip,
37
+ Axis,
38
+ Indicator,
39
+ Band,
40
+ Lighter,
41
+ Line,
42
+ Area,
43
+ Background,
44
+ LinearGradient,
45
+ Brush,
46
+ Label,
47
+ StereoBar,
48
+ Carousel,
49
+ CartesianChart,
50
+ PieChart,
51
+ TextOverflow,
52
+ Chart,
53
+ ConicalGradient,
54
+ BaseLine,
55
+ };
@@ -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: 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
  }