vue3之echarts柱状图-圆锥加自动轮播

vue3之echarts柱状图-圆锥加自动轮播

效果:

在这里插入图片描述

版本
"echarts": "5.4.2"

核心代码:

<template>
    <div ref="echartRef" class="chart"></div>
    <svg>
        <linearGradient v-for="(item, i) in colors" :id="`lab${i}`" :key="i" x1="0" y1="0" x2="0" y2="1">
            <stop offset="38%" stop-color="#ffffff"></stop>
            <stop offset="100%" :stop-color="item"></stop>
        </linearGradient>
        <linearGradient v-for="(item, i) in colors" :id="`area${i}`" :key="`area${i}`" x1="0" y1="1" x2="0" y2="0">
            <stop offset="0%" stop-color="transparent"></stop>
            <stop offset="30%" :stop-color="item"></stop>
        </linearGradient>
    </svg>
</template>

<script setup lang="ts">
import {
   
    onMounted, reactive, onUnmounted, ref, nextTick } from 'vue';
import * as echarts from 'echarts';

// 颜色配置
const colors = ['rgba(255, 145, 56, 1)', 'rgba(252, 219, 31, 1)', 'rgba(91, 251, 223, 1)', 'rgba(16, 178, 255, 1)'];
const info = reactive({
   
   
    curData: [
        {
   
   
            name: '渝',
            value: '5978',
        },
        {
   
   
            name: '豫',
            value: '5806',
        },
        {
   
   
            name: '冀',
            value: '4947',
        },
        {
   
   
            name: '苏',
            value: '2942',
        },
        {
   
   
            name: '鲁',
            value: '2678',
        },
        {
   
   
            name: '晋',
            value: '2621',
        },
        {
   
   
            name: '陕',
            value: '1944',
        },
        {
   
   
            name: '鄂',
            value: '1551',
        },
        {
   
   
            name: '皖',
            value
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值