onesight-charts 0.2.5 → 0.2.7
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.
|
@@ -82,7 +82,7 @@ function HorizontalBar(props) {
|
|
|
82
82
|
}
|
|
83
83
|
item.rate = rate;
|
|
84
84
|
});
|
|
85
|
-
callbackGetPage(
|
|
85
|
+
callbackGetPage(currentPage);
|
|
86
86
|
setBarData(splice_data);
|
|
87
87
|
}, [currentPage, JSON.stringify(data)]);
|
|
88
88
|
var handlePopoverMouseEnter = function handlePopoverMouseEnter(index) {
|
|
@@ -9,8 +9,16 @@ function WordCloud(props) {
|
|
|
9
9
|
smallSize = _props$smallSize === void 0 ? false : _props$smallSize,
|
|
10
10
|
_props$tooltipShow = props.tooltipShow,
|
|
11
11
|
tooltipShow = _props$tooltipShow === void 0 ? true : _props$tooltipShow,
|
|
12
|
+
_props$width = props.width,
|
|
13
|
+
width = _props$width === void 0 ? '100%' : _props$width,
|
|
14
|
+
_props$height = props.height,
|
|
15
|
+
height = _props$height === void 0 ? '312px' : _props$height,
|
|
12
16
|
_props$tooltipName = props.tooltipName,
|
|
13
|
-
tooltipName = _props$tooltipName === void 0 ? '提及数' : _props$tooltipName
|
|
17
|
+
tooltipName = _props$tooltipName === void 0 ? '提及数' : _props$tooltipName,
|
|
18
|
+
_props$color = props.color,
|
|
19
|
+
color = _props$color === void 0 ? '#1DA9A0' : _props$color,
|
|
20
|
+
_props$onClick = props.onClick,
|
|
21
|
+
onClick = _props$onClick === void 0 ? function () {} : _props$onClick;
|
|
14
22
|
var chartRef = useRef();
|
|
15
23
|
useEffect(function () {
|
|
16
24
|
createChart();
|
|
@@ -31,7 +39,7 @@ function WordCloud(props) {
|
|
|
31
39
|
left: 'center',
|
|
32
40
|
top: 'center',
|
|
33
41
|
width: smallSize ? '90%' : '100%',
|
|
34
|
-
height: '
|
|
42
|
+
height: '95%',
|
|
35
43
|
right: null,
|
|
36
44
|
bottom: null,
|
|
37
45
|
sizeRange: smallSize ? [15, 40] : [18, 80],
|
|
@@ -43,7 +51,7 @@ function WordCloud(props) {
|
|
|
43
51
|
textStyle: {
|
|
44
52
|
fontFamily: 'Verdana',
|
|
45
53
|
fontWeight: 500,
|
|
46
|
-
color:
|
|
54
|
+
color: color
|
|
47
55
|
},
|
|
48
56
|
emphasis: {
|
|
49
57
|
focus: 'self'
|
|
@@ -57,12 +65,17 @@ function WordCloud(props) {
|
|
|
57
65
|
}]
|
|
58
66
|
};
|
|
59
67
|
myChart.setOption(option);
|
|
68
|
+
// 取消监听点击事件,也可以防止重复绑定
|
|
69
|
+
myChart.off('click');
|
|
70
|
+
myChart.on('click', function (param) {
|
|
71
|
+
onClick(param);
|
|
72
|
+
});
|
|
60
73
|
};
|
|
61
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
75
|
ref: chartRef,
|
|
63
76
|
style: {
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
77
|
+
width: width,
|
|
78
|
+
height: height
|
|
66
79
|
}
|
|
67
80
|
});
|
|
68
81
|
}
|
|
@@ -42,14 +42,19 @@ function WordCloud(props) {
|
|
|
42
42
|
data,
|
|
43
43
|
smallSize = false,
|
|
44
44
|
tooltipShow = true,
|
|
45
|
-
|
|
45
|
+
width = "100%",
|
|
46
|
+
height = "312px",
|
|
47
|
+
tooltipName = "提及数",
|
|
48
|
+
color = "#1DA9A0",
|
|
49
|
+
onClick = () => {
|
|
50
|
+
}
|
|
46
51
|
} = props;
|
|
47
52
|
const chartRef = (0, import_react.useRef)();
|
|
48
53
|
(0, import_react.useEffect)(() => {
|
|
49
54
|
createChart();
|
|
50
55
|
}, [JSON.stringify(data)]);
|
|
51
56
|
const createChart = () => {
|
|
52
|
-
|
|
57
|
+
const myChart = echarts.init(chartRef.current);
|
|
53
58
|
const tooltipConfig = (0, import_tooltipConfig.createCustomTooltip)({
|
|
54
59
|
tooltipShow,
|
|
55
60
|
smallSize,
|
|
@@ -65,7 +70,7 @@ function WordCloud(props) {
|
|
|
65
70
|
left: "center",
|
|
66
71
|
top: "center",
|
|
67
72
|
width: smallSize ? "90%" : "100%",
|
|
68
|
-
height: "
|
|
73
|
+
height: "95%",
|
|
69
74
|
right: null,
|
|
70
75
|
bottom: null,
|
|
71
76
|
sizeRange: smallSize ? [15, 40] : [18, 80],
|
|
@@ -77,7 +82,7 @@ function WordCloud(props) {
|
|
|
77
82
|
textStyle: {
|
|
78
83
|
fontFamily: "Verdana",
|
|
79
84
|
fontWeight: 500,
|
|
80
|
-
color
|
|
85
|
+
color
|
|
81
86
|
},
|
|
82
87
|
emphasis: {
|
|
83
88
|
focus: "self"
|
|
@@ -92,7 +97,11 @@ function WordCloud(props) {
|
|
|
92
97
|
]
|
|
93
98
|
};
|
|
94
99
|
myChart.setOption(option);
|
|
100
|
+
myChart.off("click");
|
|
101
|
+
myChart.on("click", function(param) {
|
|
102
|
+
onClick(param);
|
|
103
|
+
});
|
|
95
104
|
};
|
|
96
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { ref: chartRef, style: { width
|
|
105
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: chartRef, style: { width, height } });
|
|
97
106
|
}
|
|
98
107
|
var word_cloud_default = WordCloud;
|