* UIBarChart: 增加数据可为Nan
This commit is contained in:
parent
101f3a9133
commit
8f0f262d33
@ -25,6 +25,7 @@
|
|||||||
* 2022-07-29: V3.2.2 数据显示的小数位数重构调整至数据序列 Series.DecimalPlaces
|
* 2022-07-29: V3.2.2 数据显示的小数位数重构调整至数据序列 Series.DecimalPlaces
|
||||||
* 2022-07-30: V3.2.2 坐标轴的小数位数重构调整至坐标轴标签 AxisLabel.DecimalPlaces
|
* 2022-07-30: V3.2.2 坐标轴的小数位数重构调整至坐标轴标签 AxisLabel.DecimalPlaces
|
||||||
* 2022-08-10: V3.2.2 修复Y轴显示名称
|
* 2022-08-10: V3.2.2 修复Y轴显示名称
|
||||||
|
* 2022-08-17: V3.2.3 增加数据可为Nan
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -33,7 +34,6 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
@ -107,11 +107,21 @@ namespace Sunny.UI
|
|||||||
{
|
{
|
||||||
if (series.Data.Count > 0)
|
if (series.Data.Count > 0)
|
||||||
{
|
{
|
||||||
min = Math.Min(min, series.Data.Min());
|
for (int i = 0; i < series.Data.Count; i++)
|
||||||
max = Math.Max(max, series.Data.Max());
|
{
|
||||||
|
if (series.Data[i].IsNanOrInfinity()) continue;
|
||||||
|
min = Math.Min(min, series.Data[i]);
|
||||||
|
max = Math.Max(max, series.Data[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (min > max)
|
||||||
|
{
|
||||||
|
min = 0;
|
||||||
|
max = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (min > 0 && max > 0 && !Option.YAxis.Scale) min = 0;
|
if (min > 0 && max > 0 && !Option.YAxis.Scale) min = 0;
|
||||||
if (min < 0 && max < 0 && !Option.YAxis.Scale) max = 0;
|
if (min < 0 && max < 0 && !Option.YAxis.Scale) max = 0;
|
||||||
if (!Option.YAxis.MaxAuto) max = Option.YAxis.Max;
|
if (!Option.YAxis.MaxAuto) max = Option.YAxis.Max;
|
||||||
@ -468,6 +478,8 @@ namespace Sunny.UI
|
|||||||
if (Option.YAxis.AxisTick.Show)
|
if (Option.YAxis.AxisTick.Show)
|
||||||
{
|
{
|
||||||
g.DrawLine(ForeColor, DrawOrigin.X, labels[i], DrawOrigin.X - Option.YAxis.AxisTick.Length, labels[i]);
|
g.DrawLine(ForeColor, DrawOrigin.X, labels[i], DrawOrigin.X - Option.YAxis.AxisTick.Length, labels[i]);
|
||||||
|
|
||||||
|
if (YLabels[i].IsNanOrInfinity()) continue;
|
||||||
if (!YLabels[i].EqualsDouble(0))
|
if (!YLabels[i].EqualsDouble(0))
|
||||||
{
|
{
|
||||||
using (Pen pn = new Pen(ForeColor))
|
using (Pen pn = new Pen(ForeColor))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user