玫瑰图演示
参考配置
基础玫瑰图
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: 'rose',
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
图表类型,设置为 'rose' 表示玫瑰图。
玫瑰图是饼状图的极坐标版本,适合展示周期性数据。配置方式与饼状图类似。