-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
overflowHide 对于标签在图形上放置不下的时候,随机隐藏标签。 #6199
Labels
Comments
期望是什么? 我估计是条形的高度刚好对有一些字符不够高,所以 hide 了。 |
期望:以上图片为例,对于同等宽的柱子,同等长度的label显隐一致 |
我认领这个bug,看了下,源码是直接将label的坐标范围和柱子的坐标范围做比较,没做精度管理,label的坐标精度太小,已经是在在肉眼不可感知的像素(即0.00x甚至更小的像素)导致了label溢出,所以就被隐去了。 |
4 tasks
ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
/**
*/
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.coordinate({ transform: [{ type: 'transpose' }] });
chart
.interval()
.data({
type: 'fetch',
value:
'https://gw.alipayobjects.com/os/bmw-prod/fb9db6b7-23a5-4c23-bbef-c54a55fee580.csv',
format: 'csv',
})
.transform({ type: 'sortX', reverse: true })
.encode('x', 'letter')
.encode('y', 'frequency')
.axis('y', { labelFormatter: '.0%' })
.label({
text: 'frequency',
formatter: '.1%',
textAlign: (d) => (+d.frequency > 0.008 ? 'right' : 'start'),
fill: (d) => (+d.frequency > 0.008 ? '#fff' : '#000'),
dx: (d) => (+d.frequency > 0.008 ? -5 : 5),
transform: [
{
"type": "overflowHide"
}
]
});
chart.render();
重现链接
No response
重现步骤
No response
预期行为
正常显示或者超出隐藏
平台
屏幕截图或视频(可选)
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: