echarts [question] Bar Chart Grid Not Fully Utilized Due to containLabel Setting Resulting in Blank Space at Bottom

xzlaal3s  于 6个月前  发布在  Echarts
关注(0)|答案(6)|浏览(59)

Version

5.5.0

Steps to Reproduce

未铺满div

Current Behavior

配置grid后,出现未填充满div问题

option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  legend: {},
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  xAxis: [
    {
        "type": "category",
        "position": "bottom",
        "data": [
            "Alipay+",
            "",
            ""
        ],
        "axisLabel": {
            "color": "#ffffff",
            "fontSize": 12,
            "lineHeight": 16
        }
    },
    {
        "type": "category",
        "position": "bottom",
        "data": [
            "",
            "WF",
            ""
        ],
        "axisLabel": {
            "color": "#ffffff",
            "fontSize": 12,
            "lineHeight": 16
        }
    },
    {
        "type": "category",
        "position": "bottom",
        "data": [
            "",
            "",
            "HK Biz"
        ],
        "axisLabel": {
            "color": "#ffffff",
            "fontSize": 12,
            "lineHeight": 16
        }
    }
],
  yAxis: [
    {
      type: 'value'
    }
  ],
  series:[
    {
        "name": "USD",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 0,
        "data": [
            1000000000015.99
        ]
    },
    {
        "name": "USD",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 1,
        "data": [
            "",
            999999999999.99
        ]
    },
    {
        "name": "USD",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 2,
        "data": [
            "",
            "",
            999999999999.99
        ]
    },
    {
        "name": "EUR",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 0,
        "data": [
            1080699999999.91
        ]
    },
    {
        "name": "CNY",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 1,
        "data": [
            "",
            1408400000000
        ]
    },
    {
        "name": "CNY",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 2,
        "data": [
            "",
            "",
            1408400000000
        ]
    },
    {
        "name": "Others(US $)",
        "type": "bar",
        "barWidth": 22,
        "xAxisIndex": 1,
        "data": [
            "",
            2115000000000
        ]
    }
]
};

Expected Behavior

这样写是为了过滤为0的数据,不进行占位
现在解决了这个问题 出现了占不满div的问题

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

3mpgtkmj

3mpgtkmj1#

@Ovilia@helgasoft 大佬可以帮忙看下吗,这个为占满div问题
底部空的较多,是因为我有多个xAxis的问题吗?

8tntrjer

8tntrjer2#

This has nothing to do with containLabel . You're using three xAxis so they will have 9% of the chart's height.

ui7jx7zq

ui7jx7zq3#

This has nothing to do with containLabel . You're using three xAxis so they will have 9% of the chart's height.

那如果xAxis的个数是动态的呢这个 chart's height 如何拿呢, 我尝试使用bottom为-%,就是不知道这个高度的计算逻辑

zazmityj

zazmityj4#

how to get the chart's height?

there is getHeight

s3fp2yjn

s3fp2yjn5#

how to get the chart's height?

there is getHeight

How to remove the blank space at the bottom when using ContainLabel @helgasoft

hyrbngr7

hyrbngr76#

@rr210, we are not supposed to answer "how to" questions here. The recommendations are:

The issue list is reserved exclusively for bug reports and feature requests.
For usage questions, please use the following resources:

try axisLabel: { show: false, to remove bottom space, and even better: redesign of your chart.

相关问题