Skip to content

3/4 注释环形图

示例

基础示例

vue
<script setup>
const data = [
  { name: 'Perez', value: 1321, unit: 'US' },
  { name: 'Harris', value: 4211, unit: 'US' },
  { name: 'Walker', value: 8171, unit: 'US' },
  { name: 'Davis', value: 12171, unit: 'US' },
]
</script>

<template>
  <div v-ec="['ringThreeQuarterComment', data]" style="width: 100%; height: 500px;" />
</template>

参数说明

索引类型必填默认值说明
0ringThreeQuarterComment--
1Data-数据
2OptionsdefaultOptions配置参数
3EcOptions-ECharts 配置参数

参数默认值

options

ts
const defaultOptions: Options = {
  colors: ['#FF8700', '#ffc300', '#00e473', '#009DFF', '#198754', '#0DCAF0'],
  textColors: {
    name: '#666',
    percent: '#333',
    value: '#333',
    unit: '#888',
  },
  ringBg: '#E3F0FF',
  lineWidth: 130,
  lineColor: 'rgba(0, 0, 0, 0.3)',
}

参数类型

Data

ts
export type Data = { name: string, value: number, unit: string }[]

Options

ts
export interface Options extends Record<string, unknown> {
  colors?: string[]
  ringBg?: string
  textColors?: {
    name?: string
    percent?: string
    value?: string
    unit?: string
  }
  lineWidth?: number
  lineColor?: string
}

EcOptions

ts
export type EcOptions = Partial<EChartsOption> | null

基于 MIT 许可发布