mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +00:00
增加Heatmap的maxCache参数支持
This commit is contained in:
@@ -609,12 +609,14 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (maxCache > 0)
|
||||
{
|
||||
if (context.addedDataCount < m_Data.Count)
|
||||
context.addedDataCount = m_Data.Count;
|
||||
while (m_Data.Count >= maxCache)
|
||||
{
|
||||
RemoveData(m_InsertDataToHead ? m_Data.Count - 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
context.addedDataCount++;
|
||||
if (m_InsertDataToHead)
|
||||
m_Data.Insert(0, category);
|
||||
else
|
||||
@@ -623,6 +625,16 @@ namespace XCharts.Runtime
|
||||
SetAllDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the history data count.
|
||||
/// ||获得添加过的历史数据总数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetAddedDataCount()
|
||||
{
|
||||
return context.addedDataCount < m_Data.Count ? m_Data.Count : context.addedDataCount;
|
||||
}
|
||||
|
||||
public void RemoveData(int dataIndex)
|
||||
{
|
||||
context.isNeedUpdateFilterData = true;
|
||||
|
||||
@@ -66,6 +66,10 @@ namespace XCharts.Runtime
|
||||
public List<double> labelValueList { get { return m_LabelValueList; } }
|
||||
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
|
||||
public int dataZoomStartIndex;
|
||||
/// <summary>
|
||||
/// 添加过的历史数据总数
|
||||
/// </summary>
|
||||
public int addedDataCount;
|
||||
|
||||
internal List<string> filterData;
|
||||
internal bool lastCheckInverse;
|
||||
@@ -81,6 +85,7 @@ namespace XCharts.Runtime
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
addedDataCount = 0;
|
||||
m_RuntimeData.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -543,11 +543,14 @@ namespace XCharts.Runtime
|
||||
/// <param name="axis"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)
|
||||
public static int GetAxisValueSplitIndex(Axis axis, double value, bool checkMaxCache, int totalSplitNumber = -1)
|
||||
{
|
||||
if (axis.IsCategory())
|
||||
{
|
||||
return (int)value;
|
||||
if (checkMaxCache)
|
||||
return axis.maxCache > 0 ? (int)value - (axis.GetAddedDataCount() - axis.data.Count) : (int)value;
|
||||
else
|
||||
return (int)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user