Skip to content

DoughnutChart 环形图

基于 ECharts 封装的环形图(空心饼图)组件。

基础用法

vue
<script setup>
import { doughnutChart } from '@twi1i9ht/visual-lib'

const data = [
  { value: 1048, name: '搜索引擎' },
  { value: 735, name: '直接访问' },
  { value: 580, name: '邮件营销' },
]
</script>

<template>
  <doughnutChart :data="data" title="流量来源" />
</template>

自定义内外半径

vue
<template>
  <doughnutChart :data="data" :inner-radius="'40%'" :outer-radius="'70%'" />
</template>

Props

属性类型默认值说明
dataArray<{ value: number, name: string }>数据数组
titlestring图表标题
innerRadiusstring'40%'内半径
outerRadiusstring'70%'外半径
showLabelbooleantrue是否显示标签
showTooltipbooleantrue是否显示提示框
showLegendbooleantrue是否显示图例
optionEChartsOption高级配置

Released under the MIT License.