@easyv/charts 1.0.66 → 1.0.67
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/Line.js +2 -0
- package/package.json +1 -1
- package/src/components/Line.js +10 -8
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/package.json
CHANGED
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
|
|