Home > Enterprise >  How to set height of individual bars in Ant Design Stacked Bar?
How to set height of individual bars in Ant Design Stacked Bar?

Time:09-22

I am using Ant Design Charts to create a stacked bar but I want it to be responsive. When I am removing data items, the bars get too thick to fill the available space. So basically, I want the bars to have fixed height so that they don't get too thick when there are few data items. Please find below the relevant images:

enter image description here enter image description here

Here is the link to ant design chart:

https://charts.ant.design/en/examples/bar/stacked#basic

CodePudding user response:

You can use pass maxBarWidth prop to bar config like this:

config = {
    maxBarWidth: 30,
    ...

Or directly to the Bar component like this:

<Bar {...config} maxBarWidth={30} />
  • Related