diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index b697b87f..67e213b9 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -68,6 +68,7 @@ slug: /changelog ## master +* (2023.09.29) 修复`Bar`在水平方向时`Label`设置为`Bottom`不生效的问题 * (2023.09.22) 增加`Line`的平滑曲线对`Dash`虚线的支持 * (2023.09.16) 修复`Tooltip`在类目轴无数据时异常报错的问题 (#279) * (2023.09.16) 修复`Pie`无数据时绘制异常的问题 (#278) diff --git a/Runtime/Serie/Bar/BarHandler.cs b/Runtime/Serie/Bar/BarHandler.cs index 0cc1faa3..3de86ccc 100644 --- a/Runtime/Serie/Bar/BarHandler.cs +++ b/Runtime/Serie/Bar/BarHandler.cs @@ -67,7 +67,10 @@ public override Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyl { case LabelStyle.Position.Bottom: var center = serieData.context.rect.center; - return new Vector3(center.x, center.y - serieData.context.rect.height / 2); + if(serie.context.isHorizontal) + return new Vector3(center.x - serieData.context.rect.width/2, center.y); + else + return new Vector3(center.x, center.y - serieData.context.rect.height / 2); case LabelStyle.Position.Center: case LabelStyle.Position.Inside: return serieData.context.rect.center; @@ -193,6 +196,7 @@ private void DrawBarSerie(VertexHelper vh, Bar serie) var areaToColor = ColorUtil.clearColor32; var interacting = false; + serie.context.isHorizontal = isY; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; serie.animation.InitProgress(axisXY, axisXY + axisLength); diff --git a/Runtime/Serie/Line/LineHandler.GridCoord.cs b/Runtime/Serie/Line/LineHandler.GridCoord.cs index 5694aa3b..e05a559e 100644 --- a/Runtime/Serie/Line/LineHandler.GridCoord.cs +++ b/Runtime/Serie/Line/LineHandler.GridCoord.cs @@ -296,6 +296,7 @@ private void DrawLineSerie(VertexHelper vh, Line serie) var lineWidth = LineHelper.GetLineWidth(ref interacting, serie, chart.theme.serie.lineWidth); axis.context.scaleWidth = scaleWid; + serie.context.isHorizontal = isY; serie.containerIndex = m_SerieGrid.index; serie.containterInstanceId = m_SerieGrid.instanceId; diff --git a/Runtime/Serie/SerieContext.cs b/Runtime/Serie/SerieContext.cs index fe642286..624e0d9e 100644 --- a/Runtime/Serie/SerieContext.cs +++ b/Runtime/Serie/SerieContext.cs @@ -119,5 +119,9 @@ public class SerieContext public Tooltip.Type tooltipType; public Tooltip.Trigger tooltipTrigger; public int totalDataIndex; + /// + /// 水平方向的 + /// + public bool isHorizontal; } } \ No newline at end of file