首页 > 其他分享 >柱状图-带边框柱状图

柱状图-带边框柱状图

时间:2023-07-20 17:36:17浏览次数:22  
标签:false show color true 边框 柱状图 rgba type

效果图:

 

代码:

const chart = this.refs.vChartRef.chart
function upOpt() {
  chart.setOption({
       tooltip: {
          trigger: "axis",
          show: true,
          backgroundColor: "rgba(0, 0, 0, 0.4)",
          borderColor: "transparent",
          padding: [5],
          axisPointer: {
            type: "none",
          },
          textStyle: {
            color: "#FFFFFF",
            fontSize: 14,
          },
        },
        legend: {
          show: true,
          top: 0,
          right: '3%',
          itemGap: 30,
          icon: "rect",
          itemWidth: 12,
          itemHeight: 12,
          textStyle: {
            fontSize: 14,
            fontFamily: "SourceHanSansCN-Regular",
            fontWeight: "normal",
            lineHeight: 22,
            color: "#FFFFFF",
          },
        },
        grid: {
          top: "18%",
          left: "9%",
          right: "4%",
          bottom: "11%",
        },
        xAxis: [
          {
            type: "category",
            axisLine: {
              show: true,
              lineStyle: {
                color: "#B3DFFF",
                width: 2, 
              },
            },
            axisLabel: {
              show: true,
              fontSize: 14,
              fontFamily: "SourceHanSansCN-Regular",
              fontWeight: "normal",
              color: "#D8D8D8",
              margin: 10,
            },
            splitLine: {
              show: false,
            },
            axisTick: {
              show: false,
              alignWithLabel: true,
            },
            boundaryGap: true,
            data: [
              "03/19",
              "03/20",
              "03/21",
              "03/22",
              "03/23",
              "03/24",
              "03/25",
            ],
          },
        ],

        yAxis: [
          {
            type: "value",
            name: "单位: 件",
            nameGap: 15,
            nameTextStyle: {
              fontSize: 14,
              fontFamily: "SourceHanSansCN-Normal",
              fontWeight: 400,
              color: "#D8D8D8",
            },
            splitLine: {
              show: true,
              lineStyle: {
                color: "#3D5266",
                type: "dashed",
              },
            },
            axisLine: {
              show: false,
              lineStyle: {
                color: "#B3DFFF",
              },
            },
            axisLabel: {
              show: true,
              fontSize: 14,
              fontFamily: "SourceHanSansCN-Regular",
              fontWeight: "normal",
              color: "#D8D8D8",
              margin: 10,
            },
            axisTick: {
              show: false,
            },
          },
        ],
        series: [
          {
            name: "维保费支出",
            type: "bar",
            barWidth: 10,
            label: {
              show: false,
            },
            itemStyle: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(247, 181, 0, 1)", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "rgba(247, 181, 0, 0)", // 100% 处的颜色
                  },
                ],
                global: false, // 缺省为 false
              },
              borderColor: "#F7B500",
              borderWidth: 1,
            },
            data: [40, 30, 50, 40, 35, 22, 56],
          },
          {
            name: "维保达成率",
            type: "bar",
            barWidth: 10,
            label: {
              show: false,
            },
            itemStyle: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(21,154,255,1)", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "rgba(21,154,255,0)", // 100% 处的颜色
                  },
                ],
                global: false, // 缺省为 false
              },
              borderColor: "#159AFF",
              borderWidth: 1,
            },
            data: [45, 20, 60, 40, 55, 32, 26],
          },
          {
            name: "即将到期",
            type: "bar",
            barWidth: 10,
            label: {
              show: false,
            },
            itemStyle: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(250, 81, 81, 1)", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "rgba(250, 81, 81, 0)", // 100% 处的颜色
                  },
                ],
                global: false, // 缺省为 false
              },
              borderColor: "rgba(250, 81, 81, 1)",
              borderWidth: 1,
            },
            data: [15, 10, 5, 10, 15, 12, 16],
          }
        ],
  })
}
setTimeout(upOpt, 0)

 

标签:false,show,color,true,边框,柱状图,rgba,type
From: https://www.cnblogs.com/a973692898/p/17569001.html

相关文章

  • 柱状图-渐变色-竖双柱状图
    效果图: chart.setOption({tooltip:{trigger:'axis',show:true,backgroundColor:'rgba(6,19,40,0.8)',borderColor:'transparent',padding:[8,20,8,8],textStyle:{color......
  • 柱状图-横向渐变色柱状图
    效果图: chart.setOption({tooltip:{trigger:'axis',show:true,backgroundColor:'rgba(10,30,30,0.8)',borderColor:'transparent',padding:[8,20,8,8],textStyle:{c......
  • 【echarts】柱状图上方显示数值
    使用官网的例子,只不过加了itemStyle属性<!DOCTYPEhtml><head> <metacharset="utf-8"> <title>ECharts</title></head><body> <!--为ECharts准备一个具备大小(宽高)的Dom--> <divid="main"style="width......
  • 代码随想录算法训练营第60天 | ● 84.柱状图中最大的矩形 - 第10章 动态规划part03
     第十章 单调栈part03有了之前单调栈的铺垫,这道题目就不难了。  ●  84.柱状图中最大的矩形   今天是训练营最后一天,恭喜坚持两个月的录友们,接下来可以写一篇自己 代码随想录一刷的总结。好好回顾一下,这两个月自己的博客内容,以及自己的收获。  ......
  • CSS中新增的样式:圆角边框、盒子阴影、文字阴影
    一:css新增样式之圆角边框(1)简介:在css3中新增加了圆角边框的样式,这样我们的盒子就可以变圆角了。border-radius属性用于设置元素的外边框圆角。(2)原理:radius半径(圆的半径)原理:(椭)圆与边框的交集形成圆角的效果。二:css新增样式之盒子阴影(1)简介:css3中新增加了盒子阴影,我们可以使用b......
  • echarts柱状图设置选中阴影宽度
    tooltip:{trigger:'axis',axisPointer:{type:'line',lineStyle:{color:newecharts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#1950a300'},{......
  • html实现原生table并设置表格边框的两种方式
    虽然第三方表格插件多不胜数,但是很多场景还是需要用到原生<table>,掌握html原生table的实现方法,是前端开发的必备技能。例如:print-js打印、html2canvas生成图片等,用原生table可以规避很多问题。首先,在写原生<table>之前,我们先认识一下 border-collapse属性:border-collapse属性......
  • 鼠标移入svg改变svg的边框颜色
    1、将svg以字符串拿过来(注意:要将它自身的stroke去掉)constusedIconSvg=`<svgwidth="20.041748"height="20.041664"viewBox="0020.041720.0417"fill="none"xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www......
  • 3.柱状图
    1.多个柱状图<template><div><divref="chart1"class="chart"></div></div></template><script>import*asechartsfrom"echarts";exportdefault{data(){return{......
  • echart 柱状图加短线
    letdata=[51,58,63,57,63,40,124,108,63,63]letmax=Math.max.apply(null,data)*0.03letlinedata=Array(data.length).fill(max)this.options={grid:{left:20,right:20,......