Vue 中 Echarts实现三角锥形柱形图

前言

记录在 vue 中实现echarts 实现三角锥形柱形图效果


本文使用 echarts 为 5.x 版本

一、效果展示

三角锥形柱形图实现效果
在这里插入图片描述

二、echarts图表配置

dom 中使用、初始化
echarts 下载、使用 点击此处查看

废话不多说,直接上option配置

let option = {
      grid: {
        top: 30,
        bottom: 20
      },
      xAxis: [
        {
          data: [
            "2月1日",
            "2月2日",
            "2月3日",
            "2月4日",
            "2月5日",
            "2月6日",
            "2月7日"
          ],
          axisLabel: {
            color: "#fff",
            fontSize: 10
          },
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          }
        }
      ],
      yAxis: [
        {
          name: "(个)",
          nameTextStyle: {
            color: "#8CB5E2"
          },
          splitLine: {
            show: true,
            lineStyle: {
              type: "dashed",
              color: "#182450"
            }
          },
          axisLabel: {
            color: "#8CB5E2"
          }
        }
      ],
      // 使用内部缩放(滚轮缩放、鼠标拖着左右滑动)
      dataZoom: [
        {
          type: "inside",
          minValueSpan: 6, // 最小展示数
		  start: 0, // 开始展示位置(默认)
		  end: 5 // 结束展示位置 (默认)
        }
      ],
      series: [
        {
          name: "hill",
          // 象柱形图
          type: "pictorialBar",
          // 同一系列的柱间距离
          barCategoryGap: "-60%",
          // 自定义svg 图标 (三角锥形的关键)
          symbol: "path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z",
          // 默认样式
          itemStyle: {
            label: {
              show: false
            },
            borderColor: "#206fde",
            borderWidth: 2,
            color: {
              colorStops: [
                {
                  offset: 0,
                  color: "rgba(0,238,255, 0.09)"
                },
                {
                  offset: 1,
                  color: "rgba(29,111,218, 0.5)"
                }
              ]
            }
          },
          // 鼠标滑过样式
          emphasis: {
            label: {
              show: true,
              position: "top",
              color: "#12DCFF"
            },
            itemStyle: {
              borderColor: "#17cdfa",
              borderWidth: 2,
              color: {
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(0,238,255, 0.09)"
                  },
                  {
                    offset: 1,
                    color: "rgba(23,205,250, 0.5)"
                  }
                ]
              }
            }
          },
          data: [
            15,
            18,
            12,
            23,
            56,
            78,
            34
          ],
          z: 10
        }
      ]
    }

总结

以上就是今天要讲的内容,本文仅仅简单介绍了实现三角锥形柱形图的使用,如果想使用更炫酷的效果请查看 官网API文档

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值