修复饼图和环形图占比很小时不显示的问题

This commit is contained in:
monitor1394
2020-06-11 08:39:15 +08:00
parent 8c759fd94d
commit 77fd92d2b0

View File

@@ -815,6 +815,7 @@ namespace XCharts
radius -= borderWidth;
smoothness = (smoothness < 0 ? 2f : smoothness);
int segments = (int)((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
if (segments < 1) segments = 1;
float startAngle = startDegree * Mathf.Deg2Rad;
float toAngle = toDegree * Mathf.Deg2Rad;
float realStartAngle = startAngle;
@@ -1015,6 +1016,7 @@ namespace XCharts
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
int segments = (int)((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
if (segments < 1) segments = 1;
float startAngle = startDegree * Mathf.Deg2Rad;
float toAngle = toDegree * Mathf.Deg2Rad;