* UILineChart: 修复数据全为Nan时绘制出错

This commit is contained in:
Sunny 2022-08-17 13:48:37 +08:00
parent 13526d0ec3
commit 101f3a9133
3 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,7 @@
* 2022-07-30: V3.2.2 Series.XAxisDateTimeFormat
* 2022-07-30: V3.2.2 AxisLabel.DecimalPlaces
* 2022-07-30: V3.2.2 AxisLabel.DateTimeFormat
* 2022-08-17: V3.2.3 Nan时绘制出错
******************************************************************************/
using System;

View File

@ -234,6 +234,12 @@ namespace Sunny.UI
}
}
}
if (min > max)
{
min = 0;
max = 1;
}
}
}
@ -276,6 +282,12 @@ namespace Sunny.UI
}
}
}
if (min > max)
{
min = 0;
max = 1;
}
}
}
}

View File

@ -297,6 +297,8 @@ namespace Sunny.UI
/// <param name="penWidth">笔宽</param>
public static void DrawLine(this Graphics g, Color color, float x1, float y1, float x2, float y2, bool smooth = false, float penWidth = 1)
{
if (y1.IsNanOrInfinity() || y2.IsNanOrInfinity() || x1.IsNanOrInfinity() || x2.IsNanOrInfinity()) return;
using (Pen pen = color.Pen(penWidth))
{
g.Smooth(smooth);