Echarts进度条柱状图

1.效果

image

  • x轴的坐标是写的html和css样式不是echarts
  • y轴可以根据数据动态变化

2.代码

export function Progress(){
  return {
    tooltip: {},
    yAxis: {
        max: 2000,
        splitLine: {
            show: false
        },
        offset: 10,
        axisTick: {
            show: false
        },
       
        axisLine: {
            show: false
        },
        axisLabel: {
            show: false
        }
    },
    xAxis: [{
        type: "category",
        inverse: false,
        position: 'top',
        axisLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        axisLabel: {
            show: false
        }
    }, ],
    grid: {
        top: '30%',
        left: '1%',
        // right: 100
        bottom:'3%'
    },
    series: [
        {
            // current data
            type: 'pictorialBar',
            symbol: 'rect',
            symbolRepeat: 'fixed',
            symbolMargin: '30%',//缝隙
            symbolClip: true,
            symbolSize: [40, 5],//图形宽度
            symbolBoundingData: 2000,
            label: {
                normal: {
                    show: true,
                    position: 'top',
                    offset: [0, 0],
                    textStyle: {
                        color: '#fff',
                        fontSize: 28
                    }
                }
            },
            data: [{
                    "value": 900,
                    'itemStyle': { //图形样式。
                      'normal': {
                        'color': {
                          // 'type': 'linear',
                          'x': 0,
                          'y': 0,
                          'x2': 1,
                          'y2': 1,
                          'colorStops': [{
                            'offset': 0,
                            'color':'#00f6ff'
                          }, {
                            'offset': 1,
                            'color':'#19abff'
                          }]
                        }
                      }
                    },
                },
                {
                    "value": 1820,
                    'itemStyle': { //图形样式。
                      'normal': {
                        'color': {
                          // 'type': 'linear',
                          'x': 0,
                          'y': 0,
                          'x2': 1,
                          'y2': 1,
                          'colorStops': [{
                            'offset': 0,
                            'color':'#82ff51'
                          }, {
                            'offset': 1,
                            'color':'#5be28e'
                          }]
                        }
                      }
                    },
                },
                {
                    "value": 1660,
                    'itemStyle': { //图形样式。
                      'normal': {
                        'color': {
                          // 'type': 'linear',
                          'x': 0,
                          'y': 0,
                          'x2': 1,
                          'y2': 1,
                          'colorStops': [{
                            'offset': 0,
                            'color':'#e785ff'
                          }, {
                            'offset': 1,
                            'color':'#a359ff'
                          }]
                        }
                      }
                    },
                }
               
            ],
            animationEasing: 'elasticOut',
            animationDelay: function(dataIndex, params) {
                return params.index * 30;
            }
        }, 
       
    ]
  }
}
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值