fix(图表): 修复线面图辅助线标签遮挡

This commit is contained in:
wisonic-s
2025-11-19 15:18:52 +08:00
committed by wisonic-s
parent b51973ae58
commit 88c2f778e9
2 changed files with 8 additions and 4 deletions

View File

@@ -82,10 +82,10 @@ export class Area extends G2ChartView {
type: 'area',
tooltip: false,
style: { fillOpacity: 0.3 },
zIndex: 1
zIndex: -1
},
{ type: 'line', encode: { series: 'category' }, zIndex: 0 },
{ type: 'point', tooltip: false, zIndex: 2 }
{ type: 'line', encode: { series: 'category' }, zIndex: -2 },
{ type: 'point', tooltip: false, zIndex: 0 }
]
}
EMPTY_MARKER = () => []
@@ -492,6 +492,7 @@ export class Area extends G2ChartView {
type: 'lineY',
encode: { y: 'value', color: () => randomAssistColorScale },
data: lineData,
zIndex: 0,
style: {
stroke: d => d.color,
lineDash: d => (d.lineType === 'solid' ? [] : d.lineType === 'dashed' ? [10, 8] : [1, 2]),
@@ -927,6 +928,7 @@ export class StackArea extends Area {
type: 'lineY',
encode: { y: 'value', color: () => randomAssistColorScale },
data: [line],
zIndex: 0,
style: {
stroke: line.color,
lineDash:

View File

@@ -97,6 +97,7 @@ export class Line extends G2ChartView {
},
children: [
{
zIndex: -1,
type: 'line',
encode: { series: 'category' },
interaction: {
@@ -110,7 +111,7 @@ export class Line extends G2ChartView {
}
}
},
{ type: 'point', tooltip: false }
{ type: 'point', tooltip: false, zIndex: 0 }
]
}
const options = this.setupOptions(chart, initOptions)
@@ -575,6 +576,7 @@ export class Line extends G2ChartView {
const randomAssistColorScale = randomString(6)
const assistLineMark: G2Spec = {
type: 'lineY',
zIndex: 0,
encode: { y: 'value', color: () => randomAssistColorScale },
data: lineData,
style: {