<template>
    <v-chart
        class="flex-1"
        ref="saleChartRef"
        style="height: 420px"
        :option="options"
    />
</template>
<script setup>
    import VChart from 'vue-echarts';
    import { use } from 'echarts/core';
    import { CanvasRenderer } from 'echarts/renderers';
    import { PieChart } from 'echarts/charts';
    import {
        GridComponent,
        TooltipComponent,
        LegendComponent,
        TitleComponent
    } from 'echarts/components';

    // 按需加载echarts
    use([
        CanvasRenderer,
        PieChart,
        GridComponent,
        TooltipComponent,
        LegendComponent,
        TitleComponent
    ]);

    const options = reactive({
        title: {
            text: '多本回收占比',
            textStyle: {
                color: '#363636',
                fontSize: 14,
                fontWeight: 'normal'
            }
        },
        legend: {
            right: 'right',
            orient: 'vertical',
            top: 'center'
        },
        series: [
            {
                name: '多本回收占比',
                type: 'pie',
                radius: [50, 150],
                center: ['50%', '50%'],
                roseType: 'area',
                itemStyle: {
                    borderRadius: 8
                },
                data: [
                    { value: 40, name: '中等' },
                    { value: 38, name: '良好' },
                    { value: 32, name: '极差' }
                ]
            }
        ]
    });
</script>
