Jason–json 2021-11-19 09:53 采纳率: 66.7%
浏览 62
已结题

echatrs 柱状图取消了y轴之后出现占位现象

echatrs 柱状图取消了y轴之后仍然出现占位现象,怎么处理能够使 柱状图居中显示

img

代码如下:

       getOption=()=>{
        let option = {
            title: {//图表标题
                left:'center',
                textStyle: {
                    fontSize:14,
                    color: '#FFF',
                }
            },
            legend: {//示例图
                data: ['2019年','2020年','2021年'],
                top:0,
                textStyle: {
                    color: '#FFF',
                    color: 'rgba(255, 255, 255, .65)'
                }
            },
            grid: {//调整整个图表的位置
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            color:['#30B2AD','#E8B339','#74B72D'],
            xAxis: {
                type: 'category',
                data:["需求","采购","释放"],
                axisLabel: {//修改刻度文字颜色
                    color: 'rgba(255, 255, 255, .65)',
                    interval:0,
                 },
                splitLine:{//不显示背景线条
                    show:false,
                },
                axisTick:{//不显示刻度
                    show:false,
                },
            },
            yAxis: {
                type: 'value',
                show:false,
                axisLabel: {
                    // color: '#FFF',
                    axisLabel : {
                        formatter: function(){
                            return "";
                        }
                    }
                },
            },
            series: [
                {
                    name: '2019年',
                    type: 'bar',
                    emphasis: {
                        focus: 'series'
                    },
                    data: ['19','49','11'],
                    barCategoryGap:20,//设置同一系列的柱间距离,默认为类目间距
                    barMaxWidth:28,
                    itemStyle: {
                        normal: {
                            label: {//显示数据
                                show: true,
                                color: "#fff",
                                position:"top",
                                fontSize:"10px",
                            }
                        }
                    },
                },
                {
                    name: '2020年',
                    type: 'bar',
                    emphasis: {
                        focus: 'series'
                    },
                    data: ['280','45','11'],
                    barCategoryGap:20,//设置同一系列的柱间距离,默认为类目间距
                    barMaxWidth:28,
                    itemStyle: {
                        normal: {
                            label: {//显示数据
                                show: true,
                                color: "#fff",
                                position:"top",
                                fontSize:"10px",
                            }

                        }
                    },
                },
                {
                    name: '2021年',
                    type: 'bar',
                    emphasis: {
                        focus: 'series'
                    },
                    data: ['28','45','11'],
                    barCategoryGap:20,//设置同一系列的柱间距离,默认为类目间距
                    barMaxWidth:28,
                    itemStyle: {
                        normal: {
                            label: {//显示数据
                                show: true,
                                color: "#fff",
                                position:"top",
                                fontSize:"10px",
                            }

                        }
                    },
                }
            ]
        }
        return option
    }
  • 写回答

1条回答 默认 最新

  • console.log( ) 2021-11-19 10:00
    关注

    你自己代码里不写着注释呢

    grid: {//调整整个图表的位置
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 11月27日
  • 已采纳回答 11月19日
  • 创建了问题 11月19日

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端