【Eachrts】水滴图

引入依赖

npm安装echarts、echarts-liquidfill插件

"echarts": "^5.4.2",
"echarts-liquidfill": "^3.1.0",

引入插件

import * as echarts from 'echarts';
import 'echarts-liquidfill';

示例

在这里插入图片描述

<template>
  <div class="LiquidChart">
    <div ref="liquid_chart" style="width: 500px; height: 500px; "></div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
import 'echarts-liquidfill';
export default {
   
  methods: {
   
    initLiquidChart1() {
   
      let chart = echarts.init(this.$refs.liquid_chart);
      let rateData = [0.365];
      let option = {
   
        title: [
          {
   
            text: '百分比',
            textAlign: 'center',
            top: '40%',
            left: '50%',
            textStyle: {
   
              color: '#8993A4',
              fontSize: 14,
            },
          },
        ],
        grid: {
   
          left: '0',
        },
        label: {
   
          formatter(params) {
   
            return (params.value * 100).toFixed(1) + '%';
          },
        },
        series: [
          {
   
            name: '百分比',
            type: 'liquidFill',
            data: rateData,
            label: {
   
              fontSize: 20,
              color: '#172B4D',
            },
            radius: '50%',
            //水波
            color: [
              new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
   
                  offset: 0,
                  color: '#E1EDFF',
                },
                {
   
                  offset: 1,
                  color: '#478EFB',
                },
              ]),
            ],
            itemStyle: {
   
              //opacity: 0.7, // 波浪的透明度
              shadowBlur: 0, // 波浪的阴影范围
            },
            // 外环
            outline: {
   
              borderDistance: 5,
              itemStyle: {
   
                borderWidth: 2,
                borderColor: '#A2C7FF',
              },
            },
            backgroundStyle: {
   
              color: '#FFFFFF',
            },
          },
        ],
      };
      chart.setOption(option);
    },
  },
  mounted() {
   
    this.initLiquidChart1();
  },
};
</script>

 

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2023-12-20 20:56:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-20 20:56:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-20 20:56:02       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-20 20:56:02       20 阅读

热门阅读

  1. 安装docker-compose

    2023-12-20 20:56:02       58 阅读
  2. 【运维日常】nginx 413 Request Entity Too Large

    2023-12-20 20:56:02       42 阅读
  3. Ansible

    2023-12-20 20:56:02       31 阅读
  4. C++常见STL容器基本用法

    2023-12-20 20:56:02       44 阅读
  5. 阶数RC低通滤波器详解及Matlab示例

    2023-12-20 20:56:02       41 阅读
  6. Python基础入门:语法与数据类型

    2023-12-20 20:56:02       41 阅读
  7. ARFoundation系列探索-第一人称视角技术编程

    2023-12-20 20:56:02       38 阅读