@easyv/charts 1.4.17 → 1.4.19
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/.husky/commit-msg +1 -1
- package/lib/components/BaseLine.js +14 -1
- package/lib/components/CartesianChart.js +2 -0
- package/lib/components/Label.js +11 -1
- package/package.json +1 -1
- package/src/components/Background.tsx +0 -1
- package/src/components/BaseLine.js +18 -7
- package/src/components/CartesianChart.js +2 -0
- package/src/components/Label.js +8 -2
package/.husky/commit-msg
CHANGED
|
@@ -46,10 +46,12 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
46
46
|
marginLeft = _ref$config$line$marg.marginLeft,
|
|
47
47
|
marginRight = _ref$config$line$marg.marginRight,
|
|
48
48
|
strokeDasharray = _ref$config$line.strokeDasharray,
|
|
49
|
+
yOrZ = _ref.yOrZ,
|
|
49
50
|
_ref$yAxis = _ref.yAxis,
|
|
50
51
|
yScaler = _ref$yAxis.scaler,
|
|
51
52
|
clipValue = _ref$yAxis.clipValue,
|
|
52
53
|
isClipAxis = _ref$yAxis.isClipAxis,
|
|
54
|
+
scaler = _ref.axisX.scaler,
|
|
53
55
|
data = _ref.data;
|
|
54
56
|
|
|
55
57
|
try {
|
|
@@ -62,7 +64,18 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
62
64
|
x1 = orientation == 'left' ? yScaler[1](data.value) : marginLeft, x2 = orientation == 'left' ? yScaler[1](data.value) : width - marginRight, y1 = orientation == 'left' ? marginLeft : yScaler[1](data.value), y2 = orientation == 'left' ? height - marginRight : yScaler[1](data.value);
|
|
63
65
|
}
|
|
64
66
|
} else {
|
|
65
|
-
|
|
67
|
+
if (yOrZ == "x") {
|
|
68
|
+
x1 = orientation == 'left' ? marginLeft : scaler(data.value), x2 = orientation == 'left' ? width - marginRight : scaler(data.value), y1 = orientation == 'left' ? scaler(data.value) : marginLeft, y2 = orientation == 'left' ? scaler(data.value) : height - marginRight;
|
|
69
|
+
} else {
|
|
70
|
+
x1 = orientation == 'left' ? yScaler(data.value) : marginLeft, x2 = orientation == 'left' ? yScaler(data.value) : width - marginRight, y1 = orientation == 'left' ? marginLeft : yScaler(data.value), y2 = orientation == 'left' ? height - marginRight : yScaler(data.value);
|
|
71
|
+
}
|
|
72
|
+
} //当坐标值存在undefined时,返回null
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if ([x1, x2, y1, y2].some(function (d) {
|
|
76
|
+
return d == undefined;
|
|
77
|
+
})) {
|
|
78
|
+
return null;
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("g", {
|
|
@@ -225,7 +225,9 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
225
225
|
key: index,
|
|
226
226
|
config: baseLineConfig[index],
|
|
227
227
|
baseLineOri: baseLineOri,
|
|
228
|
+
yOrZ: yOrZ,
|
|
228
229
|
yAxis: yAxis,
|
|
230
|
+
axisX: axisX,
|
|
229
231
|
data: item
|
|
230
232
|
});
|
|
231
233
|
})), /*#__PURE__*/_react["default"].createElement(_.Legend, (0, _extends2["default"])({}, legend, {
|
package/lib/components/Label.js
CHANGED
|
@@ -151,6 +151,12 @@ var Label = function Label(_ref3) {
|
|
|
151
151
|
translateX = _ref3$config$translat2 === void 0 ? 0 : _ref3$config$translat2,
|
|
152
152
|
_ref3$config$translat3 = _ref3$config$translat.y,
|
|
153
153
|
translateY = _ref3$config$translat3 === void 0 ? 0 : _ref3$config$translat3,
|
|
154
|
+
_ref3$config$suffix = _ref3$config.suffix,
|
|
155
|
+
content = _ref3$config$suffix.content,
|
|
156
|
+
suffixFont = _ref3$config$suffix.font,
|
|
157
|
+
_ref3$config$suffix$t = _ref3$config$suffix.translate,
|
|
158
|
+
suffixX = _ref3$config$suffix$t.x,
|
|
159
|
+
suffixY = _ref3$config$suffix$t.y,
|
|
154
160
|
_ref3$textAnchor = _ref3.textAnchor,
|
|
155
161
|
textAnchor = _ref3$textAnchor === void 0 ? "middle" : _ref3$textAnchor,
|
|
156
162
|
_ref3$dominantBaselin = _ref3.dominantBaseline,
|
|
@@ -164,7 +170,11 @@ var Label = function Label(_ref3) {
|
|
|
164
170
|
}),
|
|
165
171
|
textAnchor: textAnchor,
|
|
166
172
|
dominantBaseline: dominantBaseline
|
|
167
|
-
}, font), value)
|
|
173
|
+
}, font), /*#__PURE__*/React.createElement("tspan", null, value), /*#__PURE__*/React.createElement("tspan", {
|
|
174
|
+
dx: suffixX,
|
|
175
|
+
dy: suffixY,
|
|
176
|
+
style: _objectSpread({}, (0, _utils.getFontStyle)(suffixFont, "svg"))
|
|
177
|
+
}, content));
|
|
168
178
|
};
|
|
169
179
|
|
|
170
180
|
var Icon = function Icon(_ref4) {
|
package/package.json
CHANGED
|
@@ -34,11 +34,12 @@ export default memo(
|
|
|
34
34
|
strokeDasharray,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
yOrZ,
|
|
38
|
+
yAxis: { scaler: yScaler, clipValue, isClipAxis },
|
|
39
|
+
axisX: { scaler },
|
|
38
40
|
data
|
|
39
41
|
}) => {
|
|
40
42
|
try{
|
|
41
|
-
|
|
42
43
|
let x1,x2,y1,y2
|
|
43
44
|
if (isClipAxis) {
|
|
44
45
|
if (data.value > +clipValue) {
|
|
@@ -53,12 +54,22 @@ export default memo(
|
|
|
53
54
|
y2 = orientation == 'left' ? height - marginRight : yScaler[1](data.value);
|
|
54
55
|
}
|
|
55
56
|
} else {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if(yOrZ=="x"){
|
|
58
|
+
x1 = orientation == 'left' ? marginLeft:scaler(data.value),
|
|
59
|
+
x2 = orientation == 'left' ? width - marginRight:scaler(data.value),
|
|
60
|
+
y1 = orientation == 'left' ? scaler(data.value):marginLeft ,
|
|
61
|
+
y2 = orientation == 'left' ? scaler(data.value):height - marginRight;
|
|
62
|
+
}else{
|
|
63
|
+
x1 = orientation == 'left' ? yScaler(data.value) : marginLeft,
|
|
64
|
+
x2 = orientation == 'left' ? yScaler(data.value) : width - marginRight,
|
|
65
|
+
y1 = orientation == 'left' ? marginLeft : yScaler(data.value),
|
|
66
|
+
y2 = orientation == 'left' ? height - marginRight : yScaler(data.value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//当坐标值存在undefined时,返回null
|
|
70
|
+
if([x1,x2,y1,y2].some(d=>d==undefined)){
|
|
71
|
+
return null
|
|
60
72
|
}
|
|
61
|
-
|
|
62
73
|
return (
|
|
63
74
|
<>
|
|
64
75
|
<g className='__easyv-baseLine' >
|
package/src/components/Label.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 轴类图表标签
|
|
3
3
|
*/
|
|
4
4
|
import { memo, useContext } from "react";
|
|
5
|
-
import { getTranslate2d, getSeriesInfo } from "../utils";
|
|
5
|
+
import { getTranslate2d, getSeriesInfo, getFontStyle } from "../utils";
|
|
6
6
|
import { chartContext } from "../context";
|
|
7
7
|
|
|
8
8
|
export default memo(
|
|
@@ -120,6 +120,9 @@ const Label = ({
|
|
|
120
120
|
config: {
|
|
121
121
|
font,
|
|
122
122
|
translate: { x: translateX = 0, y: translateY = 0 },
|
|
123
|
+
suffix:{
|
|
124
|
+
content, font:suffixFont, translate:{ x:suffixX, y:suffixY }
|
|
125
|
+
}
|
|
123
126
|
},
|
|
124
127
|
textAnchor = "middle",
|
|
125
128
|
dominantBaseline = "middle",
|
|
@@ -136,7 +139,10 @@ const Label = ({
|
|
|
136
139
|
dominantBaseline={dominantBaseline}
|
|
137
140
|
{...font}
|
|
138
141
|
>
|
|
139
|
-
{value}
|
|
142
|
+
<tspan>{value}</tspan>
|
|
143
|
+
<tspan dx={suffixX} dy={suffixY} style={{
|
|
144
|
+
...getFontStyle(suffixFont,"svg")
|
|
145
|
+
}}>{content}</tspan>
|
|
140
146
|
</text>
|
|
141
147
|
);
|
|
142
148
|
};
|