From 6ae4468aa26958254591bace121c0c3782df7391 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sun, 28 Aug 2022 17:34:22 +0800 Subject: [PATCH] [bug][line] fix linechart error when stack and custom y range. --- CHANGELOG.md | 1 + Runtime/Serie/Line/LineHandler.GridCoord.cs | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22c48741..653c567b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ ## master +* (2022.08.28) 修复`LineChart`在堆叠和自定义Y轴范围的情况下显示不正常的问题 * (2022.08.26) 增加`Legend`新图标类型`Candlestick` * (2022.08.26) 优化`CandlestickChart`表现,调整相关的`AddData()`接口参数 * (2022.08.26) 增加`Tooltip`的`position`参数支持设置移动平台不同的显示位置 diff --git a/Runtime/Serie/Line/LineHandler.GridCoord.cs b/Runtime/Serie/Line/LineHandler.GridCoord.cs index c3760d1c..b5cf3c92 100644 --- a/Runtime/Serie/Line/LineHandler.GridCoord.cs +++ b/Runtime/Serie/Line/LineHandler.GridCoord.cs @@ -372,14 +372,12 @@ namespace XCharts.Runtime float xPos, yPos; var gridXY = isY ? grid.context.x : grid.context.y; var valueHig = 0f; + valueHig = AxisHelper.GetAxisValueDistance(grid, relativedAxis, scaleWid, yValue); + valueHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, valueHig); if (isY) { - valueHig = AxisHelper.GetAxisValueDistance(grid, relativedAxis, scaleWid, yValue); - valueHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, valueHig); - xPos = gridXY + valueHig; yPos = AxisHelper.GetAxisValuePosition(grid, axis, scaleWid, xValue); - if (isStack) { for (int n = 0; n < m_StackSerieData.Count - 1; n++) @@ -388,13 +386,8 @@ namespace XCharts.Runtime } else { - - valueHig = AxisHelper.GetAxisValueDistance(grid, relativedAxis, scaleWid, yValue); - valueHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, valueHig); - yPos = gridXY + valueHig; xPos = AxisHelper.GetAxisValuePosition(grid, axis, scaleWid, xValue); - if (isStack) { for (int n = 0; n < m_StackSerieData.Count - 1; n++) @@ -402,7 +395,7 @@ namespace XCharts.Runtime } } np = new Vector3(xPos, yPos); - return valueHig; + return AxisHelper.GetAxisValueLength(grid, relativedAxis, scaleWid, yValue); } } } \ No newline at end of file