mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 09:20:08 +00:00
Fixed chart name repeat check error #183
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
|
||||
## branch-2.0
|
||||
|
||||
* (2022.02.21) Fixed chart name repeat check error #183
|
||||
* (2022.02.17) Fixed bug where axis split line might be displayed outside the coordinate system #181
|
||||
* (2022.02.08) Fixed {d} formatter error when value is 0
|
||||
* (2022.02.08) Fixed `YAxis` `AxisLabel`'s `onZero` does not work
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
## branch-2.0
|
||||
|
||||
* (2022.02.21) 修复`Chart`的`chartName`重复检测问题 #183
|
||||
* (2022.02.17) 修复`Axis`的`SplitLine`可能会显示在坐标系外的问题 #181
|
||||
* (2022.02.08) 修复数据全0时`{d}`显示不正确的问题
|
||||
* (2022.02.08) 修复`YAxis`的`AxisLabel`的`onZero`参数不生效的问题
|
||||
|
||||
@@ -137,6 +137,12 @@ namespace XCharts
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(filed));
|
||||
}
|
||||
}
|
||||
if (XChartsMgr.Instance.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.HelpBox("chart name is repeated:" + m_ChartName.stringValue, MessageType.Error);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
BlockEnd();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace XCharts
|
||||
|
||||
public static string CheckChart(BaseGraph chart)
|
||||
{
|
||||
if(chart == null)
|
||||
if (chart == null)
|
||||
return string.Empty;
|
||||
if (chart is BaseChart)
|
||||
return CheckChart((BaseChart)chart);
|
||||
@@ -28,7 +28,7 @@ namespace XCharts
|
||||
|
||||
public static string CheckChart(BaseChart chart)
|
||||
{
|
||||
if(chart == null)
|
||||
if (chart == null)
|
||||
return string.Empty;
|
||||
var sb = ChartHelper.sb;
|
||||
sb.Length = 0;
|
||||
@@ -45,10 +45,10 @@ namespace XCharts
|
||||
private static void CheckName(BaseChart chart, StringBuilder sb)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chart.chartName)) return;
|
||||
var list = XChartsMgr.Instance.GetCharts(chart.chartName);
|
||||
if (list.Count > 1)
|
||||
if (XChartsMgr.Instance.IsRepeatChartName(chart))
|
||||
{
|
||||
sb.AppendFormat("warning:chart name is repeated: {0}\n", chart.chartName);
|
||||
var info = XChartsMgr.Instance.GetRepeatChartNameInfo(chart, chart.chartName);
|
||||
sb.AppendFormat("warning:chart name is repeated: {0}\n{1}", chart.chartName, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace XCharts
|
||||
public List<BaseChart> GetCharts(string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName)) return null;
|
||||
return m_ChartList.FindAll(chart => chartName.Equals(chartName));
|
||||
return m_ChartList.FindAll(chart => chartName.Equals(chart.chartName));
|
||||
}
|
||||
|
||||
public void RemoveChart(string chartName)
|
||||
@@ -299,6 +299,33 @@ namespace XCharts
|
||||
return m_ChartList.Contains(chart);
|
||||
}
|
||||
|
||||
public bool IsRepeatChartName(BaseChart chart, string chartName = null)
|
||||
{
|
||||
if(chartName == null)
|
||||
chartName = chart.chartName;
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return false;
|
||||
foreach (var temp in m_ChartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetRepeatChartNameInfo(BaseChart chart, string chartName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(chartName))
|
||||
return string.Empty;
|
||||
string result = "";
|
||||
foreach (var temp in m_ChartList)
|
||||
{
|
||||
if (temp != chart && chartName.Equals(temp.chartName))
|
||||
result += ChartHelper.GetFullName(temp.transform) + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void RemoveAllChartObject()
|
||||
{
|
||||
if (Instance.m_ChartList.Count == 0)
|
||||
|
||||
Reference in New Issue
Block a user