[Bug]: Axis中关于label的auto*配置,与Slider的配置冲突。导致Slider配置values之后,Axis的label相关配置失效。
Author: claireliumoCreated Sep 17, 2026Updated Sep 17, 2026
Labelswaiting for maintainer
Describe the bug / 问题描述
import { Column } from '@ant-design/plots';
import React, { useEffect, useRef } from 'react';
import { createRoot } from 'react-dom/client';
const DemoColumn = () => {
const chartRef = useRef();
useEffect(() => {
console.log({ chartRef });
if (chartRef.current) {
}
}, []);
const config = {
data: [
{
type: '家具家电',
sales: 38,
},
{
type: '粮油副食',
sales: 52,
},
{
type: '生鲜水果',
sales: 61,
},
{
type: '美容洗护美容洗护美容洗护美容洗护美容洗护美容洗护',
sales: 145,
},
{
type: '母婴用品',
sales: 48,
},
{
type: '进口食品',
sales: 38,
},
{
type: '食品饮料',
sales: 8,
},
{
type: '家庭清洁',
sales: 28,
},
],
xField: 'type',
yField: 'sales',
height: 400,
padding: [10,,20, 80,0],
axis: {
x: {
size: 40,
labelAutoEllipsis: {
suffix: '..',
minLength: 8,
maxLength: 12,
},
labelAutoWrap: {
wordWrapWidth: 80,
maxLines: 2,
recoverWhenFailed: true,
},
labelAutoRotate: {
optionalAngles: [0, 15,80], // 尝试旋转 0 度、45 度、90 度
recoverWhenFailed: true, // 如果旋转后无法解决问题,恢复到默认角度
},
labelAutoHide: {
keepHeader: true, // 保留第一个刻度值
keepTail: true, // 保留最后一个刻度值
},
}
},
slider: {
x: {
values: [0.1,0.2]
}
},
};
return <Column {...config} ref={chartRef} />;
};
createRoot(document.getElementById('container')).render(<DemoColumn />);当前配置如图:
期望效果
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
如描述
Version / 版本
5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他
Source: antvis/G2