-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
OSCPAntV Open Source Contribution PlanAntV Open Source Contribution Planbug 🐛Something isn't workingSomething isn't working
Description
Describe the bug / 问题描述
给各个 mark 设置 zIndex 之后,mark 的图形优先级确实是正确的,但是标签的优先级并没有按图形的优先级进行展示,
point 的标签会被其他的 point 遮挡,lineY 的标签甚至是被理论上低一级的 point 给遮挡了。
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
const chart = new Chart({ container: "container" });
chart.options({
type: "view",
autoFit: true,
data: [
{ country: "Asia", year: "1750", value: 502 },
{ country: "Asia", year: "1800", value: 635 },
{ country: "Asia", year: "1850", value: 809 },
{ country: "Asia", year: "1900", value: 5268 },
{ country: "Asia", year: "1950", value: 4400 },
{ country: "Asia", year: "1999", value: 3634 },
{ country: "Asia", year: "2050", value: 947 },
{ country: "Africa", year: "1750", value: 106 },
{ country: "Africa", year: "1800", value: 107 },
{ country: "Africa", year: "1850", value: 111 },
{ country: "Africa", year: "1900", value: 1766 },
{ country: "Africa", year: "1950", value: 221 },
{ country: "Africa", year: "1999", value: 767 },
{ country: "Africa", year: "2050", value: 133 },
{ country: "Europe", year: "1750", value: 163 },
{ country: "Europe", year: "1800", value: 203 },
{ country: "Europe", year: "1850", value: 276 },
{ country: "Europe", year: "1900", value: 628 },
{ country: "Europe", year: "1950", value: 547 },
{ country: "Europe", year: "1999", value: 729 },
{ country: "Europe", year: "2050", value: 408 },
{ country: "Oceania", year: "1750", value: 200 },
{ country: "Oceania", year: "1800", value: 200 },
{ country: "Oceania", year: "1850", value: 200 },
{ country: "Oceania", year: "1900", value: 460 },
{ country: "Oceania", year: "1950", value: 230 },
{ country: "Oceania", year: "1999", value: 300 },
{ country: "Oceania", year: "2050", value: 300 },
],
encode: { x: "year", y: "value", color: "country" },
axis: { x: { title: false }, y: { title: false } },
legend: {
color: {
itemMarker: 'square',
markerCursor: 'default',
backgroundCursor: 'default',
labelCursor: 'default',
valueCursor: 'default',
}
},
children: [
{ zIndex: 0, type: "area", style: { fillOpacity: 0.3 } },
{ zIndex: 1, type: "line", style: { strokeWidth: 2 }, tooltip: false },
{
zIndex: 2,
type: "point",
style: { fillOpacity: 1, strokeWidth: 0 },
encode: { shape: "circle", size: 20 },
tooltip: false,
labels: [
{
text: d => d.value,
style: { fillOpacity: 1 },
position: "top",
textBaseline: "bottom",
transform: [{ type: "overlapHide" }, { type: "exceedAdjust" }],
fontFamily: "PingFang"
}
]
},
{
zIndex: 4,
type: 'lineY',
data: [200],
labels: [
{
text: '辅助线',
style: { fillOpacity: 1, zIndex: 10 },
position: 'left',
textBaseline: 'bottom',
transform: [{ type: 'overlapHide' }, { type: 'exceedAdjust' }],
fontFamily: 'PingFang'
}
]
}
],
});
chart.render();Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他
Metadata
Metadata
Assignees
Labels
OSCPAntV Open Source Contribution PlanAntV Open Source Contribution Planbug 🐛Something isn't workingSomething isn't working