首页 > 其他分享 >Echarts柱状图渲染进度条效果

Echarts柱状图渲染进度条效果

时间:2022-08-29 16:28:04浏览次数:67  
标签:false show data 进度条 柱状图 series bar type Echarts

柱状图渲染进度条效果

image-20220829154137386

option = {
  yAxis: {
    type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisTick: {
      show: false
    },
    axisLine: {
      show: false,
    },
    axisLabel: {
      verticalAlign: 'bottom',  //看这里
      align:'right',//看这里
      padding: [0,-30,10,0], //看这里
    },
  },
  xAxis: {
    type: 'value',
    splitLine: {
      show: false
    },
    show: false,
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
      barWidth: 5,
      label: {
        show: true,
        position: 'right',
        verticalAlign: 'bottom',
        offset: [-30,-10],
      },
    }
  ]
};

多拼接横向柱状图y轴名称偏移

image-20220829160552970

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // Use axis to trigger tooltip
            type: 'shadow'        // 'shadow' as default; can also be 'line' or 'shadow'
        }
    },
    legend: {
        show:false,
        data: ['Direct', 'Mail Ad', 'Affiliate Ad', 'Video Ad', 'Search Engine']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        show:false,
        type: 'value',
    },
    yAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        left:'20%',
        top:'80%',
        axisTick: {
                //刻度线
            show: false
        },
        axisLine:{
            lineStyle:{
                width:0,
            }
        },
        axisLabel:{
            textStyle:{
            	color:"#fff"
        		},
        		verticalAlign: 'bottom',  //看这里
        		align:'right',//看这里
        		//调整文字上右下左
        		padding: [0,-80,15,0],//看这里
				}       
    },
    series: [
        {
            name: 'Direct',
            type: 'bar',
            stack: 'total',
            label: {
                show: false
            },
            emphasis: {
                focus: 'series'
            },
            barWidth:10,
            data: [320, 302, 301, 334, 390, 330, 320]
        },
        {
            name: 'Mail Ad',
            type: 'bar',
            stack: 'total',
            label: {
                show: false
            },
            emphasis: {
                focus: 'series'
            },
            data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
            name: 'Affiliate Ad',
            type: 'bar',
            stack: 'total',
            label: {
                show: false
            },
            emphasis: {
                focus: 'series'
            },
            data: [220, 182, 191, 234, 290, 330, 310]
        },
        {
            name: 'Video Ad',
            type: 'bar',
            stack: 'total',
            label: {
                show: false
            },
            emphasis: {
                focus: 'series'
            },
            data: [150, 212, 201, 154, 190, 330, 410]
        },
        {   
            name: 'Search Engine',
            type: 'bar',
            stack: 'total',
            label: {
                show: false
            },
            emphasis: {
                focus: 'series'
            },
            data: [820, 832, 901, 934, 1290, 1330, 1320]
        }
    ]
};

标签:false,show,data,进度条,柱状图,series,bar,type,Echarts
From: https://www.cnblogs.com/Plume-blogs/p/16636316.html

相关文章

  • echarts-dataset数据源配置项
     如下效果图:   代码入下:letbox4=document.querySelector('.box4')letmyCharts3=echarts.init(box4)myCharts3.setOption({......
  • echarts-散点图-vue3-内阴影
      以上为效果图但是有一个问题是,一开始需要定义位置和颜色数组,当数据量过多的时候会重叠而且要提前声明很多数据后面我决定用关系图来做了,先放上散点图代码供参考f......
  • 上传文件的进度条
    想做一个上传文件的进度条,求大神看~-ThinkPHP框架 https://www.thinkphp.cn/topic/8630.html这是不用thinkphp框架写的index.php文件<script src="http://code.jqu......
  • Echarts与ajax数据的动态交互
    初学Echarts,Echarts的官网示例中配置项的数据需要用到js数组来传递数据,所以当我们从后端查询到数据后,往往需要通过ajax来进行数据交互。这是官方示例的配置项。<script......
  • threejs 实现3d柱状图
    import{useEffect,useRef}from'react';import{BoxGeometry,Mesh,AmbientLight,MeshPhongMaterial,MeshLambertMaterial,PerspectiveCamera,Scene,WebGLRe......
  • Echats给柱状图上方数字加%及鼠标移上去悬浮标签数据后加%
    1、Echats给柱状图上方数字加%     完整示例:在series的label标签的,添加1formatter:function(params){//标签内容2returnparams.......
  • 小程序scroll-view滑动进度条
     效果图如下:    代码如下:Page({data:{left:0.5//初始化滑块位置},//金刚区滑动事件scroll(event){letscrollLeft=e......
  • tqdm和zip组合使用时无法显示进度条-解决办法
    问题单独对于可迭代对象iterator使用tqdm时,结合循环就可以在终端显示进度条,以直观展示程序进度,如下:fromtqdmimporttqdmtextlist=[]foriinrange(10):te......
  • 封装文件导入组件,含导入进度条
    需求系统中需要有多个文件导入的地方,因此需要把它封装为组件便于复用。问题是:每次的导入url不同,每次封装的导入接口应该在主页面用呢?还是在组件页面用?解决办法分析:其......
  • 84. 柱状图中最大的矩形
    84.柱状图中最大的矩形给定n个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为1。求在该柱状图中,能够勾勒出来的矩形的最大面积。 示例1......