Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rr210 opened this issue May 14, 2024 · 6 comments
Labels
en This issue is in English support

Comments

@rr210
Copy link

rr210 commented May 14, 2024

Version

5.5.0

Link to Minimal Reproduction

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

@rr210 rr210 added the bug label May 14, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels May 14, 2024
@rr210 rr210 changed the title [Bug] ContainLabel does not become invalid [Bug] ContainLabel no effect May 14, 2024
@rr210
Copy link
Author

rr210 commented May 15, 2024

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

@Ovilia
Copy link
Contributor

Ovilia commented May 16, 2024

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

@Ovilia Ovilia added support waiting-for: author and removed bug pending We are not sure about whether this is a bug/new feature. labels May 16, 2024
@rr210
Copy link
Author

rr210 commented May 16, 2024

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为-%,就是不知道这个高度的计算逻辑

@helgasoft
Copy link

how to get the chart's height?

there is getHeight

@rr210
Copy link
Author

rr210 commented May 17, 2024

how to get the chart's height?

there is getHeight

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

@helgasoft
Copy link

@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.

@rr210 rr210 changed the title [Bug] ContainLabel no effect [question] Bar Chart Grid Not Fully Utilized Due to containLabel Setting Resulting in Blank Space at Bottom May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English support
Projects
None yet
Development

No branches or pull requests

3 participants