Appearance
折线图
3D 折线图展示数据随时间或类别的变化趋势,通过立体线条和数据点呈现连续变化。
快速开始
vue
<template>
<RayLine :option="chartOption" />
</template>
<script setup>
import { ref } from 'vue'
import { RayLine } from 'raychart'
const chartOption = ref({
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
lineStyle: { width: 0.3 },
smooth: true
}],
xAxis3D: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}
})
</script>核心配置
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
lineStyle.width | number | 0.5 | 线条粗细(3D 管道的半径) |
lineStyle.color | string | 自动分配 | 线条颜色 |
smooth | boolean | true | 是否平滑曲线;false 时渲染为直线折线 |
pointStyle.size | number | 线条半径 × 1.5 | 数据点球体大小 |
pointStyle.color | string | 线条颜色变体 | 数据点颜色 |
areaStyle.color | string | 线条颜色 | 是否渲染区域填充(配置即启用) |
series.label | object | 不显示 | 数据点标签 |
常见场景
平滑曲线与区域填充
vue
<script setup>
const chartOption = ref({
series: [{
data: [120, 200, 150, 80, 70, 110, 130],
smooth: true, // 平滑曲线(默认)
lineStyle: { width: 0.3, color: '#5470c6' }, // 线条粗细与颜色
pointStyle: { size: 0.8 }, // 数据点大小
areaStyle: { color: 'rgba(84, 112, 198, 0.25)' }, // 区域填充
label: { show: true, fontSize: 12 } // 数据点标签
}],
xAxis3D: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
}
})
</script>多系列支持
与柱状图一致,RayLine 只渲染 series[0],暂不支持同图多系列;多组数据请拆分为多个图表展示。
组件属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
option | RayChartOption | - | 图表配置对象(必填) |
width | string | number | '100%' | 图表宽度 |
height | string | number | '600px' | 图表高度 |
