update pay function
This commit is contained in:
@@ -63,8 +63,7 @@
|
|||||||
"react-scroll": "^1.8.4",
|
"react-scroll": "^1.8.4",
|
||||||
"react-scroll-into-view": "^2.1.3",
|
"react-scroll-into-view": "^2.1.3",
|
||||||
"react-table": "^7.7.0",
|
"react-table": "^7.7.0",
|
||||||
"react-to-print": "^2.13.0",
|
"react-to-print": "^3.0.3",
|
||||||
"react-wordcloud": "^1.2.7",
|
|
||||||
"recharts": "^3.1.2",
|
"recharts": "^3.1.2",
|
||||||
"sass": "^1.49.9",
|
"sass": "^1.49.9",
|
||||||
"socket.io-client": "^4.7.4",
|
"socket.io-client": "^4.7.4",
|
||||||
|
|||||||
@@ -51,14 +51,15 @@ import {
|
|||||||
Treemap,
|
Treemap,
|
||||||
Area, AreaChart,
|
Area, AreaChart,
|
||||||
} from 'recharts';
|
} from 'recharts';
|
||||||
import ReactWordcloud from 'react-wordcloud';
|
import ReactECharts from 'echarts-for-react';
|
||||||
|
import 'echarts-wordcloud';
|
||||||
// 颜色配置
|
// 颜色配置
|
||||||
const CHART_COLORS = [
|
const CHART_COLORS = [
|
||||||
'#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD',
|
'#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD',
|
||||||
'#D4A5A5', '#9B6B6B', '#E9967A', '#B19CD9', '#87CEEB'
|
'#D4A5A5', '#9B6B6B', '#E9967A', '#B19CD9', '#87CEEB'
|
||||||
];
|
];
|
||||||
|
|
||||||
// 词云图组件
|
// 词云图组件(使用 ECharts Wordcloud)
|
||||||
const WordCloud = ({ data }) => {
|
const WordCloud = ({ data }) => {
|
||||||
if (!data || data.length === 0) {
|
if (!data || data.length === 0) {
|
||||||
return (
|
return (
|
||||||
@@ -71,32 +72,51 @@ const WordCloud = ({ data }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const words = data.slice(0, 100).map(item => ({
|
const words = data.slice(0, 100).map(item => ({
|
||||||
text: item.name || item.text,
|
name: item.name || item.text,
|
||||||
value: item.value || item.count || 1
|
value: item.value || item.count || 1
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const options = {
|
const option = {
|
||||||
rotations: 2,
|
tooltip: {
|
||||||
rotationAngles: [-90, 0],
|
show: true
|
||||||
fontFamily: 'Microsoft YaHei, sans-serif',
|
},
|
||||||
fontSizes: [16, 80],
|
series: [{
|
||||||
fontWeight: 'bold',
|
type: 'wordCloud',
|
||||||
padding: 3,
|
shape: 'circle',
|
||||||
scale: 'sqrt',
|
left: 'center',
|
||||||
};
|
top: 'center',
|
||||||
|
width: '100%',
|
||||||
const callbacks = {
|
height: '100%',
|
||||||
getWordColor: () => {
|
sizeRange: [16, 80],
|
||||||
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD'];
|
rotationRange: [-90, 0],
|
||||||
return colors[Math.floor(Math.random() * colors.length)];
|
rotationStep: 90,
|
||||||
}
|
gridSize: 8,
|
||||||
|
drawOutOfBound: false,
|
||||||
|
layoutAnimation: true,
|
||||||
|
textStyle: {
|
||||||
|
fontFamily: 'Microsoft YaHei, sans-serif',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
color: function () {
|
||||||
|
const colors = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEEAD'];
|
||||||
|
return colors[Math.floor(Math.random() * colors.length)];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
emphasis: {
|
||||||
|
focus: 'self',
|
||||||
|
textStyle: {
|
||||||
|
textShadowBlur: 10,
|
||||||
|
textShadowColor: '#333'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: words
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ReactWordcloud
|
<ReactECharts
|
||||||
words={words}
|
option={option}
|
||||||
options={options}
|
style={{ height: '400px', width: '100%' }}
|
||||||
callbacks={callbacks}
|
opts={{ renderer: 'canvas' }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user