Appearance
水球图
3D 水球图用于展示百分比数据,具有动态的水波效果,适合展示进度、完成率等指标。
快速开始
vue
<template>
<RayLiquid :option="chartOption" />
</template>
<script setup>
import { ref } from 'vue'
import { RayLiquid } from 'raychart'
const chartOption = ref({
series: [{
data: [{ value: 0.6, name: '完成率' }],
radius: 7
}]
})
</script>数据格式
水球图的 value 为 0-1 之间的小数,表示百分比(0.6 = 60%)。
核心配置
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
radius | number | 7 | 水球半径 |
itemStyle.waveScale | number | 0.05 | 波浪幅度 |
itemStyle.waveSpeed | number | 0.06 | 波浪速度 |
itemStyle.opacity | number | 0.9 | 透明度 |
常见场景
自定义波浪效果
vue
<script setup>
const chartOption = ref({
series: [{
data: [{ value: 0.75, name: '项目进度' }],
radius: 8,
itemStyle: {
waveScale: 0.08, // 增大波浪幅度
waveSpeed: 0.1, // 加快波浪速度
opacity: 0.85
}
}]
})
</script>多个水球对比
vue
<template>
<div style="display: flex; gap: 20px;">
<RayLiquid :option="option1" width="300px" height="400px" />
<RayLiquid :option="option2" width="300px" height="400px" />
<RayLiquid :option="option3" width="300px" height="400px" />
</div>
</template>
<script setup>
const option1 = ref({
series: [{ data: [{ value: 0.6, name: '任务A' }], radius: 6 }]
})
const option2 = ref({
series: [{ data: [{ value: 0.8, name: '任务B' }], radius: 6 }]
})
const option3 = ref({
series: [{ data: [{ value: 0.45, name: '任务C' }], radius: 6 }]
})
</script>组件属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
option | RayChartOption | - | 图表配置对象(必填) |
width | string | number | '100%' | 图表宽度 |
height | string | number | '600px' | 图表高度 |
