mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 18:00:26 +00:00
修复LineChart当类型为Smooth时数据过密情况下报错的问题 #101
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.11.12) Fixed `LineChart` reporting errors when the type was `Smooth` when the data was too secure #101
|
||||||
* (2020.10.22) Improve the support of `VisualMap` for `Piecewise` in `HeatmapChart`
|
* (2020.10.22) Improve the support of `VisualMap` for `Piecewise` in `HeatmapChart`
|
||||||
* (2020.09.22) Fixed `PieChart` inconsistent border size
|
* (2020.09.22) Fixed `PieChart` inconsistent border size
|
||||||
* (2020.09.18) Added `Remove All Chart Object` to Remove All child nodes under the Chart (automatically reinitialized)
|
* (2020.09.18) Added `Remove All Chart Object` to Remove All child nodes under the Chart (automatically reinitialized)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.11.12) 修复`LineChart`当类型为`Smooth`时数据过密情况下报错的问题 #101
|
||||||
* (2020.10.22) 完善`HeatmapChart`中`VisualMap`对`Piecewise`的支持
|
* (2020.10.22) 完善`HeatmapChart`中`VisualMap`对`Piecewise`的支持
|
||||||
* (2020.09.22) 修复`PieChart`边框大小不一致的问题
|
* (2020.09.22) 修复`PieChart`边框大小不一致的问题
|
||||||
* (2020.09.19) 发布`v1.6.1`版本
|
* (2020.09.19) 发布`v1.6.1`版本
|
||||||
|
|||||||
@@ -341,9 +341,16 @@ namespace XCharts
|
|||||||
if (segment < 1) segment = (int)(dist / 0.5f);
|
if (segment < 1) segment = (int)(dist / 0.5f);
|
||||||
if (segment < 4) segment = 4;
|
if (segment < 4) segment = 4;
|
||||||
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
|
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
|
||||||
|
if (posList.Count < 2)
|
||||||
|
{
|
||||||
|
posList.Clear();
|
||||||
|
posList.Add(sp);
|
||||||
|
posList.Add(ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GetBezierListVertical(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float smoothness = 2f, float k = 2.0f)
|
public static void GetBezierListVertical(ref List<Vector3> posList, Vector3 sp, Vector3 ep,
|
||||||
|
float smoothness = 2f, float k = 2.0f)
|
||||||
{
|
{
|
||||||
Vector3 dir = (ep - sp).normalized;
|
Vector3 dir = (ep - sp).normalized;
|
||||||
float dist = Vector3.Distance(sp, ep);
|
float dist = Vector3.Distance(sp, ep);
|
||||||
@@ -353,6 +360,12 @@ namespace XCharts
|
|||||||
cp2.x = ep.x;
|
cp2.x = ep.x;
|
||||||
int segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
|
int segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
|
||||||
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
|
GetBezierList2(ref posList, sp, ep, segment, cp1, cp2);
|
||||||
|
if (posList.Count < 2)
|
||||||
|
{
|
||||||
|
posList.Clear();
|
||||||
|
posList.Add(sp);
|
||||||
|
posList.Add(ep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)
|
public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)
|
||||||
|
|||||||
Reference in New Issue
Block a user