vue3+echarts 立体柱状效果

vue3+echarts 立体柱状效果

废话不多说,直接上代码 就两步,直接复制粘贴一手

 <div id="main" class="chart" ref="chartDom"></div>
import * as echarts from 'echarts';
type EChartsOption = echarts.EChartsOption;
var chartDom = document.getElementById('main');
var option: EChartsOption;

option = {
   
  tooltip: {
   
    trigger: 'axis',
    axisPointer: {
   
      type: 'shadow'
    }
  },
  grid: {
   
    top: '10%',
    left: '3%',
    right: '4%',
    bottom: '10%',
    containLabel: true
  },
  xAxis: [
    {
   
      type: 'category',
      data: ['天', '大', '1', '2', '3'],
      axisTick: {
   
        alignWithLabel: true
      },
      axisLabel: {
   
        color: '#ffffff',
        fontSize: 16
      }
    }
  ],
  yAxis: [
    {
   
      type: 'value',
      interval: 20,
      axisLabel: {
   
        color: '#ffffff',
        fontSize: 16
      }
    },

  ],
  series: [
    {
   
      name: 'Direct',
      type: 'bar',
      data: [20, 42, 36, 50, 53],
      barGap: 0,
      barWidth: 13,
      label: {
   
        normal: {
   
          show: false,
          position: "insideRight"
        }
      },
      itemStyle: {
   
        normal: {
   
          color: new echarts.graphic.LinearGradient(
            0, 0, 0, 1,
            [
              {
    offset: 0, color: '#8c40dc' },     //柱状图从左向右颜色渐变
              {
    offset: 1, color: '#1e2a4c' }
            ]
          ),
        }
      },
    },
    {
   
      name: 'Direct',
      type: 'bar',
      barWidth: 16,
      data: [20, 42, 36, 50, 53],
      tooltip: {
   
        show: false
      },
      label: {
   
        normal: {
   
          show: false,
          position: "insideRight"
        }
      },
      itemStyle: {
   
        normal: {
   
          color: "#502f92"
        }
      },
    }, {
   
      name: 'Direct',
      barWidth: 22,
      data: [20, 42, 36, 50, 53],
      type: "pictorialBar", // 长方体顶部四边形
      symbol: 'diamond',
      symbolRotate: 0,
      symbolSize: ['28', '10'],
      symbolOffset: ['0', '-5'],
      symbolPosition: 'end',
      z: 3, // 顶部四边形
      tooltip: {
   
        show: false
      },
      label: {
   
        normal: {
   
          show: false,
          position: "insideRight"
        }
      },
      itemStyle: {
   
        normal: {
   
          color: "#761c9a"
        }
      },
    },

  ]
};
onMounted(() => {
   
  var myChart = echarts.init(chartDom);
  option && myChart.setOption(option);
})

在这里插入图片描述

相关推荐

  1. vue运用之echart3D效果案例代码

    2023-12-17 05:44:02       45 阅读

最近更新

  1. TCP协议是安全的吗?

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

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

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

    2023-12-17 05:44:02       20 阅读

热门阅读

  1. spark-常用算子

    2023-12-17 05:44:02       28 阅读
  2. 贪吃蛇小游戏

    2023-12-17 05:44:02       35 阅读
  3. Python基础:概述

    2023-12-17 05:44:02       35 阅读
  4. K8S(六)—kubectl

    2023-12-17 05:44:02       38 阅读
  5. kafka3.0创建topic出现zookeeper is not a recognized option

    2023-12-17 05:44:02       43 阅读
  6. ZooKeeper

    ZooKeeper

    2023-12-17 05:44:02      45 阅读
  7. Python基础03-循环结构

    2023-12-17 05:44:02       34 阅读
  8. NPM的介绍及使用详解

    2023-12-17 05:44:02       41 阅读
  9. git常用命令

    2023-12-17 05:44:02       41 阅读
  10. git各分支简介

    2023-12-17 05:44:02       39 阅读
  11. 开源的Spring Boot学习资源

    2023-12-17 05:44:02       32 阅读
  12. 计算机网络高频判断题

    2023-12-17 05:44:02       34 阅读
  13. 嵌入式应用中的复选框控件实现

    2023-12-17 05:44:02       43 阅读