@easyv/charts 1.10.11 → 1.10.12
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.
package/lib/components/Axis.js
CHANGED
|
@@ -281,6 +281,7 @@ var Label = function Label(_ref5) {
|
|
|
281
281
|
position: "relative",
|
|
282
282
|
// 替换 absolute
|
|
283
283
|
cursor: "pointer",
|
|
284
|
+
display: !adaptive ? "inline-block" : "block",
|
|
284
285
|
transform: "translate(".concat(x + (isIOS ? iosX : 0), "px, ").concat(y + (isIOS ? iosY : 0), "px)") // 用 transform 定位
|
|
285
286
|
})
|
|
286
287
|
}, !adaptive ? /*#__PURE__*/_react["default"].createElement(_TextOverflow["default"], {
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -32,7 +32,7 @@ const getCanvasContext = (): CanvasRenderingContext2D => {
|
|
|
32
32
|
export const calculateTextWidth = (
|
|
33
33
|
text: string,
|
|
34
34
|
fontConfig: any,
|
|
35
|
-
isVertical: any
|
|
35
|
+
isVertical: any,
|
|
36
36
|
): number => {
|
|
37
37
|
if (!text) return 0;
|
|
38
38
|
const ctx = getCanvasContext();
|
|
@@ -82,14 +82,14 @@ const defaultOrientation = "bottom";
|
|
|
82
82
|
const defaultTickSize = 6;
|
|
83
83
|
const defaultFormatter: (
|
|
84
84
|
d: string,
|
|
85
|
-
{ suffix }: { suffix: string }
|
|
85
|
+
{ suffix }: { suffix: string },
|
|
86
86
|
) => string = (d, { suffix }) => d + suffix;
|
|
87
87
|
|
|
88
88
|
const getAxesPath: (
|
|
89
89
|
orientation: Orientation,
|
|
90
90
|
{ width, height }: Context,
|
|
91
91
|
cHeight: number,
|
|
92
|
-
cPercent: number
|
|
92
|
+
cPercent: number,
|
|
93
93
|
) => string = (orientation, { width, height }, cHeight, cPercent) => {
|
|
94
94
|
switch (orientation) {
|
|
95
95
|
case "top":
|
|
@@ -112,7 +112,7 @@ const getAxesPath: (
|
|
|
112
112
|
*/
|
|
113
113
|
const getLayout: (
|
|
114
114
|
orientation: Orientation,
|
|
115
|
-
rotate: number
|
|
115
|
+
rotate: number,
|
|
116
116
|
) => {
|
|
117
117
|
transform: string;
|
|
118
118
|
directionX: number;
|
|
@@ -253,7 +253,7 @@ function maxLabelFT(
|
|
|
253
253
|
config: any,
|
|
254
254
|
formatter: any,
|
|
255
255
|
font: any,
|
|
256
|
-
isVertical: any
|
|
256
|
+
isVertical: any,
|
|
257
257
|
) {
|
|
258
258
|
let max = 0;
|
|
259
259
|
data.length
|
|
@@ -265,7 +265,7 @@ function maxLabelFT(
|
|
|
265
265
|
format: { type: config.format, showType: config.showType },
|
|
266
266
|
}),
|
|
267
267
|
font,
|
|
268
|
-
isVertical
|
|
268
|
+
isVertical,
|
|
269
269
|
) > max
|
|
270
270
|
)
|
|
271
271
|
max = calculateTextWidth(
|
|
@@ -274,14 +274,14 @@ function maxLabelFT(
|
|
|
274
274
|
format: { type: config.format, showType: config.showType },
|
|
275
275
|
}),
|
|
276
276
|
font,
|
|
277
|
-
isVertical
|
|
277
|
+
isVertical,
|
|
278
278
|
);
|
|
279
279
|
})
|
|
280
280
|
: "";
|
|
281
281
|
return max;
|
|
282
282
|
}
|
|
283
283
|
const Label: (
|
|
284
|
-
props: LabelType
|
|
284
|
+
props: LabelType,
|
|
285
285
|
) => ReactComponentElement<ComponentType> | null = ({
|
|
286
286
|
className,
|
|
287
287
|
orientation = defaultOrientation,
|
|
@@ -311,7 +311,7 @@ const Label: (
|
|
|
311
311
|
});
|
|
312
312
|
const { transform, directionX, directionY } = getLayout(
|
|
313
313
|
orientation,
|
|
314
|
-
adaptive ? 0 : rotate
|
|
314
|
+
adaptive ? 0 : rotate,
|
|
315
315
|
);
|
|
316
316
|
const isVertical = orientation == "left" || orientation == "right";
|
|
317
317
|
|
|
@@ -339,6 +339,7 @@ const Label: (
|
|
|
339
339
|
...getFontStyle(font),
|
|
340
340
|
position: "relative", // 替换 absolute
|
|
341
341
|
cursor: "pointer",
|
|
342
|
+
display: !adaptive ? "inline-block" : "block",
|
|
342
343
|
transform: `translate(${x + (isIOS ? iosX : 0)}px, ${
|
|
343
344
|
y + (isIOS ? iosY : 0)
|
|
344
345
|
}px)`, // 用 transform 定位
|
|
@@ -358,8 +359,8 @@ const Label: (
|
|
|
358
359
|
textAlign == "left"
|
|
359
360
|
? "flex-start"
|
|
360
361
|
: textAlign == "right"
|
|
361
|
-
|
|
362
|
-
|
|
362
|
+
? "flex-end"
|
|
363
|
+
: "center",
|
|
363
364
|
}}
|
|
364
365
|
></TextOverflow>
|
|
365
366
|
) : (
|
|
@@ -409,7 +410,7 @@ export default memo(
|
|
|
409
410
|
rawTicks,
|
|
410
411
|
paddingOuter,
|
|
411
412
|
}: any,
|
|
412
|
-
ref
|
|
413
|
+
ref,
|
|
413
414
|
) => {
|
|
414
415
|
const { width, height, isIOS } = useContext(chartContext);
|
|
415
416
|
const { cHeight, isC, cPercent } = controlInfo;
|
|
@@ -426,13 +427,13 @@ export default memo(
|
|
|
426
427
|
label,
|
|
427
428
|
formatter,
|
|
428
429
|
label.font,
|
|
429
|
-
isVertical
|
|
430
|
+
isVertical,
|
|
430
431
|
);
|
|
431
432
|
}
|
|
432
433
|
}
|
|
433
434
|
const LabelNum = !isVertical
|
|
434
435
|
? Math.floor(
|
|
435
|
-
((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth
|
|
436
|
+
((width / (isC ? cPercent : 1)) * (1 - paddingOuter)) / LabelWidth,
|
|
436
437
|
)
|
|
437
438
|
: Math.floor(height / LabelWidth);
|
|
438
439
|
|
|
@@ -445,7 +446,7 @@ export default memo(
|
|
|
445
446
|
? Math.ceil(allTicks.length / 2)
|
|
446
447
|
: LabelNum
|
|
447
448
|
: allTicks.length,
|
|
448
|
-
label.showLast
|
|
449
|
+
label.showLast,
|
|
449
450
|
);
|
|
450
451
|
if (!(on && ticks.length > 0)) return null;
|
|
451
452
|
|
|
@@ -453,7 +454,7 @@ export default memo(
|
|
|
453
454
|
function getEvenlySpacedElements(
|
|
454
455
|
arr: any[],
|
|
455
456
|
expectCount: number,
|
|
456
|
-
acc: boolean = false
|
|
457
|
+
acc: boolean = false,
|
|
457
458
|
): any[] {
|
|
458
459
|
if (!arr.length || expectCount <= 0) return [];
|
|
459
460
|
if (expectCount >= arr.length) return [...arr];
|
|
@@ -732,6 +733,6 @@ export default memo(
|
|
|
732
733
|
</svg>
|
|
733
734
|
</g>
|
|
734
735
|
);
|
|
735
|
-
}
|
|
736
|
-
)
|
|
736
|
+
},
|
|
737
|
+
),
|
|
737
738
|
);
|