import ReactECharts from 'echarts-for-react'
function RadarChart({ dimensions = [], scores = [], loading = false }) {
if (loading) {
return (
)
}
const isEmpty = !dimensions.length || !scores.length || scores.every((s) => s === 0)
if (isEmpty) {
return (
)
}
const option = {
radar: {
indicator: dimensions.map((name) => ({ name, max: 100 })),
center: ['50%', '50%'],
radius: '65%',
},
series: [
{
type: 'radar',
data: [{ value: scores, name: '匹配得分' }],
areaStyle: { color: 'rgba(79, 70, 229, 0.2)' },
lineStyle: { color: '#4F46E5' },
itemStyle: { color: '#4F46E5' },
},
],
animationDuration: 1000,
animationEasing: 'cubicOut',
}
return (
)
}
export default RadarChart