环形图演示
参考配置
基础圆环图
html
<template>
<view class="container">
<t-xcharts
ref="chart"
:option="chartOption"
></t-xcharts>
</view>
</template>
<script setup>
import { ref } from 'vue';
const chartOption = ref({
type: 'ring',
animation: true,
dataLabel: true,
series: [{
name: '销量',
data: [
{ value: 35, name: '产品A', color: '#2979ff' },
{ value: 20, name: '产品B', color: '#19be6b' },
{ value: 25, name: '产品C', color: '#ff9800' },
{ value: 20, name: '产品D', color: '#f44336' }
]
}]
});
</script>配置说明
type
图表类型,设置为 'ring' 表示圆环图。
圆环图是饼状图的变体,中心留空,视觉效果更现代。配置方式与饼状图类似。