Spaces:
Sleeping
Sleeping
Download src/components/RadarChart.jsx from tryprogram/offer-puplayer: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/tryprogram/offer-puplayer/resolve/main/src/components/RadarChart.jsx
- Command line
-
hf download hf://spaces/tryprogram/offer-puplayer/src/components/RadarChart.jsx
-
curl -L -o RadarChart.jsx https://huggingface.co/spaces/tryprogram/offer-puplayer/resolve/main/src/components/RadarChart.jsx
1.26 kB
| import ReactECharts from 'echarts-for-react' | |
| function RadarChart({ dimensions = [], scores = [], loading = false }) { | |
| if (loading) { | |
| return ( | |
| <div className="loading-state" style={{ height: 320 }}> | |
| <div className="loading-spinner loading-spinner-lg" /> | |
| <p className="text-secondary mt-16">加载中...</p> | |
| </div> | |
| ) | |
| } | |
| const isEmpty = !dimensions.length || !scores.length || scores.every((s) => s === 0) | |
| if (isEmpty) { | |
| return ( | |
| <div className="flex-center" style={{ height: 320 }}> | |
| <p className="text-secondary">图表数据暂不可用</p> | |
| </div> | |
| ) | |
| } | |
| 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 ( | |
| <div style={{ height: 320 }}> | |
| <ReactECharts option={option} style={{ height: '100%' }} /> | |
| </div> | |
| ) | |
| } | |
| export default RadarChart | |