@easyv/charts 1.9.11 → 1.9.13
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
|
@@ -195,8 +195,8 @@ var Label = function Label(_ref5) {
|
|
|
195
195
|
var y = (isVertical ? coordinate : tickSize * directionY) + translateY * directionY;
|
|
196
196
|
var _style = style && ((0, _typeof2["default"])(style) == "object" ? style : style(_label));
|
|
197
197
|
return /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
198
|
-
width: "
|
|
199
|
-
height: "
|
|
198
|
+
width: "100%",
|
|
199
|
+
height: "100%"
|
|
200
200
|
// x={x}
|
|
201
201
|
// y={y}
|
|
202
202
|
,
|
|
@@ -212,11 +212,10 @@ var Label = function Label(_ref5) {
|
|
|
212
212
|
x: label
|
|
213
213
|
}),
|
|
214
214
|
style: _objectSpread(_objectSpread(_objectSpread({}, _style), (0, _utils.getFontStyle)(font)), {}, {
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
position: "relative",
|
|
216
|
+
// 替换 absolute
|
|
217
217
|
cursor: "pointer",
|
|
218
|
-
|
|
219
|
-
top: y + (isIOS ? iosY : 0)
|
|
218
|
+
transform: "translate(".concat(x + (isIOS ? iosX : 0), "px, ").concat(y + (isIOS ? iosY : 0), "px)") // 用 transform 定位
|
|
220
219
|
})
|
|
221
220
|
}, /*#__PURE__*/_react["default"].createElement(_TextOverflow["default"], {
|
|
222
221
|
ShowType: "normal",
|
package/lib/components/Band.js
CHANGED
|
@@ -52,11 +52,12 @@ var getAttr = function getAttr(_ref) {
|
|
|
52
52
|
seriesWidth = _ref.seriesWidth,
|
|
53
53
|
length = _ref.length,
|
|
54
54
|
x = _ref.x,
|
|
55
|
-
y = _ref.y
|
|
55
|
+
y = _ref.y,
|
|
56
|
+
maxWidth = _ref.maxWidth;
|
|
56
57
|
var len = length ? length : 0.1; //柱子长度
|
|
57
58
|
if (isVertical) {
|
|
58
59
|
return {
|
|
59
|
-
width: Math.max(0, len),
|
|
60
|
+
width: Math.min(Math.max(0, len), maxWidth),
|
|
60
61
|
height: Math.max(0, seriesWidth),
|
|
61
62
|
x: y,
|
|
62
63
|
y: x,
|
|
@@ -69,9 +70,9 @@ var getAttr = function getAttr(_ref) {
|
|
|
69
70
|
};
|
|
70
71
|
} else {
|
|
71
72
|
return {
|
|
72
|
-
x: x,
|
|
73
|
+
x: seriesWidth > maxWidth ? x + (seriesWidth - maxWidth) / 2 : x,
|
|
73
74
|
y: y,
|
|
74
|
-
width: seriesWidth,
|
|
75
|
+
width: Math.min(seriesWidth, maxWidth),
|
|
75
76
|
height: len,
|
|
76
77
|
bgAttr: {
|
|
77
78
|
x: x,
|
|
@@ -95,6 +96,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
95
96
|
isControlChart = _ref3$isControlChart === void 0 ? false : _ref3$isControlChart,
|
|
96
97
|
setCtlTip = _ref3.setCtlTip,
|
|
97
98
|
isXRepeat = _ref3.isXRepeat,
|
|
99
|
+
maxWidth = _ref3.maxWidth,
|
|
98
100
|
_ref3$config = _ref3.config,
|
|
99
101
|
_ref3$config$pattern = _ref3$config.pattern,
|
|
100
102
|
pattern = _ref3$config$pattern === void 0 ? {} : _ref3$config$pattern,
|
|
@@ -237,7 +239,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
237
239
|
x: positionX,
|
|
238
240
|
y: positionY,
|
|
239
241
|
length: Math.abs(y1 - y2),
|
|
240
|
-
seriesWidth: seriesWidth
|
|
242
|
+
seriesWidth: seriesWidth,
|
|
243
|
+
maxWidth: maxWidth
|
|
241
244
|
}),
|
|
242
245
|
bgAttr = _getAttr.bgAttr,
|
|
243
246
|
attr = (0, _objectWithoutProperties2["default"])(_getAttr, _excluded3);
|
|
@@ -42,6 +42,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
42
42
|
animation = _ref$config$chart.animation,
|
|
43
43
|
legend = _ref$config$chart.legend,
|
|
44
44
|
selectStyle = _ref$config$chart.selectStyle,
|
|
45
|
+
maxWidth = _ref$config$chart.bar.maxWidth,
|
|
45
46
|
series = _ref$config.series,
|
|
46
47
|
bandLength = _ref$config.bandLength,
|
|
47
48
|
tooltip = _ref$config.tooltip,
|
|
@@ -625,7 +626,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
625
626
|
indicatorWidth: indicatorWidth,
|
|
626
627
|
triggerEvents: onInteraction,
|
|
627
628
|
setCtlTip: setCtlTip,
|
|
628
|
-
isXRepeat: isXRepeat
|
|
629
|
+
isXRepeat: isXRepeat,
|
|
630
|
+
maxWidth: maxWidth
|
|
629
631
|
}));
|
|
630
632
|
}), series.map(function (_ref3, index) {
|
|
631
633
|
var Component = _ref3.Component,
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -229,8 +229,8 @@ const Label: (
|
|
|
229
229
|
|
|
230
230
|
return (
|
|
231
231
|
<foreignObject
|
|
232
|
-
width="
|
|
233
|
-
height="
|
|
232
|
+
width="100%"
|
|
233
|
+
height="100%"
|
|
234
234
|
// x={x}
|
|
235
235
|
// y={y}
|
|
236
236
|
style={{ overflow: "visible" }}
|
|
@@ -242,11 +242,11 @@ const Label: (
|
|
|
242
242
|
style={{
|
|
243
243
|
..._style,
|
|
244
244
|
...getFontStyle(font),
|
|
245
|
-
|
|
246
|
-
position: "absolute",
|
|
245
|
+
position: "relative", // 替换 absolute
|
|
247
246
|
cursor: "pointer",
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
transform: `translate(${x + (isIOS ? iosX : 0)}px, ${
|
|
248
|
+
y + (isIOS ? iosY : 0)
|
|
249
|
+
}px)`, // 用 transform 定位
|
|
250
250
|
}}
|
|
251
251
|
>
|
|
252
252
|
<TextOverflow
|
package/src/components/Band.tsx
CHANGED
|
@@ -30,17 +30,19 @@ const getAttr = ({
|
|
|
30
30
|
length,
|
|
31
31
|
x,
|
|
32
32
|
y,
|
|
33
|
+
maxWidth,
|
|
33
34
|
}: {
|
|
34
35
|
isVertical: boolean;
|
|
35
36
|
seriesWidth: number;
|
|
36
37
|
length: number;
|
|
37
38
|
x: number;
|
|
38
39
|
y: number;
|
|
40
|
+
maxWidth: number;
|
|
39
41
|
}) => {
|
|
40
42
|
const len = length ? length : 0.1; //柱子长度
|
|
41
43
|
if (isVertical) {
|
|
42
44
|
return {
|
|
43
|
-
width: Math.max(0, len),
|
|
45
|
+
width: Math.min(Math.max(0, len), maxWidth),
|
|
44
46
|
height: Math.max(0, seriesWidth),
|
|
45
47
|
x: y,
|
|
46
48
|
y: x,
|
|
@@ -53,9 +55,9 @@ const getAttr = ({
|
|
|
53
55
|
};
|
|
54
56
|
} else {
|
|
55
57
|
return {
|
|
56
|
-
x,
|
|
58
|
+
x: seriesWidth > maxWidth ? x + (seriesWidth - maxWidth) / 2 : x,
|
|
57
59
|
y,
|
|
58
|
-
width: seriesWidth,
|
|
60
|
+
width: Math.min(seriesWidth, maxWidth),
|
|
59
61
|
height: len,
|
|
60
62
|
bgAttr: {
|
|
61
63
|
x,
|
|
@@ -93,6 +95,7 @@ export default memo(
|
|
|
93
95
|
isControlChart = false,
|
|
94
96
|
setCtlTip,
|
|
95
97
|
isXRepeat,
|
|
98
|
+
maxWidth,
|
|
96
99
|
config: {
|
|
97
100
|
pattern = {},
|
|
98
101
|
seriesIntervalWidth: paddingInner = 0,
|
|
@@ -229,6 +232,7 @@ export default memo(
|
|
|
229
232
|
y: positionY,
|
|
230
233
|
length: Math.abs(y1 - y2),
|
|
231
234
|
seriesWidth,
|
|
235
|
+
maxWidth,
|
|
232
236
|
});
|
|
233
237
|
return (
|
|
234
238
|
<Fragment key={i}>
|
|
@@ -44,6 +44,7 @@ const Chart = memo(
|
|
|
44
44
|
animation,
|
|
45
45
|
legend,
|
|
46
46
|
selectStyle,
|
|
47
|
+
bar: { maxWidth },
|
|
47
48
|
},
|
|
48
49
|
series,
|
|
49
50
|
bandLength,
|
|
@@ -638,6 +639,7 @@ const Chart = memo(
|
|
|
638
639
|
triggerEvents={onInteraction}
|
|
639
640
|
setCtlTip={setCtlTip}
|
|
640
641
|
isXRepeat={isXRepeat}
|
|
642
|
+
maxWidth={maxWidth}
|
|
641
643
|
/>
|
|
642
644
|
)
|
|
643
645
|
);
|