增加Check warning检测功能

This commit is contained in:
monitor1394
2020-04-11 15:18:34 +08:00
parent 80a946d0c6
commit c5b810df8b
8 changed files with 261 additions and 1 deletions

View File

@@ -1053,6 +1053,33 @@ namespace XCharts
return serieNameList;
}
internal List<string> GetLegalSerieNameList()
{
var list = new List<string>();
for (int n = 0; n < m_Series.Count; n++)
{
var serie = m_Series[n];
switch (serie.type)
{
case SerieType.Pie:
case SerieType.Radar:
case SerieType.Ring:
for (int i = 0; i < serie.data.Count; i++)
{
var dataName = serie.data[i].name;
if (!string.IsNullOrEmpty(dataName) && IsLegalLegendName(dataName) && !list.Contains(dataName))
list.Add(dataName);
}
break;
default:
if (!string.IsNullOrEmpty(serie.name) && !list.Contains(serie.name) && IsLegalLegendName(serie.name))
list.Add(serie.name);
break;
}
}
return list;
}
/// <summary>
/// 设置获得标志图形大小的回调
/// </summary>

View File

@@ -1,4 +1,5 @@
/******************************************/
using System.Text;
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
@@ -292,6 +293,28 @@ namespace XCharts
else return Color.clear;
}
public void CheckWarning(StringBuilder sb)
{
if (m_Font == null && m_CustomFont == null)
{
sb.AppendFormat("warning:theme->font is null");
}
if (m_ColorPalette.Length == 0 && m_CustomColorPalette.Count == 0)
{
sb.AppendFormat("warning:theme->colorPalette is empty");
}
for (int i = 0; i < m_ColorPalette.Length; i++)
{
if (m_ColorPalette[i] != Color.clear && m_ColorPalette[i].a == 0)
sb.AppendFormat("warning:theme->colorPalette[{0}] alpha = 0\n", i);
}
for (int i = 0; i < m_CustomColorPalette.Count; i++)
{
if (m_CustomColorPalette[i] != Color.clear && m_CustomColorPalette[i].a == 0)
sb.AppendFormat("warning:theme->colorPalette[{0}] alpha = 0\n", i);
}
}
Dictionary<int, string> _colorDic = new Dictionary<int, string>();
/// <summary>
/// Gets the hexadecimal color string of the specified index from the palette.