柱状图刻度

var lb = []
var n =-0.5
let arr = [0,5,10,15,20,25]

for(let i=0;i<26;i++){
    
    lb[i]= arr.indexOf(i) !== -1 ? 3 : '1'
    n= Number((n+0.1).toFixed(1))
}
console.log('lb',lb)
option = {
        backgroundColor: new echarts.graphic.RadialGradient(0, 0, 0.8, [
            {
                offset: 0,
                color: '#FAFCFF',
            },
            {
                offset: 1,
                color: '#FAFCFF',
            },
        ]),
        tooltip: {
            trigger: 'axis',
            textStyle: {
                color: '#fff',
            },
        },
        grid: {
            // left: '200',
            right: '380',
            top: '40',
            bottom: '12%',
        },
        xAxis: [
            {
                type: 'category',
                show:false,
                boundaryGap: false,

                axisLine: {
                    show: true,
                },
                axisLabel: {
                    textStyle: {
                        color: '#fff',
                    },
                },
                axisTick: {
                    show: true,
                },
            },
            {
              show: false,
              min: -5,
              max: 80,
              
            //   data: []
            }
        ],
        yAxis: [
            {
                show: false,
                splitLine: {
                    show: false,
                },
                min: 0,
                max: 2.5,
                maxInterval: 2,
                position: 'right'
            },
            {
              show: false,
              data: [],
              min: 0,
              max: 26,
              axisLine: {
                show: true
          }
    }, 
        ],
        series: [
            {
                zlevel: 1,
                type: 'bar',
                name: 'TIT',
                tooltip: {
                    show: true,
                },
                showBackground: true,

                backgroundStyle: {
                    color: 'green',
                    barBorderRadius: 50,

                },
                animation: false,
                barWidth: 40,
                hoverAnimation: false,
                data: [1.5],

                itemStyle: {
                    normal: {
                        barBorderRadius:[0,0,50,50],
                        color: 'yellow',
                        // opacity: 0.7,
                        label: {
                            show: false,
                        },
                        shadowColor: 'rgba(0, 0, 0, .2)',
                        // shadowBlur: 0,
                        // shadowOffsetY: 2,
                        // shadowOffsetX: 2,
                    },
                },
            },
            
            {
                name: '背景',
                type: 'bar',
                barWidth: 40,
                barGap: '-100%',
                data: [2],
                itemStyle: {
                    normal: {
                        color: 'pink',
                        barBorderRadius: 50
                    }
                }
            },
             {
                name: 'kedu',
                type: 'bar',
                yAxisIndex: 1,
                xAxisIndex: 1,
                data: lb,
                label:{
                    normal:{
                        show:true,
                        position:'right',
                        distance:10,
                        color: 'red',
                        fontSize: 14,
                        formatter: function(params) {
                            console.log('---',arr.indexOf(params.dataIndex) )
                          if(arr.indexOf(params.dataIndex) !==-1){
                              return lb[params.dataIndex]
                          }else{
                              return ''
                          }
                        }
                    }
                },
                
                barWidth:1
            },
        ],
    };
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值