@easyv/charts 1.2.1 → 1.2.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 (90) hide show
  1. package/.babelrc +8 -8
  2. package/.husky/commit-msg +3 -3
  3. package/CHANGELOG.md +18 -18
  4. package/commitlint.config.js +1 -1
  5. package/lib/components/AnimateData.js +40 -36
  6. package/lib/components/Axis.js +333 -329
  7. package/lib/components/Background.js +2 -2
  8. package/lib/components/Band.js +177 -173
  9. package/lib/components/Brush.js +201 -201
  10. package/lib/components/Carousel.js +171 -164
  11. package/lib/components/CartesianChart.js +11 -7
  12. package/lib/components/Chart.js +114 -111
  13. package/lib/components/ChartContainer.js +62 -58
  14. package/lib/components/ConicalGradient.js +268 -264
  15. package/lib/components/ExtentData.js +48 -45
  16. package/lib/components/FilterData.js +56 -53
  17. package/lib/components/Indicator.js +2 -2
  18. package/lib/components/Label.js +278 -278
  19. package/lib/components/Legend.js +160 -154
  20. package/lib/components/Lighter.js +179 -179
  21. package/lib/components/Line.js +187 -181
  22. package/lib/components/LinearGradient.js +2 -2
  23. package/lib/components/Mapping.js +130 -127
  24. package/lib/components/Marquee.js +98 -0
  25. package/lib/components/PieChart.js +1078 -1061
  26. package/lib/components/StackData.js +48 -45
  27. package/lib/components/StereoBar.js +340 -336
  28. package/lib/components/TextOverflow.js +65 -0
  29. package/lib/components/Tooltip.js +155 -155
  30. package/lib/components/index.js +202 -194
  31. package/lib/css/index.module.css +41 -41
  32. package/lib/css/piechart.module.css +26 -26
  33. package/lib/element/ConicGradient.js +72 -72
  34. package/lib/formatter/legend.js +91 -91
  35. package/lib/hooks/index.js +62 -62
  36. package/lib/hooks/useAnimateData.js +88 -88
  37. package/lib/hooks/useAxes.js +135 -135
  38. package/lib/hooks/useCarouselAxisX.js +184 -184
  39. package/lib/hooks/useExtentData.js +128 -128
  40. package/lib/hooks/useFilterData.js +112 -112
  41. package/lib/hooks/useStackData.js +136 -134
  42. package/lib/hooks/useTooltip.js +10 -10
  43. package/lib/index.js +89 -85
  44. package/lib/utils/index.js +835 -832
  45. package/package.json +53 -51
  46. package/src/components/AnimateData.tsx +24 -24
  47. package/src/components/Axis.tsx +354 -354
  48. package/src/components/Background.tsx +45 -45
  49. package/src/components/Band.tsx +173 -173
  50. package/src/components/Brush.js +159 -159
  51. package/src/components/Carousel.tsx +144 -144
  52. package/src/components/Chart.js +99 -99
  53. package/src/components/ChartContainer.tsx +63 -63
  54. package/src/components/ConicalGradient.js +258 -258
  55. package/src/components/ExtentData.js +17 -17
  56. package/src/components/FilterData.js +23 -23
  57. package/src/components/Indicator.js +13 -13
  58. package/src/components/Label.js +206 -206
  59. package/src/components/Legend.js +158 -158
  60. package/src/components/Lighter.jsx +173 -173
  61. package/src/components/Line.js +144 -144
  62. package/src/components/LinearGradient.js +29 -29
  63. package/src/components/Mapping.js +71 -71
  64. package/src/components/Marquee.js +93 -74
  65. package/src/components/PieChart.js +1288 -1097
  66. package/src/components/StackData.js +20 -20
  67. package/src/components/StereoBar.tsx +310 -310
  68. package/src/components/TextOverflow.js +51 -0
  69. package/src/components/Tooltip.js +169 -169
  70. package/src/components/index.js +53 -51
  71. package/src/context/index.js +2 -2
  72. package/src/css/index.module.css +41 -41
  73. package/src/css/piechart.module.css +26 -26
  74. package/src/element/ConicGradient.jsx +55 -55
  75. package/src/element/Line.tsx +33 -33
  76. package/src/element/index.ts +3 -3
  77. package/src/formatter/index.js +1 -1
  78. package/src/formatter/legend.js +90 -90
  79. package/src/hooks/index.js +17 -17
  80. package/src/hooks/useAnimateData.ts +67 -67
  81. package/src/hooks/useAxes.js +144 -144
  82. package/src/hooks/useCarouselAxisX.js +163 -163
  83. package/src/hooks/useExtentData.js +88 -88
  84. package/src/hooks/useFilterData.js +72 -72
  85. package/src/hooks/useStackData.js +100 -100
  86. package/src/hooks/useTooltip.ts +96 -96
  87. package/src/index.js +6 -6
  88. package/src/types/index.d.ts +67 -67
  89. package/src/utils/index.js +696 -696
  90. package/tsconfig.json +22 -22
@@ -1,354 +1,354 @@
1
- /**
2
- * x, y, z轴
3
- */
4
- import React, {
5
- ComponentType,
6
- memo,
7
- ReactComponentElement,
8
- useContext,
9
- CSSProperties,
10
- MouseEventHandler,
11
- } from 'react';
12
- import { getTickCoord, getGridCoord } from '../utils';
13
- import { chartContext } from '../context';
14
- import { Line } from '../element';
15
- const defaultEvent = () => {};
16
- const defaultAlign: Align = {
17
- textAnchor: 'middle',
18
- dominantBaseline: 'middle',
19
- };
20
- const defaultOrientation = 'bottom';
21
- const defaultTickSize = 6;
22
- const defaultFormatter: (
23
- d: string,
24
- { suffix }: { suffix: string }
25
- ) => string = (d, { suffix }) => d + suffix;
26
-
27
- const getAxesPath: (
28
- orientation: Orientation,
29
- { width, height }: Context
30
- ) => string = (orientation, { width, height }) => {
31
- switch (orientation) {
32
- case 'top':
33
- case 'bottom':
34
- return 'M-0.5, 0H' + width;
35
- case 'left':
36
- case 'right':
37
- return 'M0, -0.5V' + (height + 0.5);
38
- }
39
- };
40
- /**
41
- * 根据坐标轴位置来确定轴标签的垂直对齐方式,水平对齐方式,以及轴标签位于坐标轴的哪个方向
42
- * @param orientation 坐标轴位置
43
- * @param rotate 旋转角度
44
- * @returns {
45
- * dominantBaseline,
46
- * textAnchor,
47
- * directionX,
48
- * directionY
49
- * }
50
- */
51
- const getLayout: (
52
- orientation: Orientation,
53
- rotate: number
54
- ) => {
55
- dominantBaseline: string;
56
- textAnchor: string;
57
- directionX: number;
58
- directionY: number;
59
- } = (orientation, rotate) => {
60
- switch (orientation) {
61
- case 'top':
62
- return {
63
- dominantBaseline: 'text-after-edge',
64
- textAnchor: rotate ? 'end' : 'middle',
65
- directionX: 1,
66
- directionY: -1,
67
- };
68
- case 'bottom':
69
- return {
70
- dominantBaseline: 'text-before-edge',
71
- textAnchor: rotate ? 'start' : 'middle',
72
- directionX: 1,
73
- directionY: 1,
74
- };
75
- case 'left':
76
- return {
77
- dominantBaseline: 'middle',
78
- textAnchor: 'end',
79
- directionX: -1,
80
- directionY: 1,
81
- };
82
- case 'right':
83
- return {
84
- dominantBaseline: 'middle',
85
- textAnchor: 'start',
86
- directionX: 1,
87
- directionY: 1,
88
- };
89
- }
90
- };
91
- const AxisLine: ({
92
- orientation: Orientation,
93
- config: ChartLine,
94
- }: any) => ReactComponentElement<ComponentType> | null = ({
95
- orientation = defaultOrientation,
96
- config: { show, color, lineWidth },
97
- }) => {
98
- if (!show) return null;
99
- const context: Context = useContext(chartContext);
100
- return (
101
- <path
102
- d={getAxesPath(orientation, context)}
103
- stroke={color}
104
- strokeWidth={lineWidth}
105
- />
106
- );
107
- };
108
-
109
- const Unit: ({
110
- config: {
111
- show: boolean,
112
- text: string,
113
- font: Font,
114
- translate: Translate,
115
- align: Align,
116
- },
117
- }: any) => ReactComponentElement<ComponentType> | null = ({
118
- config: {
119
- show,
120
- text,
121
- font: { bold, color, fontFamily, fontSize, italic, letterSpacing },
122
- translate: { x: translateX, y: translateY },
123
- align: { textAnchor } = defaultAlign,
124
- },
125
- }) => {
126
- if (!show) return null;
127
- return (
128
- <text
129
- className='__easyv-unit'
130
- transform={'translate(' + translateX + ', ' + translateY + ')'}
131
- fontFamily={fontFamily}
132
- fontSize={fontSize}
133
- fill={color}
134
- fontWeight={bold ? 'bold' : 'normal'}
135
- fontStyle={italic ? 'italic' : 'normal'}
136
- letterSpacing={letterSpacing}
137
- textAnchor={textAnchor}
138
- >
139
- {text}
140
- </text>
141
- );
142
- };
143
-
144
- type LabelType = {
145
- className: string;
146
- orientation: Orientation;
147
- label: string;
148
- coordinate: number;
149
- formatter: Function;
150
- tickSize: number;
151
- rotate: number;
152
- onClick?: MouseEventHandler;
153
- config: {
154
- show: boolean;
155
- translate: Translate;
156
- font: Font;
157
- style: CSSProperties | Function;
158
- };
159
- };
160
-
161
- const Label: (
162
- props: LabelType
163
- ) => ReactComponentElement<ComponentType> | null = ({
164
- className,
165
- orientation = defaultOrientation,
166
- label,
167
- coordinate,
168
- formatter = defaultFormatter,
169
- tickSize,
170
- rotate = 0,
171
- config,
172
- onClick = defaultEvent,
173
- config: {
174
- show,
175
- style,
176
- translate: { x: translateX, y: translateY },
177
- font: { fontFamily, fontSize, color, bold, italic, letterSpacing },
178
- },
179
- }) => {
180
- if (!show) return null;
181
- const _label = formatter(label, config);
182
- const { dominantBaseline, textAnchor, directionX, directionY } = getLayout(
183
- orientation,
184
- rotate
185
- );
186
- const isVertical = orientation == 'left' || orientation == 'right';
187
-
188
- const x =
189
- (isVertical ? tickSize * directionX : coordinate) + translateX * directionX;
190
- const y =
191
- (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
192
-
193
- const translateText = 'translate(' + x + ', ' + y + ')';
194
-
195
- const _style = style && (typeof style == 'object' ? style : style(_label));
196
-
197
- return (
198
- <text
199
- className={className}
200
- style={{
201
- ..._style,
202
- whiteSpace: 'pre',
203
- }}
204
- onClick={onClick}
205
- data-data={JSON.stringify({ x: label })}
206
- dominantBaseline={dominantBaseline}
207
- textAnchor={textAnchor}
208
- fontFamily={fontFamily}
209
- fontSize={fontSize}
210
- fill={color}
211
- fontWeight={bold ? 'bold' : 'normal'}
212
- fontStyle={italic ? 'italic' : 'normal'}
213
- letterSpacing={letterSpacing}
214
- dx='0'
215
- dy='0'
216
- transform={
217
- Array.isArray(_label)
218
- ? rotate !== 0
219
- ? isVertical
220
- ? translateText + 'rotate(' + rotate + ')'
221
- : 'rotate(' + rotate + ', ' + x + ', ' + y + ')'
222
- : isVertical
223
- ? translateText
224
- : 'translate(' + translateX + ', ' + translateY + ')'
225
- : translateText + 'rotate(' + rotate + ')'
226
- }
227
- >
228
- {!!Array.isArray(_label)
229
- ? _label.map((item, index) => (
230
- <tspan key={index} x={x} dy='1em'>
231
- {item}
232
- </tspan>
233
- ))
234
- : _label}
235
- </text>
236
- );
237
- };
238
-
239
- export default memo(
240
- ({
241
- orientation,
242
- scaler,
243
- tickSize = defaultTickSize,
244
- ticks,
245
- formatter,
246
- rotate,
247
- triggerClick,
248
- config: { on, label, axisLine, tickLine, gridLine, unit },
249
- positions,
250
- }: any) => {
251
- if (!(on && ticks.length > 0)) return null;
252
- const { width, height } = useContext(chartContext);
253
- const x = orientation == 'right' ? width : 0;
254
- const y = orientation == 'bottom' ? height : 0;
255
-
256
- return (
257
- <>
258
- {axisLine && tickLine && (
259
- <>
260
- {axisLine &&
261
- (positions && positions.length ? (
262
- positions.map(({ x, y }: any, index: number) => (
263
- <g key={index} transform={'translate(' + x + ', ' + y + ')'}>
264
- <AxisLine orientation={orientation} config={axisLine} />
265
- {tickLine &&
266
- ticks.map((tick: string, index: number) => {
267
- const coordinate = scaler(tick);
268
- if (isNaN(coordinate)) return null;
269
- const _tickSize = tickLine.tickSize || tickSize;
270
- return (
271
- <Line
272
- className='__easyv-tickLine'
273
- key={index}
274
- config={tickLine}
275
- {...getTickCoord({
276
- orientation,
277
- coordinate,
278
- tickSize: _tickSize,
279
- })}
280
- />
281
- );
282
- })}
283
- </g>
284
- ))
285
- ) : (
286
- <g transform={'translate(' + x + ', ' + y + ')'}>
287
- <AxisLine orientation={orientation} config={axisLine} />
288
- {tickLine &&
289
- ticks.map((tick: string, index: number) => {
290
- const coordinate = scaler(tick);
291
- if (isNaN(coordinate)) return null;
292
- const _tickSize = tickLine.tickSize || tickSize;
293
- return (
294
- <Line
295
- className='__easyv-tickLine'
296
- key={index}
297
- config={tickLine}
298
- {...getTickCoord({
299
- orientation,
300
- coordinate,
301
- tickSize: _tickSize,
302
- })}
303
- />
304
- );
305
- })}
306
- </g>
307
- ))}
308
- </>
309
- )}
310
- <g transform={'translate(' + x + ', ' + y + ')'}>
311
- {label &&
312
- gridLine &&
313
- ticks.map((tick: string, index: number) => {
314
- const coordinate = scaler(tick);
315
- if (isNaN(coordinate)) return null;
316
- const _tickSize = tickLine.tickSize || tickSize;
317
- return (
318
- <g key={index}>
319
- {label && (
320
- <Label
321
- className='__easyv-label'
322
- orientation={orientation}
323
- coordinate={coordinate}
324
- config={label}
325
- label={tick}
326
- tickSize={_tickSize}
327
- formatter={formatter}
328
- rotate={rotate}
329
- onClick={triggerClick}
330
- />
331
- )}
332
- {gridLine && (
333
- <Line
334
- className='__easyv-gridLine'
335
- config={gridLine}
336
- {...getGridCoord({
337
- orientation,
338
- coordinate,
339
- end:
340
- orientation == 'left' || orientation == 'right'
341
- ? width
342
- : height,
343
- })}
344
- />
345
- )}
346
- </g>
347
- );
348
- })}
349
- {unit && <Unit config={unit} />}
350
- </g>
351
- </>
352
- );
353
- }
354
- );
1
+ /**
2
+ * x, y, z轴
3
+ */
4
+ import React, {
5
+ ComponentType,
6
+ memo,
7
+ ReactComponentElement,
8
+ useContext,
9
+ CSSProperties,
10
+ MouseEventHandler,
11
+ } from 'react';
12
+ import { getTickCoord, getGridCoord } from '../utils';
13
+ import { chartContext } from '../context';
14
+ import { Line } from '../element';
15
+ const defaultEvent = () => {};
16
+ const defaultAlign: Align = {
17
+ textAnchor: 'middle',
18
+ dominantBaseline: 'middle',
19
+ };
20
+ const defaultOrientation = 'bottom';
21
+ const defaultTickSize = 6;
22
+ const defaultFormatter: (
23
+ d: string,
24
+ { suffix }: { suffix: string }
25
+ ) => string = (d, { suffix }) => d + suffix;
26
+
27
+ const getAxesPath: (
28
+ orientation: Orientation,
29
+ { width, height }: Context
30
+ ) => string = (orientation, { width, height }) => {
31
+ switch (orientation) {
32
+ case 'top':
33
+ case 'bottom':
34
+ return 'M-0.5, 0H' + width;
35
+ case 'left':
36
+ case 'right':
37
+ return 'M0, -0.5V' + (height + 0.5);
38
+ }
39
+ };
40
+ /**
41
+ * 根据坐标轴位置来确定轴标签的垂直对齐方式,水平对齐方式,以及轴标签位于坐标轴的哪个方向
42
+ * @param orientation 坐标轴位置
43
+ * @param rotate 旋转角度
44
+ * @returns {
45
+ * dominantBaseline,
46
+ * textAnchor,
47
+ * directionX,
48
+ * directionY
49
+ * }
50
+ */
51
+ const getLayout: (
52
+ orientation: Orientation,
53
+ rotate: number
54
+ ) => {
55
+ dominantBaseline: string;
56
+ textAnchor: string;
57
+ directionX: number;
58
+ directionY: number;
59
+ } = (orientation, rotate) => {
60
+ switch (orientation) {
61
+ case 'top':
62
+ return {
63
+ dominantBaseline: 'text-after-edge',
64
+ textAnchor: rotate ? 'end' : 'middle',
65
+ directionX: 1,
66
+ directionY: -1,
67
+ };
68
+ case 'bottom':
69
+ return {
70
+ dominantBaseline: 'text-before-edge',
71
+ textAnchor: rotate ? 'start' : 'middle',
72
+ directionX: 1,
73
+ directionY: 1,
74
+ };
75
+ case 'left':
76
+ return {
77
+ dominantBaseline: 'middle',
78
+ textAnchor: 'end',
79
+ directionX: -1,
80
+ directionY: 1,
81
+ };
82
+ case 'right':
83
+ return {
84
+ dominantBaseline: 'middle',
85
+ textAnchor: 'start',
86
+ directionX: 1,
87
+ directionY: 1,
88
+ };
89
+ }
90
+ };
91
+ const AxisLine: ({
92
+ orientation: Orientation,
93
+ config: ChartLine,
94
+ }: any) => ReactComponentElement<ComponentType> | null = ({
95
+ orientation = defaultOrientation,
96
+ config: { show, color, lineWidth },
97
+ }) => {
98
+ if (!show) return null;
99
+ const context: Context = useContext(chartContext);
100
+ return (
101
+ <path
102
+ d={getAxesPath(orientation, context)}
103
+ stroke={color}
104
+ strokeWidth={lineWidth}
105
+ />
106
+ );
107
+ };
108
+
109
+ const Unit: ({
110
+ config: {
111
+ show: boolean,
112
+ text: string,
113
+ font: Font,
114
+ translate: Translate,
115
+ align: Align,
116
+ },
117
+ }: any) => ReactComponentElement<ComponentType> | null = ({
118
+ config: {
119
+ show,
120
+ text,
121
+ font: { bold, color, fontFamily, fontSize, italic, letterSpacing },
122
+ translate: { x: translateX, y: translateY },
123
+ align: { textAnchor } = defaultAlign,
124
+ },
125
+ }) => {
126
+ if (!show) return null;
127
+ return (
128
+ <text
129
+ className='__easyv-unit'
130
+ transform={'translate(' + translateX + ', ' + translateY + ')'}
131
+ fontFamily={fontFamily}
132
+ fontSize={fontSize}
133
+ fill={color}
134
+ fontWeight={bold ? 'bold' : 'normal'}
135
+ fontStyle={italic ? 'italic' : 'normal'}
136
+ letterSpacing={letterSpacing}
137
+ textAnchor={textAnchor}
138
+ >
139
+ {text}
140
+ </text>
141
+ );
142
+ };
143
+
144
+ type LabelType = {
145
+ className: string;
146
+ orientation: Orientation;
147
+ label: string;
148
+ coordinate: number;
149
+ formatter: Function;
150
+ tickSize: number;
151
+ rotate: number;
152
+ onClick?: MouseEventHandler;
153
+ config: {
154
+ show: boolean;
155
+ translate: Translate;
156
+ font: Font;
157
+ style: CSSProperties | Function;
158
+ };
159
+ };
160
+
161
+ const Label: (
162
+ props: LabelType
163
+ ) => ReactComponentElement<ComponentType> | null = ({
164
+ className,
165
+ orientation = defaultOrientation,
166
+ label,
167
+ coordinate,
168
+ formatter = defaultFormatter,
169
+ tickSize,
170
+ rotate = 0,
171
+ config,
172
+ onClick = defaultEvent,
173
+ config: {
174
+ show,
175
+ style,
176
+ translate: { x: translateX, y: translateY },
177
+ font: { fontFamily, fontSize, color, bold, italic, letterSpacing },
178
+ },
179
+ }) => {
180
+ if (!show) return null;
181
+ const _label = formatter(label, config);
182
+ const { dominantBaseline, textAnchor, directionX, directionY } = getLayout(
183
+ orientation,
184
+ rotate
185
+ );
186
+ const isVertical = orientation == 'left' || orientation == 'right';
187
+
188
+ const x =
189
+ (isVertical ? tickSize * directionX : coordinate) + translateX * directionX;
190
+ const y =
191
+ (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
192
+
193
+ const translateText = 'translate(' + x + ', ' + y + ')';
194
+
195
+ const _style = style && (typeof style == 'object' ? style : style(_label));
196
+
197
+ return (
198
+ <text
199
+ className={className}
200
+ style={{
201
+ ..._style,
202
+ whiteSpace: 'pre',
203
+ }}
204
+ onClick={onClick}
205
+ data-data={JSON.stringify({ x: label })}
206
+ dominantBaseline={dominantBaseline}
207
+ textAnchor={textAnchor}
208
+ fontFamily={fontFamily}
209
+ fontSize={fontSize}
210
+ fill={color}
211
+ fontWeight={bold ? 'bold' : 'normal'}
212
+ fontStyle={italic ? 'italic' : 'normal'}
213
+ letterSpacing={letterSpacing}
214
+ dx='0'
215
+ dy='0'
216
+ transform={
217
+ Array.isArray(_label)
218
+ ? rotate !== 0
219
+ ? isVertical
220
+ ? translateText + 'rotate(' + rotate + ')'
221
+ : 'rotate(' + rotate + ', ' + x + ', ' + y + ')'
222
+ : isVertical
223
+ ? translateText
224
+ : 'translate(' + translateX + ', ' + translateY + ')'
225
+ : translateText + 'rotate(' + rotate + ')'
226
+ }
227
+ >
228
+ {!!Array.isArray(_label)
229
+ ? _label.map((item, index) => (
230
+ <tspan key={index} x={x} dy='1em'>
231
+ {item}
232
+ </tspan>
233
+ ))
234
+ : _label}
235
+ </text>
236
+ );
237
+ };
238
+
239
+ export default memo(
240
+ ({
241
+ orientation,
242
+ scaler,
243
+ tickSize = defaultTickSize,
244
+ ticks,
245
+ formatter,
246
+ rotate,
247
+ triggerClick,
248
+ config: { on, label, axisLine, tickLine, gridLine, unit },
249
+ positions,
250
+ }: any) => {
251
+ if (!(on && ticks.length > 0)) return null;
252
+ const { width, height } = useContext(chartContext);
253
+ const x = orientation == 'right' ? width : 0;
254
+ const y = orientation == 'bottom' ? height : 0;
255
+
256
+ return (
257
+ <>
258
+ {axisLine && tickLine && (
259
+ <>
260
+ {axisLine &&
261
+ (positions && positions.length ? (
262
+ positions.map(({ x, y }: any, index: number) => (
263
+ <g key={index} transform={'translate(' + x + ', ' + y + ')'}>
264
+ <AxisLine orientation={orientation} config={axisLine} />
265
+ {tickLine &&
266
+ ticks.map((tick: string, index: number) => {
267
+ const coordinate = scaler(tick);
268
+ if (isNaN(coordinate)) return null;
269
+ const _tickSize = tickLine.tickSize || tickSize;
270
+ return (
271
+ <Line
272
+ className='__easyv-tickLine'
273
+ key={index}
274
+ config={tickLine}
275
+ {...getTickCoord({
276
+ orientation,
277
+ coordinate,
278
+ tickSize: _tickSize,
279
+ })}
280
+ />
281
+ );
282
+ })}
283
+ </g>
284
+ ))
285
+ ) : (
286
+ <g transform={'translate(' + x + ', ' + y + ')'}>
287
+ <AxisLine orientation={orientation} config={axisLine} />
288
+ {tickLine &&
289
+ ticks.map((tick: string, index: number) => {
290
+ const coordinate = scaler(tick);
291
+ if (isNaN(coordinate)) return null;
292
+ const _tickSize = tickLine.tickSize || tickSize;
293
+ return (
294
+ <Line
295
+ className='__easyv-tickLine'
296
+ key={index}
297
+ config={tickLine}
298
+ {...getTickCoord({
299
+ orientation,
300
+ coordinate,
301
+ tickSize: _tickSize,
302
+ })}
303
+ />
304
+ );
305
+ })}
306
+ </g>
307
+ ))}
308
+ </>
309
+ )}
310
+ <g transform={'translate(' + x + ', ' + y + ')'}>
311
+ {label &&
312
+ gridLine &&
313
+ ticks.map((tick: string, index: number) => {
314
+ const coordinate = scaler(tick);
315
+ if (isNaN(coordinate)) return null;
316
+ const _tickSize = tickLine.tickSize || tickSize;
317
+ return (
318
+ <g key={index}>
319
+ {label && (
320
+ <Label
321
+ className='__easyv-label'
322
+ orientation={orientation}
323
+ coordinate={coordinate}
324
+ config={label}
325
+ label={tick}
326
+ tickSize={_tickSize}
327
+ formatter={formatter}
328
+ rotate={rotate}
329
+ onClick={triggerClick}
330
+ />
331
+ )}
332
+ {gridLine && (
333
+ <Line
334
+ className='__easyv-gridLine'
335
+ config={gridLine}
336
+ {...getGridCoord({
337
+ orientation,
338
+ coordinate,
339
+ end:
340
+ orientation == 'left' || orientation == 'right'
341
+ ? width
342
+ : height,
343
+ })}
344
+ />
345
+ )}
346
+ </g>
347
+ );
348
+ })}
349
+ {unit && <Unit config={unit} />}
350
+ </g>
351
+ </>
352
+ );
353
+ }
354
+ );