echarts分组显示

echarts分组显示_第1张图片

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器,坐标轴触发有效
            type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    legend: {
        data: ['PR','PR达成率']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
             data: ['19年平均', '18年平均', '17年平均', '',
            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul','Aug','Sep','Oct','Nov','Dec','',
            'week1', 'week2', 'week3', 'week4', 'week5','',
            '1日', '2日', '3日', '4日', '5日', '6日','7日'],
            type: 'category',
            axisLabel: {
                interval: 0,
                show: true,
                 rotate:45,
                textStyle: {
                    color: '#FFFFFF',
                },
                fontSize: 10,
                formatter:function(param){
                    if(param==''){
                        return ''
                    }else{
                         return param
                    }
                   
                }
            },
            axisTick: {
                show: true,
                length:15,
                interval:function(index, value){
                      console.log(index,value)
                      var datats= ['19年平均', '18年平均', '17年平均', '',
            'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun','Jul','Aug','Sep','Oct','Nov','Dec','',
            'week1', 'week2', 'week3', 'week4', 'week5','',
            '1日', '2日', '3日', '4日', '5日', '6日','7日','']
                          if(index!=28){
                              if(value!=''&&datats[index-1]=='' ){
                                return true
                              }else{
                                  return false
                              }
                          }else{
                              return false
                          }
                }
                
            },
            axisLine: {
                show: true
            },
        },
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            name: 'PR',
            type: 'bar',
            arWidth:'25%',
            itemStyle: {
                normal: {
                    color: '#148084',
                }
            },
            data: [320, 23, 301, '',
            334, 390, 330, 320, 332, 301, 334, 390, 330, 320, 332, 301,'',
            334, 390, 330, 320,120,'',
            150,150,150,150,150,120,120]
        },
          {
            name: 'PR',
            type: 'line',
            arWidth:'25%',
            itemStyle: {
                normal: {
                    color: '#148084',
                }
            },
            data: [320, 23, 301, '',
            334, 390, 330, 320, 332, 301, 334, 390, 330, 320, 332, 301,'',
            334, 390, 330, 320,120,'',
            150,150,150,150,150,120,120]
        },
        {
            name:'PR达成率',
            type: 'line',
            barWidth:'25%',
            itemStyle: {
                normal: {
                    color:'#00D200'
                }
            },

           data:[320, 23, 301, '',
            334, 390, 330, 320, 332, 301, 334, 390, 330, 320, 332, 301,'',
            334, 390, 330, 320,120,'',
            150,150,150,150,150,120,120]
        },
        {
            name:'PR达成率',
            type: 'bar',
            barWidth:'25%',
            itemStyle: {
                normal: {
                    color:'#00D200'
                }
            },

           data: [320, 23, 301, '',
            334, 390, 330, 320, 332, 301, 334, 390, 330, 320, 332, 301,'',
            334, 390, 330, 320,120,'',
            150,150,150,150,150,120,120]
        } 
    ]
};

 

你可能感兴趣的:(Echarts)