@easyv/charts 1.0.70 → 1.0.71
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/.babelrc +8 -8
- package/lib/components/AnimateData.js +2 -2
- package/lib/components/Axis.js +12 -12
- package/lib/components/Background.js +2 -2
- package/lib/components/Carousel.js +2 -2
- package/lib/components/Chart.js +2 -2
- package/lib/components/ConicalGradient.js +21 -21
- package/lib/components/Indicator.js +2 -2
- package/lib/components/Label.js +13 -3
- package/lib/components/LinearGradient.js +2 -2
- package/lib/css/index.module.css +41 -41
- package/lib/css/piechart.module.css +26 -26
- package/lib/hooks/useAnimateData.js +5 -5
- package/lib/hooks/useAxes.js +5 -5
- package/lib/hooks/useCarouselAxisX.js +5 -5
- package/lib/hooks/useExtentData.js +6 -6
- package/lib/hooks/useFilterData.js +5 -5
- package/lib/hooks/useStackData.js +5 -5
- package/lib/hooks/useTooltip.js +10 -10
- package/package.json +34 -34
- package/src/components/AnimateData.tsx +24 -24
- package/src/components/Axis.tsx +333 -333
- package/src/components/Background.tsx +45 -45
- package/src/components/Band.tsx +160 -160
- package/src/components/Brush.js +159 -159
- package/src/components/Carousel.tsx +144 -144
- package/src/components/Chart.js +99 -99
- package/src/components/ChartContainer.tsx +63 -63
- package/src/components/ConicalGradient.js +258 -258
- package/src/components/ExtentData.js +17 -17
- package/src/components/FilterData.js +23 -23
- package/src/components/Indicator.js +13 -13
- package/src/components/Label.js +206 -196
- package/src/components/Legend.js +158 -158
- package/src/components/Lighter.jsx +162 -162
- package/src/components/Line.js +128 -128
- package/src/components/LinearGradient.js +29 -29
- package/src/components/Mapping.js +71 -71
- package/src/components/PieChart.js +1093 -1093
- package/src/components/StackData.js +20 -20
- package/src/components/StereoBar.tsx +298 -298
- package/src/components/Tooltip.js +133 -133
- package/src/components/index.js +49 -49
- package/src/context/index.js +2 -2
- package/src/css/index.module.css +41 -41
- package/src/css/piechart.module.css +26 -26
- package/src/element/ConicGradient.jsx +55 -55
- package/src/element/Line.tsx +33 -33
- package/src/element/index.ts +3 -3
- package/src/formatter/index.js +1 -1
- package/src/formatter/legend.js +90 -90
- package/src/hooks/index.js +17 -17
- package/src/hooks/useAnimateData.ts +62 -62
- package/src/hooks/useAxes.js +143 -143
- package/src/hooks/useCarouselAxisX.js +163 -163
- package/src/hooks/useExtentData.js +88 -88
- package/src/hooks/useFilterData.js +72 -72
- package/src/hooks/useStackData.js +100 -100
- package/src/hooks/useTooltip.ts +96 -96
- package/src/index.js +6 -6
- package/src/types/index.d.ts +59 -59
- package/src/utils/index.js +671 -671
- package/tsconfig.json +22 -22
package/.babelrc
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
|
|
3
|
-
"plugins": [
|
|
4
|
-
"@babel/plugin-proposal-export-default-from",
|
|
5
|
-
"@babel/plugin-transform-runtime",
|
|
6
|
-
"@babel/plugin-proposal-class-properties"
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@babel/plugin-proposal-export-default-from",
|
|
5
|
+
"@babel/plugin-transform-runtime",
|
|
6
|
+
"@babel/plugin-proposal-class-properties"
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -17,8 +17,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _hooks = require("../hooks");
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* 用来做图表数据改变(增长)动画(HOC)
|
|
20
|
+
/**
|
|
21
|
+
* 用来做图表数据改变(增长)动画(HOC)
|
|
22
22
|
*/
|
|
23
23
|
var _default = function _default(Component) {
|
|
24
24
|
return /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
package/lib/components/Axis.js
CHANGED
|
@@ -19,8 +19,8 @@ var _context = require("../context");
|
|
|
19
19
|
|
|
20
20
|
var _element = require("../element");
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* x, y, z轴
|
|
22
|
+
/**
|
|
23
|
+
* x, y, z轴
|
|
24
24
|
*/
|
|
25
25
|
var defaultAlign = {
|
|
26
26
|
textAnchor: 'middle',
|
|
@@ -48,16 +48,16 @@ var getAxesPath = function getAxesPath(orientation, _ref2) {
|
|
|
48
48
|
return 'M0, -0.5V' + (height + 0.5);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
/**
|
|
52
|
-
* 根据坐标轴位置来确定轴标签的垂直对齐方式,水平对齐方式,以及轴标签位于坐标轴的哪个方向
|
|
53
|
-
* @param orientation 坐标轴位置
|
|
54
|
-
* @param rotate 旋转角度
|
|
55
|
-
* @returns {
|
|
56
|
-
* dominantBaseline,
|
|
57
|
-
* textAnchor,
|
|
58
|
-
* directionX,
|
|
59
|
-
* directionY
|
|
60
|
-
* }
|
|
51
|
+
/**
|
|
52
|
+
* 根据坐标轴位置来确定轴标签的垂直对齐方式,水平对齐方式,以及轴标签位于坐标轴的哪个方向
|
|
53
|
+
* @param orientation 坐标轴位置
|
|
54
|
+
* @param rotate 旋转角度
|
|
55
|
+
* @returns {
|
|
56
|
+
* dominantBaseline,
|
|
57
|
+
* textAnchor,
|
|
58
|
+
* directionX,
|
|
59
|
+
* directionY
|
|
60
|
+
* }
|
|
61
61
|
*/
|
|
62
62
|
|
|
63
63
|
|
package/lib/components/Chart.js
CHANGED
|
@@ -19,8 +19,8 @@ var _context = require("../context");
|
|
|
19
19
|
|
|
20
20
|
var _ = require(".");
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 总入口,通过外面传进来的type来确定渲染哪种图表,饼环图表为“pie”,否则为轴类图表
|
|
22
|
+
/**
|
|
23
|
+
* 总入口,通过外面传进来的type来确定渲染哪种图表,饼环图表为“pie”,否则为轴类图表
|
|
24
24
|
*/
|
|
25
25
|
var getCallbackData = function getCallbackData(callbacks, data) {
|
|
26
26
|
var callbackData;
|
|
@@ -19,8 +19,8 @@ var _utils = require("@easyv/utils/lib/common/utils");
|
|
|
19
19
|
|
|
20
20
|
var _indexModule = _interopRequireDefault(require("../css/index.module.css"));
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 饼图装饰内圈
|
|
22
|
+
/**
|
|
23
|
+
* 饼图装饰内圈
|
|
24
24
|
*/
|
|
25
25
|
var _default = function _default(_ref) {
|
|
26
26
|
var width = _ref.width,
|
|
@@ -123,8 +123,8 @@ var _default = function _default(_ref) {
|
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
|
-
/**
|
|
127
|
-
* ConicalGradient
|
|
126
|
+
/**
|
|
127
|
+
* ConicalGradient
|
|
128
128
|
*/
|
|
129
129
|
|
|
130
130
|
|
|
@@ -136,11 +136,11 @@ function ConicalGradient() {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
ConicalGradient.prototype = {
|
|
139
|
-
/**
|
|
140
|
-
* addColorStop
|
|
141
|
-
*
|
|
142
|
-
* @param {Number} offset
|
|
143
|
-
* @param {Array} color RGBA值
|
|
139
|
+
/**
|
|
140
|
+
* addColorStop
|
|
141
|
+
*
|
|
142
|
+
* @param {Number} offset
|
|
143
|
+
* @param {Array} color RGBA值
|
|
144
144
|
*/
|
|
145
145
|
addColorStop: function addColorStop(offset, color) {
|
|
146
146
|
this._offsets.push(offset);
|
|
@@ -150,23 +150,23 @@ ConicalGradient.prototype = {
|
|
|
150
150
|
return this;
|
|
151
151
|
},
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* _offsetsReverse (array.forEach callback)
|
|
153
|
+
/**
|
|
154
|
+
* _offsetsReverse (array.forEach callback)
|
|
155
155
|
*/
|
|
156
156
|
_offsetsReverse: function _offsetsReverse(offset, index, array) {
|
|
157
157
|
array[index] = 1 - offset;
|
|
158
158
|
},
|
|
159
159
|
|
|
160
|
-
/**
|
|
161
|
-
* fill
|
|
162
|
-
*
|
|
163
|
-
* @param {Number} context
|
|
164
|
-
* @param {Number} x
|
|
165
|
-
* @param {Number} y
|
|
166
|
-
* @param {Number} radius
|
|
167
|
-
* @param {Number} startAngle
|
|
168
|
-
* @param {Number} endAngle
|
|
169
|
-
* @param {Boolean} anticlockwise
|
|
160
|
+
/**
|
|
161
|
+
* fill
|
|
162
|
+
*
|
|
163
|
+
* @param {Number} context
|
|
164
|
+
* @param {Number} x
|
|
165
|
+
* @param {Number} y
|
|
166
|
+
* @param {Number} radius
|
|
167
|
+
* @param {Number} startAngle
|
|
168
|
+
* @param {Number} endAngle
|
|
169
|
+
* @param {Boolean} anticlockwise
|
|
170
170
|
*/
|
|
171
171
|
fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
172
172
|
var offsets = this._offsets;
|
package/lib/components/Label.js
CHANGED
|
@@ -157,19 +157,29 @@ var Icon = function Icon(_ref4) {
|
|
|
157
157
|
inner = _ref4$config.inner,
|
|
158
158
|
outer = _ref4$config.outer,
|
|
159
159
|
color = _ref4$config.color,
|
|
160
|
-
radius = _ref4$config.radius
|
|
160
|
+
radius = _ref4$config.radius,
|
|
161
|
+
image = _ref4$config.image,
|
|
162
|
+
_ref4$config$size = _ref4$config.size,
|
|
163
|
+
width = _ref4$config$size.width,
|
|
164
|
+
height = _ref4$config$size.height;
|
|
161
165
|
return mode == 'single' ? /*#__PURE__*/React.createElement(Circle, {
|
|
162
166
|
cx: cx,
|
|
163
167
|
cy: cy,
|
|
164
168
|
color: color,
|
|
165
169
|
radius: radius
|
|
166
|
-
}) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Circle, (0, _extends2["default"])({
|
|
170
|
+
}) : mode == 'double' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Circle, (0, _extends2["default"])({
|
|
167
171
|
cx: cx,
|
|
168
172
|
cy: cy
|
|
169
173
|
}, inner)), /*#__PURE__*/React.createElement(Circle, (0, _extends2["default"])({
|
|
170
174
|
cx: cx,
|
|
171
175
|
cy: cy
|
|
172
|
-
}, outer)))
|
|
176
|
+
}, outer))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("image", {
|
|
177
|
+
width: width,
|
|
178
|
+
height: height,
|
|
179
|
+
x: cx - width / 2,
|
|
180
|
+
y: cy - height / 2,
|
|
181
|
+
xlinkHref: window.appConfig.ASSETS_URL + image
|
|
182
|
+
}));
|
|
173
183
|
};
|
|
174
184
|
|
|
175
185
|
var Circle = function Circle(_ref5) {
|
package/lib/css/index.module.css
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
.rotateClockwise {
|
|
2
|
-
animation-name: rotateClockwise;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
@keyframes rotateClockwise {
|
|
6
|
-
0% {
|
|
7
|
-
transform: rotate(0deg);
|
|
8
|
-
}
|
|
9
|
-
100% {
|
|
10
|
-
transform: rotate(360deg);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.rotateCounterClockwise {
|
|
15
|
-
animation-name: rotateCounterClockwise;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@keyframes rotateCounterClockwise {
|
|
19
|
-
0% {
|
|
20
|
-
transform: rotate(360deg);
|
|
21
|
-
}
|
|
22
|
-
100% {
|
|
23
|
-
transform: rotate(0deg);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.showAllStyle {
|
|
28
|
-
display: grid;
|
|
29
|
-
width: 100%;
|
|
30
|
-
grid-template-columns: 40% 30% 30%;
|
|
31
|
-
align-items: center;
|
|
32
|
-
flex-direction: row;
|
|
33
|
-
justify-content: space-between;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.notShowAllStyle {
|
|
37
|
-
display: flex;
|
|
38
|
-
width: 100%;
|
|
39
|
-
align-items: center;
|
|
40
|
-
flex-direction: row;
|
|
41
|
-
justify-content: space-between;
|
|
1
|
+
.rotateClockwise {
|
|
2
|
+
animation-name: rotateClockwise;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
@keyframes rotateClockwise {
|
|
6
|
+
0% {
|
|
7
|
+
transform: rotate(0deg);
|
|
8
|
+
}
|
|
9
|
+
100% {
|
|
10
|
+
transform: rotate(360deg);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.rotateCounterClockwise {
|
|
15
|
+
animation-name: rotateCounterClockwise;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@keyframes rotateCounterClockwise {
|
|
19
|
+
0% {
|
|
20
|
+
transform: rotate(360deg);
|
|
21
|
+
}
|
|
22
|
+
100% {
|
|
23
|
+
transform: rotate(0deg);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.showAllStyle {
|
|
28
|
+
display: grid;
|
|
29
|
+
width: 100%;
|
|
30
|
+
grid-template-columns: 40% 30% 30%;
|
|
31
|
+
align-items: center;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.notShowAllStyle {
|
|
37
|
+
display: flex;
|
|
38
|
+
width: 100%;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex-direction: row;
|
|
41
|
+
justify-content: space-between;
|
|
42
42
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/*甜甜圈图专用css*/
|
|
2
|
-
.label-line {
|
|
3
|
-
stroke-dasharray: 100;
|
|
4
|
-
stroke-dashoffset: 100;
|
|
5
|
-
animation: dash 800ms ease forwards;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.label-text {
|
|
9
|
-
opacity: 0;
|
|
10
|
-
animation: show 800ms ease forwards;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.inner-arc {
|
|
14
|
-
animation: dash 2s ease forwards;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@keyframes dash {
|
|
18
|
-
100% {
|
|
19
|
-
stroke-dashoffset: 0%;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@keyframes show {
|
|
24
|
-
100% {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
1
|
+
/*甜甜圈图专用css*/
|
|
2
|
+
.label-line {
|
|
3
|
+
stroke-dasharray: 100;
|
|
4
|
+
stroke-dashoffset: 100;
|
|
5
|
+
animation: dash 800ms ease forwards;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.label-text {
|
|
9
|
+
opacity: 0;
|
|
10
|
+
animation: show 800ms ease forwards;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.inner-arc {
|
|
14
|
+
animation: dash 2s ease forwards;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@keyframes dash {
|
|
18
|
+
100% {
|
|
19
|
+
stroke-dashoffset: 0%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes show {
|
|
24
|
+
100% {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
27
|
}
|
|
@@ -19,11 +19,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
19
19
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* 图表数据动画
|
|
24
|
-
* @param {Array} data data列表
|
|
25
|
-
* @param {boolean} dataAnimation 是否开启数据增长动画
|
|
26
|
-
* @returns 改变后的数据
|
|
22
|
+
/**
|
|
23
|
+
* 图表数据动画
|
|
24
|
+
* @param {Array} data data列表
|
|
25
|
+
* @param {boolean} dataAnimation 是否开启数据增长动画
|
|
26
|
+
* @returns 改变后的数据
|
|
27
27
|
*/
|
|
28
28
|
var _default = function _default(data, dataAnimation) {
|
|
29
29
|
var _useState = (0, _react.useState)([]),
|
package/lib/hooks/useAxes.js
CHANGED
|
@@ -28,11 +28,11 @@ var scales = {
|
|
|
28
28
|
utc: _d3Scale.scaleUtc,
|
|
29
29
|
ordinal: _utils.band
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
32
|
-
* x/y/z轴
|
|
33
|
-
* @param {Array} axes 轴列表数组
|
|
34
|
-
* @param {Object} context 其中需要包括
|
|
35
|
-
* @returns {Map} 返回所有轴
|
|
31
|
+
/**
|
|
32
|
+
* x/y/z轴
|
|
33
|
+
* @param {Array} axes 轴列表数组
|
|
34
|
+
* @param {Object} context 其中需要包括
|
|
35
|
+
* @returns {Map} 返回所有轴
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
var _default = function _default(_ref) {
|
|
@@ -25,11 +25,11 @@ var initialState = {
|
|
|
25
25
|
currentIndex: null,
|
|
26
26
|
flag: false
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
29
|
-
* x轴滚动逻辑
|
|
30
|
-
* @param {Object} axis x轴配置项
|
|
31
|
-
* @param {Object} config x轴轮播动画的配置项
|
|
32
|
-
* @returns {Map} 返回经过改变后的x轴,主要是ticks和scaler的range发生了改变
|
|
28
|
+
/**
|
|
29
|
+
* x轴滚动逻辑
|
|
30
|
+
* @param {Object} axis x轴配置项
|
|
31
|
+
* @param {Object} config x轴轮播动画的配置项
|
|
32
|
+
* @returns {Map} 返回经过改变后的x轴,主要是ticks和scaler的range发生了改变
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
var _default = function _default(axis, config) {
|
|
@@ -61,12 +61,12 @@ var stackData = function stackData(data, series) {
|
|
|
61
61
|
dataMap.clear();
|
|
62
62
|
return [min, max];
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* 计算轴的domain
|
|
66
|
-
* @param {Array} axes x轴列表
|
|
67
|
-
* @param {Object} series 图表的系列,主要是为了读取type, stack, yOrZ三个字段
|
|
68
|
-
* @param {Object} data 数据列表
|
|
69
|
-
* @returns {Array} 返回带domain的轴
|
|
64
|
+
/**
|
|
65
|
+
* 计算轴的domain
|
|
66
|
+
* @param {Array} axes x轴列表
|
|
67
|
+
* @param {Object} series 图表的系列,主要是为了读取type, stack, yOrZ三个字段
|
|
68
|
+
* @param {Object} data 数据列表
|
|
69
|
+
* @returns {Array} 返回带domain的轴
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
|
|
@@ -56,11 +56,11 @@ var getSelected = function getSelected(selected, name) {
|
|
|
56
56
|
});
|
|
57
57
|
return tmp;
|
|
58
58
|
};
|
|
59
|
-
/**
|
|
60
|
-
* 图例点击状态管理
|
|
61
|
-
* @param {Array} data 数据
|
|
62
|
-
* @param {Map} series 系列
|
|
63
|
-
* @returns {Array} 返回筛选后的数据和是否选中状态,及控制选中函数
|
|
59
|
+
/**
|
|
60
|
+
* 图例点击状态管理
|
|
61
|
+
* @param {Array} data 数据
|
|
62
|
+
* @param {Map} series 系列
|
|
63
|
+
* @returns {Array} 返回筛选后的数据和是否选中状态,及控制选中函数
|
|
64
64
|
*/
|
|
65
65
|
|
|
66
66
|
|
|
@@ -89,11 +89,11 @@ var setStackData = function setStackData(data, series, stacks) {
|
|
|
89
89
|
dataMap.clear();
|
|
90
90
|
return series;
|
|
91
91
|
};
|
|
92
|
-
/**
|
|
93
|
-
* 计算堆叠数据
|
|
94
|
-
* @param {Array} data 数据
|
|
95
|
-
* @param {Map} series 系列
|
|
96
|
-
* @returns {Array} 返回堆叠后的数据,由一开始的{x, y, s}变成{data: {x, y, s}, bound: [start, end], index}
|
|
92
|
+
/**
|
|
93
|
+
* 计算堆叠数据
|
|
94
|
+
* @param {Array} data 数据
|
|
95
|
+
* @param {Map} series 系列
|
|
96
|
+
* @returns {Array} 返回堆叠后的数据,由一开始的{x, y, s}变成{data: {x, y, s}, bound: [start, end], index}
|
|
97
97
|
*/
|
|
98
98
|
|
|
99
99
|
|
package/lib/hooks/useTooltip.js
CHANGED
|
@@ -14,16 +14,16 @@ var _react = require("react");
|
|
|
14
14
|
var _utils = require("../utils");
|
|
15
15
|
|
|
16
16
|
var callback = function callback() {};
|
|
17
|
-
/**
|
|
18
|
-
* 主要用于轴类图表,返回当前选中的是哪一个x
|
|
19
|
-
* @param {Array} svg svg的dom实例
|
|
20
|
-
* @param {Number} marginLeft 左间距
|
|
21
|
-
* @param {Number} marginTop 上间距
|
|
22
|
-
* @param {Number} width 宽
|
|
23
|
-
* @param {Number} height 高
|
|
24
|
-
* @param {Number} axisX 类目轴
|
|
25
|
-
* @param {Object} config 轮播动画参数
|
|
26
|
-
* @returns {Object} 返回被选中的名称,坐标,选中方法
|
|
17
|
+
/**
|
|
18
|
+
* 主要用于轴类图表,返回当前选中的是哪一个x
|
|
19
|
+
* @param {Array} svg svg的dom实例
|
|
20
|
+
* @param {Number} marginLeft 左间距
|
|
21
|
+
* @param {Number} marginTop 上间距
|
|
22
|
+
* @param {Number} width 宽
|
|
23
|
+
* @param {Number} height 高
|
|
24
|
+
* @param {Number} axisX 类目轴
|
|
25
|
+
* @param {Object} config 轮播动画参数
|
|
26
|
+
* @returns {Object} 返回被选中的名称,坐标,选中方法
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@easyv/charts",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"make": "babel src -d lib --extensions .ts,.tsx,.js && cp -r src/css lib"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@babel/cli": "^7.6.0",
|
|
14
|
-
"@babel/core": "^7.11.5",
|
|
15
|
-
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
|
16
|
-
"@babel/plugin-proposal-export-default-from": "^7.10.4",
|
|
17
|
-
"@babel/plugin-transform-runtime": "^7.11.5",
|
|
18
|
-
"@babel/preset-env": "^7.11.5",
|
|
19
|
-
"@babel/preset-react": "^7.10.4",
|
|
20
|
-
"@babel/preset-typescript": "^7.14.5",
|
|
21
|
-
"@types/d3": "^7.0.0",
|
|
22
|
-
"@types/react": "^17.0.14",
|
|
23
|
-
"babel-plugin-transform-import-styles": "0.0.11",
|
|
24
|
-
"babel-preset-env": "^1.7.0",
|
|
25
|
-
"load-styles": "^2.0.0"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@easyv/utils": "^0.0.26",
|
|
29
|
-
"d3v7": "npm:d3@^7.0.0",
|
|
30
|
-
"popmotion": "^9.3.6",
|
|
31
|
-
"react": "^17.0.2",
|
|
32
|
-
"svg-points": "^6.0.1"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@easyv/charts",
|
|
3
|
+
"version": "1.0.71",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"make": "babel src -d lib --extensions .ts,.tsx,.js && cp -r src/css lib"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@babel/cli": "^7.6.0",
|
|
14
|
+
"@babel/core": "^7.11.5",
|
|
15
|
+
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
|
16
|
+
"@babel/plugin-proposal-export-default-from": "^7.10.4",
|
|
17
|
+
"@babel/plugin-transform-runtime": "^7.11.5",
|
|
18
|
+
"@babel/preset-env": "^7.11.5",
|
|
19
|
+
"@babel/preset-react": "^7.10.4",
|
|
20
|
+
"@babel/preset-typescript": "^7.14.5",
|
|
21
|
+
"@types/d3": "^7.0.0",
|
|
22
|
+
"@types/react": "^17.0.14",
|
|
23
|
+
"babel-plugin-transform-import-styles": "0.0.11",
|
|
24
|
+
"babel-preset-env": "^1.7.0",
|
|
25
|
+
"load-styles": "^2.0.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@easyv/utils": "^0.0.26",
|
|
29
|
+
"d3v7": "npm:d3@^7.0.0",
|
|
30
|
+
"popmotion": "^9.3.6",
|
|
31
|
+
"react": "^17.0.2",
|
|
32
|
+
"svg-points": "^6.0.1"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 用来做图表数据改变(增长)动画(HOC)
|
|
3
|
-
*/
|
|
4
|
-
import React, { memo, ComponentType } from 'react';
|
|
5
|
-
import { useAnimateData } from '../hooks';
|
|
6
|
-
|
|
7
|
-
export default (Component: ComponentType<any>) =>
|
|
8
|
-
memo(
|
|
9
|
-
({
|
|
10
|
-
data,
|
|
11
|
-
config: { dataAnimation, ...config },
|
|
12
|
-
...rest
|
|
13
|
-
}: {
|
|
14
|
-
data: DataType[];
|
|
15
|
-
config: { dataAnimation: boolean; [key: string]: any };
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}) => (
|
|
18
|
-
<Component
|
|
19
|
-
{...rest}
|
|
20
|
-
config={config}
|
|
21
|
-
data={useAnimateData(data, dataAnimation)}
|
|
22
|
-
/>
|
|
23
|
-
)
|
|
24
|
-
);
|
|
1
|
+
/**
|
|
2
|
+
* 用来做图表数据改变(增长)动画(HOC)
|
|
3
|
+
*/
|
|
4
|
+
import React, { memo, ComponentType } from 'react';
|
|
5
|
+
import { useAnimateData } from '../hooks';
|
|
6
|
+
|
|
7
|
+
export default (Component: ComponentType<any>) =>
|
|
8
|
+
memo(
|
|
9
|
+
({
|
|
10
|
+
data,
|
|
11
|
+
config: { dataAnimation, ...config },
|
|
12
|
+
...rest
|
|
13
|
+
}: {
|
|
14
|
+
data: DataType[];
|
|
15
|
+
config: { dataAnimation: boolean; [key: string]: any };
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}) => (
|
|
18
|
+
<Component
|
|
19
|
+
{...rest}
|
|
20
|
+
config={config}
|
|
21
|
+
data={useAnimateData(data, dataAnimation)}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
);
|