diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 732f0907..3c9a5127 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -69,6 +69,7 @@ slug: /changelog ## master +* (2023.10.11) 修复`MarkLine`指定`yValue`时对数值轴无效的问题 * (2023.10.11) 修复`Serie`的`showDataDimension`设置无效的问题 ## v3.8.1 diff --git a/Runtime/Component/Mark/MarkLineHandler.cs b/Runtime/Component/Mark/MarkLineHandler.cs index 858097f1..533b1fbb 100644 --- a/Runtime/Component/Mark/MarkLineHandler.cs +++ b/Runtime/Component/Mark/MarkLineHandler.cs @@ -125,19 +125,19 @@ namespace XCharts.Runtime { case MarkLineType.Min: data.runtimeValue = SerieHelper.GetMinData(serie, data.dimension, dataZoom); - GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep); + GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep); break; case MarkLineType.Max: data.runtimeValue = SerieHelper.GetMaxData(serie, data.dimension, dataZoom); - GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep); + GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep); break; case MarkLineType.Average: data.runtimeValue = SerieHelper.GetAverageData(serie, data.dimension, dataZoom); - GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep); + GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep); break; case MarkLineType.Median: data.runtimeValue = SerieHelper.GetMedianData(serie, data.dimension, dataZoom); - GetStartEndPos(xAxis, yAxis, grid, data.runtimeValue, ref sp, ref ep); + GetStartEndPos(yAxis, grid, data.runtimeValue, ref sp, ref ep); break; case MarkLineType.None: if (data.xPosition != 0) @@ -165,7 +165,7 @@ namespace XCharts.Runtime } else { - GetStartEndPos(xAxis, yAxis, grid, data.yValue, ref sp, ref ep); + GetStartEndPos(yAxis, grid, data.yValue, ref sp, ref ep); } } else @@ -179,7 +179,7 @@ namespace XCharts.Runtime } else { - GetStartEndPos(xAxis, yAxis, grid, data.xValue, ref sp, ref ep); + GetStartEndPos(xAxis, grid, data.xValue, ref sp, ref ep); } } break; @@ -258,11 +258,11 @@ namespace XCharts.Runtime ColorUtil.clearColor32, borderColor, symbol.gap, serie.clip, cornerRadius, grid, startPos); } - private void GetStartEndPos(Axis xAxis, Axis yAxis, GridCoord grid, double value, ref Vector3 sp, ref Vector3 ep) + private void GetStartEndPos(Axis xAxis, GridCoord grid, double value, ref Vector3 sp, ref Vector3 ep) { - if (xAxis.IsCategory()) + if (xAxis is YAxis) { - var pY = AxisHelper.GetAxisPosition(grid, yAxis, value); + var pY = AxisHelper.GetAxisPosition(grid, xAxis, value); sp = new Vector3(grid.context.x, pY); ep = new Vector3(grid.context.x + grid.context.width, pY); }