From a4281288ee6da867d2fdbd58873e70ce79748017 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sat, 21 Nov 2020 08:42:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D`LineChart`=E7=9A=84=E5=88=BB?= =?UTF-8?q?=E5=BA=A6=E4=BD=8D=E7=BD=AE=E5=9C=A8`alignWithLabel`=E4=B8=BA`t?= =?UTF-8?q?rue`=E6=97=B6=E5=8F=AF=E8=83=BD=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/XCharts/CHANGELOG-EN.md | 2 ++ Assets/XCharts/CHANGELOG.md | 2 ++ Assets/XCharts/Runtime/Internal/Helper/AxisHelper.cs | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Assets/XCharts/CHANGELOG-EN.md b/Assets/XCharts/CHANGELOG-EN.md index 839febf5..3011fa25 100644 --- a/Assets/XCharts/CHANGELOG-EN.md +++ b/Assets/XCharts/CHANGELOG-EN.md @@ -1,6 +1,8 @@ # 更新日志 +* (2020.11.21) Fixed an issue where the scale position of `LineChart` could be abnormal if `alignWithLabel` was `true` +* (2020.11.21) Fixed `Unity5` compatibility error reporting problem * (2020.11.13) Improved `RadarChart` `Indicator` support for `\n` line feed * (2020.11.12) Fixed `LineChart` reporting errors when the type was `Smooth` when the data was too secure #100 * (2020.10.22) Improve the support of `VisualMap` for `Piecewise` in `HeatmapChart` diff --git a/Assets/XCharts/CHANGELOG.md b/Assets/XCharts/CHANGELOG.md index a05247c8..96492c72 100644 --- a/Assets/XCharts/CHANGELOG.md +++ b/Assets/XCharts/CHANGELOG.md @@ -1,6 +1,8 @@ # 更新日志 +* (2020.11.21) 修复`LineChart`的刻度位置在`alignWithLabel`为`true`时可能异常的问题 +* (2020.11.21) 修复`Unity5`兼容报错的问题 * (2020.11.13) 完善`RadarChart`的`Indicator`对`\n`换行的支持 * (2020.11.12) 修复`LineChart`当类型为`Smooth`时数据过密情况下报错的问题 #100 * (2020.10.22) 完善`HeatmapChart`中`VisualMap`对`Piecewise`的支持 diff --git a/Assets/XCharts/Runtime/Internal/Helper/AxisHelper.cs b/Assets/XCharts/Runtime/Internal/Helper/AxisHelper.cs index 5b9fbdf3..ee560d0e 100644 --- a/Assets/XCharts/Runtime/Internal/Helper/AxisHelper.cs +++ b/Assets/XCharts/Runtime/Internal/Helper/AxisHelper.cs @@ -214,7 +214,11 @@ internal static float GetScaleWidth(Axis axis, float coordinateWidth, int index, var count = axis.boundaryGap ? axis.data.Count : axis.data.Count - 1; if (count <= 0) return 0; var each = coordinateWidth / count; - if (index >= num - 1) return coordinateWidth - each * tick * (index - 1); + if (index >= num - 1) + { + if (axis.axisTick.alignWithLabel) return each * tick; + else return coordinateWidth - each * tick * (index - 1); + } else return each * tick; } else