@easyv/charts 1.2.9 → 1.2.12
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/BaseLine.js +0 -1
- package/lib/components/CartesianChart.js +6 -5
- package/lib/components/ConicalGradient.js +6 -1
- package/lib/components/Marquee.js +21 -24
- package/lib/components/PieChart.js +1 -2
- package/package.json +1 -1
- package/src/components/BaseLine.js +0 -1
- package/src/components/CartesianChart.js +1 -1
- package/src/components/ConicalGradient.js +1 -1
- package/src/components/Marquee.js +18 -17
- package/src/components/PieChart.js +1 -1
|
@@ -49,7 +49,6 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
49
49
|
yScaler = _ref.yAxis.scaler,
|
|
50
50
|
data = _ref.data;
|
|
51
51
|
if (!data.value) return null;
|
|
52
|
-
console.log(orientation, 'orientation');
|
|
53
52
|
var x1 = orientation == 'left' ? yScaler(data.value) : marginLeft,
|
|
54
53
|
x2 = orientation == 'left' ? yScaler(data.value) : width - marginRight,
|
|
55
54
|
y1 = orientation == 'left' ? marginLeft : yScaler(data.value),
|
|
@@ -46,11 +46,12 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
46
46
|
series = _ref$config.series,
|
|
47
47
|
tooltip = _ref$config.tooltip,
|
|
48
48
|
_ref$config$baseLine = _ref$config.baseLine,
|
|
49
|
-
|
|
50
|
-
_ref$config$baseLine$
|
|
51
|
-
|
|
52
|
-
_ref$config$baseLine$2
|
|
53
|
-
|
|
49
|
+
_ref$config$baseLine$ = _ref$config$baseLine.orientation,
|
|
50
|
+
baseLineOri = _ref$config$baseLine$ === void 0 ? '' : _ref$config$baseLine$,
|
|
51
|
+
_ref$config$baseLine$2 = _ref$config$baseLine.config,
|
|
52
|
+
baseLineConfig = _ref$config$baseLine$2 === void 0 ? {} : _ref$config$baseLine$2,
|
|
53
|
+
_ref$config$baseLine$3 = _ref$config$baseLine.data,
|
|
54
|
+
baseLineData = _ref$config$baseLine$3 === void 0 ? [] : _ref$config$baseLine$3,
|
|
54
55
|
_ref$config$tooltip = _ref$config.tooltip;
|
|
55
56
|
_ref$config$tooltip = _ref$config$tooltip === void 0 ? {} : _ref$config$tooltip;
|
|
56
57
|
var _ref$config$tooltip$c = _ref$config$tooltip.config,
|
|
@@ -233,7 +233,12 @@ ConicalGradient.prototype = {
|
|
|
233
233
|
b1 = currentColor.b;
|
|
234
234
|
a1 = currentColor.a;
|
|
235
235
|
if (!a1 && a1 !== 0) a1 = 1;
|
|
236
|
-
nextColor = colors[currentColorIndex]
|
|
236
|
+
nextColor = colors[currentColorIndex] || {
|
|
237
|
+
r: 0,
|
|
238
|
+
g: 0,
|
|
239
|
+
b: 0,
|
|
240
|
+
a: 1
|
|
241
|
+
};
|
|
237
242
|
r2 = nextColor.r;
|
|
238
243
|
g2 = nextColor.g;
|
|
239
244
|
b2 = nextColor.b;
|
|
@@ -9,8 +9,6 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
12
|
var _react = require("react");
|
|
15
13
|
|
|
16
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -27,33 +25,32 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
27
25
|
_props$speed = props.speed,
|
|
28
26
|
speed = _props$speed === void 0 ? 5 : _props$speed;
|
|
29
27
|
var dom = (0, _react.useRef)(null);
|
|
30
|
-
var content = (0, _react.useRef)(null);
|
|
31
|
-
var duration = (0, _react.useRef)(1); //dom和content盒子对象,避免speed变化时重新获取盒子对象
|
|
28
|
+
var content = (0, _react.useRef)(null); //dom和content盒子对象,避免speed变化时重新获取盒子对象
|
|
32
29
|
|
|
33
30
|
var domRect = (0, _react.useRef)(null);
|
|
34
|
-
var contentRect = (0, _react.useRef)(null);
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
contentRect.current = content_.getBoundingClientRect();
|
|
47
|
-
|
|
48
|
-
if (domRect.current.width < contentRect.current.width) {
|
|
49
|
-
setTextList([value, value]);
|
|
31
|
+
var contentRect = (0, _react.useRef)(null); //文本变化时,需要重新计算dom和content的宽高
|
|
32
|
+
|
|
33
|
+
var textList = (0, _react.useMemo)(function () {
|
|
34
|
+
if (dom.current && content.current) {
|
|
35
|
+
var dom_ = dom.current;
|
|
36
|
+
domRect.current = dom_.getBoundingClientRect();
|
|
37
|
+
var content_ = content.current;
|
|
38
|
+
contentRect.current = content_.getBoundingClientRect();
|
|
39
|
+
|
|
40
|
+
if (domRect.current.width < contentRect.current.width) {
|
|
41
|
+
return [value, value];
|
|
42
|
+
}
|
|
50
43
|
}
|
|
44
|
+
|
|
45
|
+
return [value];
|
|
51
46
|
}, [value]); //value和speed变化时,直接更新duration
|
|
52
47
|
|
|
53
|
-
(0, _react.
|
|
54
|
-
if (domRect.current.width < contentRect.current.width) {
|
|
55
|
-
|
|
48
|
+
var duration = (0, _react.useMemo)(function () {
|
|
49
|
+
if (domRect.current && contentRect.current && domRect.current.width < contentRect.current.width) {
|
|
50
|
+
return contentRect.current.width / domRect.current.width / speed * 10;
|
|
56
51
|
}
|
|
52
|
+
|
|
53
|
+
return 5;
|
|
57
54
|
}, [speed]); //在head标签中注入keyframes动画
|
|
58
55
|
|
|
59
56
|
(0, _react.useEffect)(function () {
|
|
@@ -88,7 +85,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
88
85
|
animationName: 'md_marquee',
|
|
89
86
|
animationTimingFunction: 'linear',
|
|
90
87
|
animationIterationCount: 'infinite',
|
|
91
|
-
animationDuration: duration
|
|
88
|
+
animationDuration: duration + 's'
|
|
92
89
|
} : {},
|
|
93
90
|
ref: itemIndex == 0 ? content : null
|
|
94
91
|
}, "\xA0", item);
|
|
@@ -390,7 +390,6 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
390
390
|
|
|
391
391
|
var arcs = arcsFunc(data);
|
|
392
392
|
var legendDataWithPercent = (0, _utils.getDataWithPercent)(arcs, legendPrecision);
|
|
393
|
-
console.log(legendDataWithPercent);
|
|
394
393
|
|
|
395
394
|
var _legendDataWithPercent = (0, _utils.sortPie)(legendDataWithPercent, order);
|
|
396
395
|
|
|
@@ -627,7 +626,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
627
626
|
fill: 'url(#' + id + ')',
|
|
628
627
|
fillOpacity: decorate2.opacity / 100
|
|
629
628
|
}), //类目文本
|
|
630
|
-
categoryText && categoryText.show && /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
629
|
+
value && categoryText && categoryText.show && /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
631
630
|
onClick: onClick,
|
|
632
631
|
onMouseEnter: onMouseEnter,
|
|
633
632
|
onMouseLeave: onMouseLeave,
|
package/package.json
CHANGED
|
@@ -38,7 +38,6 @@ export default memo(
|
|
|
38
38
|
data
|
|
39
39
|
}) => {
|
|
40
40
|
if (!data.value) return null;
|
|
41
|
-
console.log(orientation, 'orientation')
|
|
42
41
|
const x1 = orientation == 'left' ? yScaler(data.value) : marginLeft,
|
|
43
42
|
x2 = orientation == 'left' ? yScaler(data.value) : width - marginRight,
|
|
44
43
|
y1 = orientation == 'left' ? marginLeft : yScaler(data.value),
|
|
@@ -217,7 +217,7 @@ ConicalGradient.prototype = {
|
|
|
217
217
|
a1 = currentColor.a;
|
|
218
218
|
if (!a1 && a1 !== 0) a1 = 1;
|
|
219
219
|
|
|
220
|
-
nextColor = colors[currentColorIndex];
|
|
220
|
+
nextColor = colors[currentColorIndex] || {r:0,g:0,b:0,a:1};
|
|
221
221
|
r2 = nextColor.r;
|
|
222
222
|
g2 = nextColor.g;
|
|
223
223
|
b2 = nextColor.b;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, memo, useRef, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* 文字跑马灯组件
|
|
@@ -14,29 +14,30 @@ export default memo((props) => {
|
|
|
14
14
|
|
|
15
15
|
const dom = useRef(null);
|
|
16
16
|
const content = useRef(null);
|
|
17
|
-
const duration = useRef(1);
|
|
18
17
|
//dom和content盒子对象,避免speed变化时重新获取盒子对象
|
|
19
18
|
const domRect = useRef(null);
|
|
20
19
|
const contentRect = useRef(null);
|
|
21
20
|
|
|
22
|
-
const [textList, setTextList] = useState([value]);
|
|
23
|
-
|
|
24
21
|
//文本变化时,需要重新计算dom和content的宽高
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
const textList = useMemo(()=>{
|
|
23
|
+
if(dom.current && content.current){
|
|
24
|
+
const dom_ = dom.current;
|
|
25
|
+
domRect.current = dom_.getBoundingClientRect();
|
|
26
|
+
let content_ = content.current;
|
|
27
|
+
contentRect.current = content_.getBoundingClientRect();
|
|
28
|
+
if (domRect.current.width < contentRect.current.width) {
|
|
29
|
+
return [value, value];
|
|
30
|
+
}
|
|
32
31
|
}
|
|
33
|
-
|
|
32
|
+
return [value];
|
|
33
|
+
},[value])
|
|
34
|
+
|
|
34
35
|
//value和speed变化时,直接更新duration
|
|
35
|
-
|
|
36
|
-
if (domRect.current.width < contentRect.current.width) {
|
|
37
|
-
|
|
38
|
-
(contentRect.current.width / domRect.current.width / speed) * 10;
|
|
36
|
+
const duration = useMemo(() => {
|
|
37
|
+
if (domRect.current && contentRect.current && domRect.current.width < contentRect.current.width) {
|
|
38
|
+
return (contentRect.current.width / domRect.current.width / speed) * 10;
|
|
39
39
|
}
|
|
40
|
+
return 5
|
|
40
41
|
}, [speed]);
|
|
41
42
|
//在head标签中注入keyframes动画
|
|
42
43
|
useEffect(() => {
|
|
@@ -78,7 +79,7 @@ export default memo((props) => {
|
|
|
78
79
|
animationName: 'md_marquee',
|
|
79
80
|
animationTimingFunction: 'linear',
|
|
80
81
|
animationIterationCount: 'infinite',
|
|
81
|
-
animationDuration: duration
|
|
82
|
+
animationDuration: duration + 's',
|
|
82
83
|
}
|
|
83
84
|
: {}
|
|
84
85
|
}
|