Replies: 2 comments 1 reply
-
在堆叠条形图中设置条之间的间隔(保持间距大小) 根据 Ant Design Charts v2.4.0 文档,目前条形图(Bar)中可以通过 barStyle/groupPadding/barPadding 等配置条与条之间的间隔。但是对于堆叠条形图(isStack: true),“堆叠组”的间隔与“一般分组”或柱间间隔会略有不同。 方案说明
import { Bar } from '@ant-design/charts';
const data = [
{ type: 'A', value: 10, category: 'x' },
{ type: 'A', value: 20, category: 'y' },
{ type: 'B', value: 15, category: 'x' },
{ type: 'B', value: 18, category: 'y' },
];
const config = {
data,
isStack: true,
xField: 'value',
yField: 'type',
seriesField: 'category',
barStyle: {
lineWidth: 2, // 添加间隔边框
stroke: '#fff', // 以白色分隔
},
groupPadding: 0.2, // 组与组之间的距离
barPadding: 0.1, // 组内柱间的距离(对stack无太大作用)
};
<Bar {...config} />;
效果说明
参考文档总结 此回答由AI自动生成,仅供参考。如有疑问,请等待维护者回复。 |
Beta Was this translation helpful? Give feedback.
1 reply
-
style: {
insetRight: 10
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, is there a way to make spacing (gaps) in stacking bar chart (and maintain spacing size), like this:

Beta Was this translation helpful? Give feedback.
All reactions