mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 19:00:24 +00:00
[optimize][serie] optimize index of serieData
This commit is contained in:
@@ -57,6 +57,7 @@ namespace XCharts.Runtime
|
||||
m_LastCheckContextFlag = needCheck;
|
||||
var themeSymbolSize = chart.theme.serie.lineSymbolSize;
|
||||
var needInteract = false;
|
||||
serie.ResetDataIndex();
|
||||
if (m_LegendEnter)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
@@ -112,7 +113,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
if (lastIndex != serie.context.pointerItemDataIndex)
|
||||
{
|
||||
needInteract = true;
|
||||
}
|
||||
}
|
||||
if (needInteract)
|
||||
{
|
||||
|
||||
@@ -1159,6 +1159,23 @@ namespace XCharts.Runtime
|
||||
serieData.interact.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置数据项索引。避免部分数据项的索引异常。
|
||||
/// </summary>
|
||||
public bool ResetDataIndex()
|
||||
{
|
||||
var flag = false;
|
||||
for (int i = 0; i < m_Data.Count; i++)
|
||||
{
|
||||
if (m_Data[i].index != i)
|
||||
{
|
||||
m_Data[i].index = i;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有数据
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user