@easyv/charts 1.5.29 → 1.5.30
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/.husky/commit-msg +3 -3
- package/CHANGELOG.md +18 -18
- package/commitlint.config.js +1 -1
- package/lib/components/Background.js +2 -2
- package/lib/components/ConicalGradient.js +21 -21
- package/lib/components/Lighter.js +2 -2
- package/lib/components/LinearGradient.js +2 -2
- package/lib/css/index.module.css +42 -42
- package/lib/css/piechart.module.css +26 -26
- package/lib/hooks/useAnimateData.js +6 -6
- package/lib/hooks/useAxes.js +29 -6
- package/lib/hooks/useExtentData.js +19 -4
- package/lib/hooks/useFilterData.js +5 -5
- package/lib/hooks/useStackData.js +5 -5
- package/lib/hooks/useTooltip.js +11 -11
- package/package.json +55 -55
- package/src/components/Background.tsx +61 -61
- package/src/components/Band.tsx +271 -271
- package/src/components/Brush.js +159 -159
- package/src/components/Chart.js +135 -135
- package/src/components/ChartContainer.tsx +71 -71
- package/src/components/ConicalGradient.js +258 -258
- package/src/components/Control.jsx +236 -236
- package/src/components/ExtentData.js +18 -18
- package/src/components/Indicator.js +58 -58
- package/src/components/Label.js +242 -242
- package/src/components/Legend.js +166 -166
- package/src/components/Lighter.jsx +173 -173
- package/src/components/Line.js +153 -153
- package/src/components/LinearGradient.js +29 -29
- package/src/components/PieTooltip.jsx +160 -160
- package/src/components/StereoBar.tsx +307 -307
- package/src/components/index.js +59 -59
- package/src/context/index.js +2 -2
- package/src/css/index.module.css +42 -42
- 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 +92 -92
- package/src/hooks/index.js +20 -20
- package/src/hooks/useAnimateData.ts +68 -68
- package/src/hooks/useAxes.js +86 -32
- package/src/hooks/useExtentData.js +52 -16
- package/src/hooks/useFilterData.js +78 -78
- package/src/hooks/useStackData.js +102 -102
- package/src/hooks/useTooltip.ts +104 -104
- package/src/index.js +6 -6
- package/src/types/index.d.ts +68 -68
- package/src/utils/index.js +762 -762
- package/tsconfig.json +23 -23
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
|
+
}
|
package/.husky/commit-msg
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
-
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
4
|
yarn commitlint --edit $1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [1.1.1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/compare/v1.1.0...v1.1.1) (2022-04-13)
|
|
6
|
-
|
|
7
|
-
## 1.1.0 (2022-04-02)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
### Features
|
|
11
|
-
|
|
12
|
-
* 轴标签,label支持样式传入 ([749a595](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/749a595a96b95917dafdc1766f63efec73398d64))
|
|
13
|
-
* axis轴标签支持点击触发回调 ([1f636e1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1f636e1840f4f3b48c2b9765ce6087759d82fb17))
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
### Bug Fixes
|
|
17
|
-
|
|
18
|
-
* **band组件:** 修复foreignObject在Safari浏览器下的位置诡异偏离问题 ([1a65d54](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1a65d54abbcf6c9e84cc85cc8b6a9d28b24fa4c4))
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.1.1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/compare/v1.1.0...v1.1.1) (2022-04-13)
|
|
6
|
+
|
|
7
|
+
## 1.1.0 (2022-04-02)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* 轴标签,label支持样式传入 ([749a595](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/749a595a96b95917dafdc1766f63efec73398d64))
|
|
13
|
+
* axis轴标签支持点击触发回调 ([1f636e1](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1f636e1840f4f3b48c2b9765ce6087759d82fb17))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **band组件:** 修复foreignObject在Safari浏览器下的位置诡异偏离问题 ([1a65d54](https://gitlab.prod.dtstack.cn:10022/visdev/visApplication/easyv-charts/commit/1a65d54abbcf6c9e84cc85cc8b6a9d28b24fa4c4))
|
package/commitlint.config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {extends: ['@commitlint/config-conventional']}
|
|
1
|
+
module.exports = {extends: ['@commitlint/config-conventional']}
|
|
@@ -23,8 +23,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
25
|
|
|
26
|
-
/**
|
|
27
|
-
* 饼图装饰内圈
|
|
26
|
+
/**
|
|
27
|
+
* 饼图装饰内圈
|
|
28
28
|
*/
|
|
29
29
|
var _default = function _default(_ref) {
|
|
30
30
|
var width = _ref.width,
|
|
@@ -127,8 +127,8 @@ var _default = function _default(_ref) {
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
};
|
|
130
|
-
/**
|
|
131
|
-
* ConicalGradient
|
|
130
|
+
/**
|
|
131
|
+
* ConicalGradient
|
|
132
132
|
*/
|
|
133
133
|
|
|
134
134
|
|
|
@@ -140,11 +140,11 @@ function ConicalGradient() {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
ConicalGradient.prototype = {
|
|
143
|
-
/**
|
|
144
|
-
* addColorStop
|
|
145
|
-
*
|
|
146
|
-
* @param {Number} offset
|
|
147
|
-
* @param {Array} color RGBA值
|
|
143
|
+
/**
|
|
144
|
+
* addColorStop
|
|
145
|
+
*
|
|
146
|
+
* @param {Number} offset
|
|
147
|
+
* @param {Array} color RGBA值
|
|
148
148
|
*/
|
|
149
149
|
addColorStop: function addColorStop(offset, color) {
|
|
150
150
|
this._offsets.push(offset);
|
|
@@ -154,23 +154,23 @@ ConicalGradient.prototype = {
|
|
|
154
154
|
return this;
|
|
155
155
|
},
|
|
156
156
|
|
|
157
|
-
/**
|
|
158
|
-
* _offsetsReverse (array.forEach callback)
|
|
157
|
+
/**
|
|
158
|
+
* _offsetsReverse (array.forEach callback)
|
|
159
159
|
*/
|
|
160
160
|
_offsetsReverse: function _offsetsReverse(offset, index, array) {
|
|
161
161
|
array[index] = 1 - offset;
|
|
162
162
|
},
|
|
163
163
|
|
|
164
|
-
/**
|
|
165
|
-
* fill
|
|
166
|
-
*
|
|
167
|
-
* @param {Number} context
|
|
168
|
-
* @param {Number} x
|
|
169
|
-
* @param {Number} y
|
|
170
|
-
* @param {Number} radius
|
|
171
|
-
* @param {Number} startAngle
|
|
172
|
-
* @param {Number} endAngle
|
|
173
|
-
* @param {Boolean} anticlockwise
|
|
164
|
+
/**
|
|
165
|
+
* fill
|
|
166
|
+
*
|
|
167
|
+
* @param {Number} context
|
|
168
|
+
* @param {Number} x
|
|
169
|
+
* @param {Number} y
|
|
170
|
+
* @param {Number} radius
|
|
171
|
+
* @param {Number} startAngle
|
|
172
|
+
* @param {Number} endAngle
|
|
173
|
+
* @param {Boolean} anticlockwise
|
|
174
174
|
*/
|
|
175
175
|
fill: function fill(context, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
176
176
|
var offsets = this._offsets;
|
|
@@ -25,8 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* 区域图发光跟踪路径
|
|
28
|
+
/**
|
|
29
|
+
* 区域图发光跟踪路径
|
|
30
30
|
*/
|
|
31
31
|
var _default = function _default(_ref) {
|
|
32
32
|
var d = _ref.path,
|
package/lib/css/index.module.css
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
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
|
-
/* flex:1; */
|
|
40
|
-
align-items: center;
|
|
41
|
-
flex-direction: row;
|
|
42
|
-
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
|
+
/* flex:1; */
|
|
40
|
+
align-items: center;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
justify-content: space-between;
|
|
43
43
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/*甜甜圈图专用css*/
|
|
2
|
-
.label-line {
|
|
3
|
-
stroke-dasharray: 100;
|
|
4
|
-
stroke-dashoffset: 100;
|
|
5
|
-
animation: dash var(--labelDuration) ease forwards;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.label-text {
|
|
9
|
-
opacity: 0;
|
|
10
|
-
animation: show var(--labelDuration) ease forwards;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.inner-arc {
|
|
14
|
-
animation: dash var(--ringDuration) 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 var(--labelDuration) ease forwards;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.label-text {
|
|
9
|
+
opacity: 0;
|
|
10
|
+
animation: show var(--labelDuration) ease forwards;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.inner-arc {
|
|
14
|
+
animation: dash var(--ringDuration) 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,12 +19,12 @@ 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : 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
|
-
* @param {boolean} active 是否处于活跃状态,false为休眠
|
|
27
|
-
* @returns 改变后的数据
|
|
22
|
+
/**
|
|
23
|
+
* 图表数据动画
|
|
24
|
+
* @param {Array} data data列表
|
|
25
|
+
* @param {boolean} dataAnimation 是否开启数据增长动画
|
|
26
|
+
* @param {boolean} active 是否处于活跃状态,false为休眠
|
|
27
|
+
* @returns 改变后的数据
|
|
28
28
|
*/
|
|
29
29
|
var _default = function _default(data, dataAnimation, active) {
|
|
30
30
|
var _useState = (0, _react.useState)([]),
|
package/lib/hooks/useAxes.js
CHANGED
|
@@ -36,16 +36,36 @@ var getCount = function getCount(num) {
|
|
|
36
36
|
|
|
37
37
|
var getNewDomain = function getNewDomain(domain, mode, step) {
|
|
38
38
|
var extent = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
39
|
+
var numericalRangeModel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "value";
|
|
40
|
+
var percentageExtent = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
41
|
+
max: 100,
|
|
42
|
+
min: 100
|
|
43
|
+
};
|
|
39
44
|
var _extent$min = extent.min,
|
|
40
|
-
|
|
45
|
+
defaultBottom = _extent$min === void 0 ? "" : _extent$min,
|
|
41
46
|
_extent$max = extent.max,
|
|
42
|
-
|
|
47
|
+
defaultTop = _extent$max === void 0 ? "" : _extent$max;
|
|
48
|
+
var _percentageExtent$min = percentageExtent.min,
|
|
49
|
+
defaultPercentageMin = _percentageExtent$min === void 0 ? 100 : _percentageExtent$min,
|
|
50
|
+
_percentageExtent$max = percentageExtent.max,
|
|
51
|
+
defaultPercentageMax = _percentageExtent$max === void 0 ? 100 : _percentageExtent$max;
|
|
52
|
+
var bottom = defaultBottom,
|
|
53
|
+
top = defaultTop;
|
|
43
54
|
var newDomain = []; //能进入这个函数,说明extent中min和max至少有一个是缺失的,如果max存在,意味着纵轴上限被固定
|
|
44
55
|
|
|
45
56
|
var min = domain[0],
|
|
46
57
|
max = domain[1];
|
|
47
58
|
var minCount = Math.pow(10, getCount(min)),
|
|
48
|
-
maxCount = Math.pow(10, getCount(max));
|
|
59
|
+
maxCount = Math.pow(10, getCount(max)); //轴标签,范围模式,百分比模式
|
|
60
|
+
|
|
61
|
+
if (numericalRangeModel == "percentage") {
|
|
62
|
+
var _max = defaultPercentageMax === "" ? 100 : defaultPercentageMax;
|
|
63
|
+
|
|
64
|
+
var _min = defaultPercentageMin === "" ? 100 : defaultPercentageMin;
|
|
65
|
+
|
|
66
|
+
bottom = min * _min / 100;
|
|
67
|
+
top = max * _max / 100;
|
|
68
|
+
}
|
|
49
69
|
|
|
50
70
|
switch (mode) {
|
|
51
71
|
case "count":
|
|
@@ -54,7 +74,7 @@ var getNewDomain = function getNewDomain(domain, mode, step) {
|
|
|
54
74
|
break;
|
|
55
75
|
|
|
56
76
|
case "step":
|
|
57
|
-
if (
|
|
77
|
+
if (defaultTop != "") {
|
|
58
78
|
newDomain = [domain[1], domain[1]];
|
|
59
79
|
|
|
60
80
|
while (newDomain[0] > domain[0]) {
|
|
@@ -118,6 +138,9 @@ var _default = function _default(_ref) {
|
|
|
118
138
|
axes.forEach(function (item) {
|
|
119
139
|
var _item$config$label = item.config.label,
|
|
120
140
|
extent = _item$config$label.extent,
|
|
141
|
+
percentageExtent = _item$config$label.percentageExtent,
|
|
142
|
+
_item$config$label$nu = _item$config$label.numericalRangeModel,
|
|
143
|
+
numericalRangeModel = _item$config$label$nu === void 0 ? "value" : _item$config$label$nu,
|
|
121
144
|
_item$config$label$sh = _item$config$label.showLast,
|
|
122
145
|
showLast = _item$config$label$sh === void 0 ? false : _item$config$label$sh,
|
|
123
146
|
_item$config$label$de = _item$config$label.decimal,
|
|
@@ -176,7 +199,7 @@ var _default = function _default(_ref) {
|
|
|
176
199
|
* @param {*} scales
|
|
177
200
|
* @param {*} type 轴类型
|
|
178
201
|
* @param {*} domain 数据的范围
|
|
179
|
-
* @param {*}
|
|
202
|
+
* @param {*} 屏幕坐标的范围
|
|
180
203
|
* @returns
|
|
181
204
|
*/
|
|
182
205
|
|
|
@@ -339,7 +362,7 @@ var _default = function _default(_ref) {
|
|
|
339
362
|
var fixedDomain = extent && extent.min != "" && extent.max != ""; //判断配置项中是否强制了最大最小值,如果已经被强制了,就不计算newDomain
|
|
340
363
|
|
|
341
364
|
if (type !== "ordinal" && !isNaN(domain[1]) && !auto && !fixedDomain) {
|
|
342
|
-
newDomain = getNewDomain(domain, mode, _step, extent);
|
|
365
|
+
newDomain = getNewDomain(domain, mode, _step, extent, numericalRangeModel, percentageExtent);
|
|
343
366
|
}
|
|
344
367
|
|
|
345
368
|
var scaler = scales[type]().domain(newDomain).range(range);
|
|
@@ -122,13 +122,17 @@ var _default = function _default(_ref) {
|
|
|
122
122
|
// return d[1].sort((a,b)=>a.x>b.x?1:-1)
|
|
123
123
|
// });
|
|
124
124
|
}
|
|
125
|
-
} //
|
|
125
|
+
} // console.log("nononon", axes);
|
|
126
|
+
//clipAxisMode如果是auto根据clipDifferenceValue设置clipValue
|
|
126
127
|
|
|
127
128
|
|
|
128
129
|
return axes.map(function (item) {
|
|
129
130
|
var axisType = item.axisType,
|
|
130
131
|
domain = item.domain,
|
|
131
|
-
type = item.type
|
|
132
|
+
type = item.type,
|
|
133
|
+
_item$config$label = item.config.label,
|
|
134
|
+
percentageExtent = _item$config$label.percentageExtent,
|
|
135
|
+
numericalRangeModel = _item$config$label.numericalRangeModel;
|
|
132
136
|
|
|
133
137
|
switch (axisType) {
|
|
134
138
|
case "x":
|
|
@@ -171,13 +175,13 @@ var _default = function _default(_ref) {
|
|
|
171
175
|
}
|
|
172
176
|
|
|
173
177
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
174
|
-
domain: domain ? getDomain(y, domain) : y
|
|
178
|
+
domain: domain ? getDomain(y, domain, numericalRangeModel, percentageExtent) : y
|
|
175
179
|
});
|
|
176
180
|
}
|
|
177
181
|
|
|
178
182
|
case "z":
|
|
179
183
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
180
|
-
domain: domain ? getDomain(z, domain) : z
|
|
184
|
+
domain: domain ? getDomain(z, domain, numericalRangeModel, percentageExtent) : z
|
|
181
185
|
});
|
|
182
186
|
}
|
|
183
187
|
});
|
|
@@ -192,5 +196,16 @@ var getDomain = function getDomain(_ref2, _ref3) {
|
|
|
192
196
|
|
|
193
197
|
var min = _ref3.min,
|
|
194
198
|
max = _ref3.max;
|
|
199
|
+
var numericalRangeModel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "value";
|
|
200
|
+
var percentageExtent = arguments.length > 3 ? arguments[3] : undefined;
|
|
201
|
+
|
|
202
|
+
if (numericalRangeModel == "percentage" && percentageExtent) {
|
|
203
|
+
var _min = percentageExtent.min == "" ? 100 : +percentageExtent.min;
|
|
204
|
+
|
|
205
|
+
var _max = percentageExtent.max == "" ? 100 : +percentageExtent.max;
|
|
206
|
+
|
|
207
|
+
return [min1 * _min / 100, max1 * _max / 100];
|
|
208
|
+
}
|
|
209
|
+
|
|
195
210
|
return [min !== "" ? +min : min1, max !== "" ? +max : max1];
|
|
196
211
|
};
|
|
@@ -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
|
|
|
@@ -90,11 +90,11 @@ var setStackData = function setStackData(data, series, stacks) {
|
|
|
90
90
|
dataMap.clear();
|
|
91
91
|
return series;
|
|
92
92
|
};
|
|
93
|
-
/**
|
|
94
|
-
* 计算堆叠数据
|
|
95
|
-
* @param {Array} data 数据
|
|
96
|
-
* @param {Map} series 系列
|
|
97
|
-
* @returns {Array} 返回堆叠后的数据,由一开始的{x, y, s}变成{data: {x, y, s}, bound: [start, end], index}
|
|
93
|
+
/**
|
|
94
|
+
* 计算堆叠数据
|
|
95
|
+
* @param {Array} data 数据
|
|
96
|
+
* @param {Map} series 系列
|
|
97
|
+
* @returns {Array} 返回堆叠后的数据,由一开始的{x, y, s}变成{data: {x, y, s}, bound: [start, end], index}
|
|
98
98
|
*/
|
|
99
99
|
|
|
100
100
|
|
package/lib/hooks/useTooltip.js
CHANGED
|
@@ -14,17 +14,17 @@ 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
|
-
* @param {Boolean} active 组件是否处于活跃状态
|
|
27
|
-
* @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
|
+
* @param {Boolean} active 组件是否处于活跃状态
|
|
27
|
+
* @returns {Object} 返回被选中的名称,坐标,选中方法
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@easyv/charts",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"make": "babel src -d lib --extensions .ts,.tsx,.js,.jsx && cp -r src/css lib",
|
|
8
|
-
"prepare": "husky install"
|
|
9
|
-
},
|
|
10
|
-
"keywords": [],
|
|
11
|
-
"author": "",
|
|
12
|
-
"license": "ISC",
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@babel/cli": "^7.17.10",
|
|
15
|
-
"@babel/core": "^7.17.10",
|
|
16
|
-
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
17
|
-
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
18
|
-
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
19
|
-
"@babel/preset-env": "^7.17.10",
|
|
20
|
-
"@babel/preset-react": "^7.16.7",
|
|
21
|
-
"@babel/preset-typescript": "^7.16.7",
|
|
22
|
-
"@commitlint/cli": "^17.6.7",
|
|
23
|
-
"@commitlint/config-conventional": "^16.2.4",
|
|
24
|
-
"@types/d3": "^7.0.0",
|
|
25
|
-
"@types/react": "^18.0.12",
|
|
26
|
-
"@types/react-dom": "^18.0.5",
|
|
27
|
-
"babel-plugin-transform-import-styles": "^0.0.11",
|
|
28
|
-
"babel-preset-env": "^1.7.0",
|
|
29
|
-
"cz-conventional-changelog": "^3.3.0",
|
|
30
|
-
"husky": "^7.0.4",
|
|
31
|
-
"load-styles": "^2.0.0",
|
|
32
|
-
"standard-version": "^9.3.2"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@easyv/utils": "^0.0.45",
|
|
36
|
-
"d3v7": "npm:d3@^7.0.0",
|
|
37
|
-
"gitignore": "^0.7.0",
|
|
38
|
-
"mrm": "^4.0.0",
|
|
39
|
-
"popmotion": "^9.3.6",
|
|
40
|
-
"react": "^17.0.2",
|
|
41
|
-
"svg-path-properties": "^1.0.11",
|
|
42
|
-
"svg-points": "^6.0.1",
|
|
43
|
-
"yarn": "^1.22.19"
|
|
44
|
-
},
|
|
45
|
-
"config": {
|
|
46
|
-
"commitizen": {
|
|
47
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"standard-version": {
|
|
51
|
-
"skip": {
|
|
52
|
-
"commit": true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@easyv/charts",
|
|
3
|
+
"version": "1.5.30",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"make": "babel src -d lib --extensions .ts,.tsx,.js,.jsx && cp -r src/css lib",
|
|
8
|
+
"prepare": "husky install"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/cli": "^7.17.10",
|
|
15
|
+
"@babel/core": "^7.17.10",
|
|
16
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
17
|
+
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
18
|
+
"@babel/plugin-transform-runtime": "^7.17.10",
|
|
19
|
+
"@babel/preset-env": "^7.17.10",
|
|
20
|
+
"@babel/preset-react": "^7.16.7",
|
|
21
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
22
|
+
"@commitlint/cli": "^17.6.7",
|
|
23
|
+
"@commitlint/config-conventional": "^16.2.4",
|
|
24
|
+
"@types/d3": "^7.0.0",
|
|
25
|
+
"@types/react": "^18.0.12",
|
|
26
|
+
"@types/react-dom": "^18.0.5",
|
|
27
|
+
"babel-plugin-transform-import-styles": "^0.0.11",
|
|
28
|
+
"babel-preset-env": "^1.7.0",
|
|
29
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
30
|
+
"husky": "^7.0.4",
|
|
31
|
+
"load-styles": "^2.0.0",
|
|
32
|
+
"standard-version": "^9.3.2"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@easyv/utils": "^0.0.45",
|
|
36
|
+
"d3v7": "npm:d3@^7.0.0",
|
|
37
|
+
"gitignore": "^0.7.0",
|
|
38
|
+
"mrm": "^4.0.0",
|
|
39
|
+
"popmotion": "^9.3.6",
|
|
40
|
+
"react": "^17.0.2",
|
|
41
|
+
"svg-path-properties": "^1.0.11",
|
|
42
|
+
"svg-points": "^6.0.1",
|
|
43
|
+
"yarn": "^1.22.19"
|
|
44
|
+
},
|
|
45
|
+
"config": {
|
|
46
|
+
"commitizen": {
|
|
47
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"standard-version": {
|
|
51
|
+
"skip": {
|
|
52
|
+
"commit": true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|