diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index a986e4f7..a505c119 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -80,6 +80,7 @@ slug: /changelog ## master +* (2025.04.07) 修复`GridCoord`在设置背景色且Serie开启Clip时会覆盖图表的问题 * (2025.04.07) 修复`Gantt`甘特图年份大于2038时显示异常的问题 * (2025.04.07) 修复`Axis`的`Time`时间轴无法显示大于2038的年份的问题 * (2025.04.06) 修复`Axis`的`Time`时间轴在有`DataZoom`缩放时文本显示异常的问题 diff --git a/Runtime/Coord/Grid/GridCoordHandler.cs b/Runtime/Coord/Grid/GridCoordHandler.cs index b38b769e..8b3f73b4 100644 --- a/Runtime/Coord/Grid/GridCoordHandler.cs +++ b/Runtime/Coord/Grid/GridCoordHandler.cs @@ -12,7 +12,7 @@ namespace XCharts.Runtime { var grid = component; grid.painter = chart.painter; - grid.refreshComponent = delegate() + grid.refreshComponent = delegate () { grid.UpdateRuntimeData(chart); chart.OnCoordinateChanged(); @@ -51,6 +51,7 @@ namespace XCharts.Runtime public override void DrawBase(VertexHelper vh) { + DrawBackground(vh, component); if (!SeriesHelper.IsAnyClipSerie(chart.series)) { DrawCoord(vh, component); @@ -64,7 +65,7 @@ namespace XCharts.Runtime } } - private void DrawCoord(VertexHelper vh, GridCoord grid) + private void DrawBackground(VertexHelper vh, GridCoord grid) { if (!grid.show) return; if (!ChartHelper.IsClearColor(grid.backgroundColor)) @@ -75,6 +76,11 @@ namespace XCharts.Runtime var p4 = new Vector2(grid.context.x + grid.context.width, grid.context.y); UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, grid.backgroundColor); } + } + + private void DrawCoord(VertexHelper vh, GridCoord grid) + { + if (!grid.show) return; if (grid.showBorder) { var borderWidth = grid.borderWidth == 0 ? chart.theme.axis.lineWidth * 2 : grid.borderWidth;