@easyv/charts 1.0.64 → 1.0.68
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 +1 -1
- package/lib/components/Line.js +2 -0
- package/lib/css/index.module.css +1 -1
- package/lib/formatter/legend.js +7 -2
- package/package.json +1 -1
- package/src/components/Axis.tsx +2 -2
- package/src/components/Line.js +10 -8
- package/src/css/index.module.css +1 -1
- package/src/formatter/legend.js +3 -0
package/lib/components/Axis.js
CHANGED
|
@@ -194,7 +194,7 @@ var Label = function Label(_ref5) {
|
|
|
194
194
|
letterSpacing: letterSpacing,
|
|
195
195
|
dx: "0",
|
|
196
196
|
dy: "0",
|
|
197
|
-
transform: Array.isArray(_label) ? rotate !== 0 ? isVertical ? translateText + 'rotate(' + rotate + ')' : 'rotate(' + rotate + ', ' + x + ', ' + y + ')' : isVertical ? translateText :
|
|
197
|
+
transform: Array.isArray(_label) ? rotate !== 0 ? isVertical ? translateText + 'rotate(' + rotate + ')' : 'rotate(' + rotate + ', ' + x + ', ' + y + ')' : isVertical ? translateText : 'translate(' + translateX + ', ' + translateY + ')' : translateText + 'rotate(' + rotate + ')'
|
|
198
198
|
}, !!Array.isArray(_label) ? _label.map(function (item, index) {
|
|
199
199
|
return /*#__PURE__*/_react["default"].createElement("tspan", {
|
|
200
200
|
key: index,
|
package/lib/components/Line.js
CHANGED
|
@@ -69,6 +69,7 @@ var Area = function Area(_ref2) {
|
|
|
69
69
|
return yScaler(y);
|
|
70
70
|
}).y0(height).defined(defined);
|
|
71
71
|
curve && areaGen.curve(_d3v.curveCatmullRom.alpha(tension));
|
|
72
|
+
curve && areaGen.curve(_d3v.curveMonotoneX);
|
|
72
73
|
return areaGen;
|
|
73
74
|
}, [xScaler, yScaler, curve, tension]);
|
|
74
75
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
@@ -134,6 +135,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
134
135
|
return yScaler(y);
|
|
135
136
|
})).defined(defined);
|
|
136
137
|
curve && lineGen.curve(_d3v.curveCatmullRom.alpha(tension));
|
|
138
|
+
curve && lineGen.curve(_d3v.curveMonotoneX);
|
|
137
139
|
return lineGen;
|
|
138
140
|
}, [direction, xScaler, yScaler, tension, curve]);
|
|
139
141
|
var path = lineGen(_data);
|
package/lib/css/index.module.css
CHANGED
package/lib/formatter/legend.js
CHANGED
|
@@ -64,7 +64,9 @@ var pieLegendFormatter = function pieLegendFormatter(_ref, _ref2) {
|
|
|
64
64
|
whiteSpace: "nowrap"
|
|
65
65
|
})
|
|
66
66
|
}, displayName), showValue && /*#__PURE__*/React.createElement("span", {
|
|
67
|
-
style: _objectSpread(_objectSpread({
|
|
67
|
+
style: _objectSpread(_objectSpread({
|
|
68
|
+
whiteSpace: "nowrap"
|
|
69
|
+
}, (0, _utils.getFontStyle)(valueFont)), {}, {
|
|
68
70
|
marginLeft: valueGap,
|
|
69
71
|
display: 'flex',
|
|
70
72
|
color: valueSameColor ? _color : valueFont.color,
|
|
@@ -73,11 +75,14 @@ var pieLegendFormatter = function pieLegendFormatter(_ref, _ref2) {
|
|
|
73
75
|
})
|
|
74
76
|
}, showValue && /*#__PURE__*/React.createElement("span", null, data.y), showSuffix && /*#__PURE__*/React.createElement("span", {
|
|
75
77
|
style: {
|
|
78
|
+
whiteSpace: "nowrap",
|
|
76
79
|
fontSize: fontSize,
|
|
77
80
|
transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)'
|
|
78
81
|
}
|
|
79
82
|
}, text)), showPercent && /*#__PURE__*/React.createElement("span", {
|
|
80
|
-
style: _objectSpread(_objectSpread({
|
|
83
|
+
style: _objectSpread(_objectSpread({
|
|
84
|
+
whiteSpace: "nowrap"
|
|
85
|
+
}, (0, _utils.getFontStyle)(percentFont)), {}, {
|
|
81
86
|
marginLeft: percentGap,
|
|
82
87
|
color: percentSameColor ? _color : percentFont.color
|
|
83
88
|
})
|
package/package.json
CHANGED
package/src/components/Axis.tsx
CHANGED
|
@@ -180,7 +180,7 @@ const Label: (props: LabelType) => ReactComponentElement<ComponentType> | null =
|
|
|
180
180
|
translateY * directionY;
|
|
181
181
|
|
|
182
182
|
const translateText = 'translate(' + x + ', ' + y + ')';
|
|
183
|
-
|
|
183
|
+
|
|
184
184
|
return (
|
|
185
185
|
<text
|
|
186
186
|
className={className}
|
|
@@ -202,7 +202,7 @@ const Label: (props: LabelType) => ReactComponentElement<ComponentType> | null =
|
|
|
202
202
|
: 'rotate(' + rotate + ', ' + x + ', ' + y + ')'
|
|
203
203
|
: isVertical
|
|
204
204
|
? translateText
|
|
205
|
-
:
|
|
205
|
+
: 'translate(' + translateX + ', ' + translateY + ')'
|
|
206
206
|
: translateText + 'rotate(' + rotate + ')'
|
|
207
207
|
}
|
|
208
208
|
>
|
package/src/components/Line.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 折线图
|
|
3
3
|
*/
|
|
4
4
|
import React, { memo, useMemo } from 'react';
|
|
5
|
-
import { line as d3Line, area as d3Area, curveCatmullRom } from 'd3v7';
|
|
5
|
+
import { line as d3Line, area as d3Area, curveCatmullRom, curveMonotoneX } from 'd3v7';
|
|
6
6
|
import { getColorList } from '../utils';
|
|
7
7
|
import { Lighter, LinearGradient } from '.';
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ const defined = (d) => d.data.y != null;
|
|
|
10
10
|
const getLineData = (data, connectNulls) =>
|
|
11
11
|
connectNulls
|
|
12
12
|
? data.map(({ data, ...item }) => ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
...item,
|
|
14
|
+
data: { ...data, y: +data.y },
|
|
15
|
+
}))
|
|
16
16
|
: data;
|
|
17
17
|
|
|
18
18
|
const Area = ({
|
|
@@ -31,6 +31,7 @@ const Area = ({
|
|
|
31
31
|
.y0(height)
|
|
32
32
|
.defined(defined);
|
|
33
33
|
curve && areaGen.curve(curveCatmullRom.alpha(tension));
|
|
34
|
+
curve && areaGen.curve(curveMonotoneX);
|
|
34
35
|
return areaGen;
|
|
35
36
|
}, [xScaler, yScaler, curve, tension]);
|
|
36
37
|
|
|
@@ -89,13 +90,14 @@ export default memo(
|
|
|
89
90
|
let lineGen = (
|
|
90
91
|
isVertical
|
|
91
92
|
? d3Line()
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
.y(({ data: { x } }) => xScaler(x))
|
|
94
|
+
.x(({ data: { y } }) => yScaler(y))
|
|
94
95
|
: d3Line()
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
.x(({ data: { x } }) => xScaler(x))
|
|
97
|
+
.y(({ data: { y } }) => yScaler(y))
|
|
97
98
|
).defined(defined);
|
|
98
99
|
curve && lineGen.curve(curveCatmullRom.alpha(tension));
|
|
100
|
+
curve && lineGen.curve(curveMonotoneX);
|
|
99
101
|
return lineGen;
|
|
100
102
|
}, [direction, xScaler, yScaler, tension, curve]);
|
|
101
103
|
|
package/src/css/index.module.css
CHANGED
package/src/formatter/legend.js
CHANGED
|
@@ -49,6 +49,7 @@ export const pieLegendFormatter = (
|
|
|
49
49
|
{showValue && (
|
|
50
50
|
<span
|
|
51
51
|
style={{
|
|
52
|
+
whiteSpace:"nowrap",
|
|
52
53
|
...getFontStyle(valueFont),
|
|
53
54
|
marginLeft: valueGap,
|
|
54
55
|
display: 'flex',
|
|
@@ -61,6 +62,7 @@ export const pieLegendFormatter = (
|
|
|
61
62
|
{showSuffix && (
|
|
62
63
|
<span
|
|
63
64
|
style={{
|
|
65
|
+
whiteSpace:"nowrap",
|
|
64
66
|
fontSize,
|
|
65
67
|
transform: 'translate3d(' + x + 'px, ' + y + 'px, 0px)',
|
|
66
68
|
}}
|
|
@@ -73,6 +75,7 @@ export const pieLegendFormatter = (
|
|
|
73
75
|
{showPercent && (
|
|
74
76
|
<span
|
|
75
77
|
style={{
|
|
78
|
+
whiteSpace:"nowrap",
|
|
76
79
|
...getFontStyle(percentFont),
|
|
77
80
|
marginLeft: percentGap,
|
|
78
81
|
color: percentSameColor ? _color : percentFont.color,
|