首页 > 其他分享 >柱状图-渐变色-竖双柱状图

柱状图-渐变色-竖双柱状图

时间:2023-07-20 17:24:31浏览次数:29  
标签:lineStyle show color 渐变色 竖双 柱状图 178 type true

效果图:

 

  chart.setOption({
    tooltip: {
      trigger: 'axis',
      show: true,
      backgroundColor: 'rgba(6,19,40,0.8)',
      borderColor: 'transparent',
      padding: [8, 20, 8, 8],
      textStyle: {
        color: '#fff',
        opacity: 1,
        fontSize: 15,
      },
      axisPointer: {
        type: 'line'
      }
    },
    grid: {
      left: '11%',
      top: '14%',
      width: '86%',
      height: '75%',
    },
    legend: {
      show: true,
      top: "2%",
      right: "0%",
      itemGap: 10,
      icon: "rect",
      itemWidth: 10,
      itemHeight: 10,
      textStyle: {
        fontSize: 14,
        fontFamily: "Source Han Sans CN",
        fontWeight: "normal",
        color: "#FFFFFF",
        opacity: 0.8,
      },
    },
    xAxis: {
      type: 'category',
      data: ["6/1", "6/2", "6/3", "6/4", "6/5", "6/6"],
      boundaryGap: true,
      splitLine: {
        lineStyle: {
          type: 'solid',
        },
        alignWithLabel: true,
      },
      axisLine: {
        lineStyle: {
          type: 'solid',
          color: '#BAE7FF'
        },
      },
      axisTick: {
        show: true,
        lineStyle: {
          type: 'solid',
          color: '#BAE7FF'
        },
      },
      axisLabel: {
        fontSize: 16,
        fontFamily: 'Source Han Sans CN',
        fontWeight: 400,
        lineHeight: 30,
        color: '#cccccc',
        margin: 3
      },
    },
    yAxis: {
      name: '单位: 人',
      type: 'value',
      splitLine: {
        lineStyle: {
          type: 'dashed',
          color: 'rgba(105, 119, 135, 0.6)'
        }
      },
      axisLine: {
        show: true,
        lineStyle: {
          type: 'solid',
          color: '#BAE7FF'
        },

      },
      axisTick: {
        show: false
      },
      axisLabel: {
        fontSize: 16,
        fontFamily: 'Source Han Sans CN',
        fontWeight: 400,
        color: '#cccccc',
        margin: 5
      },
      nameGap: 0,
      nameTextStyle: {
        fontSize: 16,
        fontFamily: 'Source Han Sans CN',
        fontWeight: 400,
        lineHeight: 50,
        color: '#cccccc'
      }
    },
    series: [{
      name: "已出勤",
      type: 'bar',
      animationDuration: 1000,
      animationEasing: "cubicInOut",
      barWidth: 11,
      data: [900, 390, 520, 610, 700, 660],
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: '#D0E71E' // 0% 处的颜色
          }, {
            offset: 1,
            color: 'rgba(30,231,231,0.35)' // 100% 处的颜色
          }],
          global: false // 缺省为 false
        }
      },
    },
    {
      name: "未出勤",
      type: 'bar',
      barGap: '50%',
      animationDuration: 1000,
      animationEasing: "cubicInOut",
      barWidth: 11,
      data: [500, 190, 210, 310, 370, 400],
      itemStyle: {
        color: {
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [{
            offset: 0,
            color: 'rgba(178,178,178,1) ' // 0% 处的颜色
          }, {
            offset: 1,
            color: 'rgba(178,178,178,0.22) ' // 100% 处的颜色
          }],
          global: false // 缺省为 false
        }
      }
    }
    ]
  })

 

标签:lineStyle,show,color,渐变色,竖双,柱状图,178,type,true
From: https://www.cnblogs.com/a973692898/p/17568956.html

相关文章

  • 柱状图-横向渐变色柱状图
    效果图: 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.柱状图中最大的矩形   今天是训练营最后一天,恭喜坚持两个月的录友们,接下来可以写一篇自己 代码随想录一刷的总结。好好回顾一下,这两个月自己的博客内容,以及自己的收获。  ......
  • echarts柱状图设置选中阴影宽度
    tooltip:{trigger:'axis',axisPointer:{type:'line',lineStyle:{color:newecharts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#1950a300'},{......
  • 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,......
  • 常用 QT 样式与方法(按钮悬浮变色,渐变色等)
    1QSS按钮悬浮效果类似于企业微信等,鼠标悬浮在某按钮上,按钮会改变背景色来达到告知用户"选中"的效果,如下图所示:可以看到其实是background有一个浅灰色,同理,我们可以在hover的时候改变按钮的background如企业微信这样的作法,或者更改按钮文字颜色。主要使用的QT函数,示......
  • ChatGPT指令—饼图、柱状图、流程图
    今天分享生成图表的ChatGPT指令(提示词、Prompt),包括生成饼图、柱状图、流程图等。生成饼图指令:你现在是图形生成器,我将输入查询语言,你只显示该图像的预览,仅此而已。不要写解释,除非我指示你这样做,否则不要键入命令。当我需要用中文告诉你一些事情时,我会把文字放在大括号内{like......
  • Qt编写曲线图柱状图源码 1:可设置X轴Y轴范围值 2:可设置背
    Qt编写曲线图柱状图源码1:可设置X轴Y轴范围值2:可设置背景颜色+文本颜色+网格颜色3:可设置三条曲线颜色+颜色集合4:可设置是否显示定位十字线,可分别设置横向和纵向5:可设置十字线的宽度和颜色6:可设置是否显示数据点以及数据点的大小7:可设置是否填充背景形成面积图8:可设置模......
  • Android自定义View实现渐变色进度条
    在网上看到一个进度条效果图,非常美观,如下:进行效果分解:渐变色,看起来颜色变化并不复杂,使用LinearGradient应该可以实现。圆头,无非是画两个圆,外圆使用渐变色的颜色,内圆固定为白色。灰底,还没有走到的进度部分为灰色。进度值,使用文本来显示;弧形的头部,考虑使用直线进行连接,或者使用曲线,例......