Appearance
填充雷达
功能说明(What)
填充雷达通过区域填充强调覆盖范围,适合展示整体水平对比。
应用场景(When)
- 能力覆盖范围展示
- 方案对比与差异强调
快速上手(How - Quick)
ts
import { BaseRadar } from '@ymhc/harmonycharts';
import type { BaseRadarConfig } from '@ymhc/harmonycharts';
@Entry
struct Index {
@Prop baseRadarConfig: BaseRadarConfig = {
indicators: [
{ name: 'Speed', max: 100 },
{ name: 'Quality', max: 100 },
{ name: 'Reliability', max: 100 },
{ name: 'Flexibility', max: 100 },
{ name: 'Cost', max: 100 }
],
data: [
{ name: 'Plan', value: [70, 80, 65, 75, 60], areaStyle: { color: 'rgba(84,112,198,0.25)' } }
],
tooltip: { show: true, trigger: 'item', confine: true },
legend: { show: true }
};
build() {
Column() {
BaseRadar({ config: this.baseRadarConfig, chartHeight: 240 })
}
}
}运行结果
完整示例配置(整页可用)
ts
const option: HarmonyChartsOption = {
radar: {
indicator: [
{ name: 'Speed', max: 100 },
{ name: 'Quality', max: 100 },
{ name: 'Reliability', max: 100 },
{ name: 'Flexibility', max: 100 },
{ name: 'Cost', max: 100 }
],
center: ['50%', '50%'],
radius: '70%'
},
tooltip: { show: true, trigger: 'item', confine: true },
legend: { show: true },
series: [{ type: 'radar', name: 'Radar', data: [{ name: 'Plan', value: [70, 80, 65, 75, 60], areaStyle: { color: 'rgba(84,112,198,0.25)' } }] }]
};默认值(精确工程默认)
该页面默认值与 BaseRadar 一致,详见总览页「默认值(精确工程默认)」。
配置项说明(API)
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| areaStyle | 填充样式 | AreaStyleOption | - |
| lineStyle | 线样式 | LineStrokeStyle | - |
事件与交互(Events)
ts
chart.on('click', (params) => {
// params.seriesType === 'radar'
});高级用法(Advanced)
- 多系列填充对比
注意事项 / 设计说明(Notes)
- 填充透明度建议保持 0.2~0.4。