mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 08:50:10 +00:00
优化代码,更好的支持自定义图表
This commit is contained in:
@@ -757,7 +757,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal float GetCurrMinValue(float duration)
|
||||
public float GetCurrMinValue(float duration)
|
||||
{
|
||||
if (!Application.isPlaying) return m_RuntimeMinValue;
|
||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||
@@ -777,7 +777,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal float GetCurrMaxValue(float duration)
|
||||
public float GetCurrMaxValue(float duration)
|
||||
{
|
||||
if (!Application.isPlaying) return m_RuntimeMaxValue;
|
||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||
|
||||
@@ -1029,7 +1029,7 @@ namespace XCharts
|
||||
public float runtimePieDataTotal { get; internal set; }
|
||||
public float runtimeWaveSpeed { get; internal set; }
|
||||
public Painter runtimeCanvas { get; internal set; }
|
||||
internal float runtimeCheckValue { get; set; }
|
||||
public float runtimeCheckValue { get; set; }
|
||||
public int runtimeGridIndex { get; internal set; }
|
||||
public float runtimeX { get; internal set; }
|
||||
public float runtimeY { get; internal set; }
|
||||
@@ -1644,7 +1644,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
internal float GetBarWidth(float categoryWidth)
|
||||
public float GetBarWidth(float categoryWidth)
|
||||
{
|
||||
if (m_BarWidth > 1) return m_BarWidth;
|
||||
else return m_BarWidth * categoryWidth;
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace XCharts
|
||||
private Image m_ContentImage;
|
||||
private RectTransform m_ContentRect;
|
||||
private RectTransform m_ContentTextRect;
|
||||
private List<int> lastDataIndex { get; set; }
|
||||
private List<int> lastDataIndex = new List<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show the tooltip component.
|
||||
@@ -246,22 +246,25 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 当前提示框所指示的Serie索引(目前只对散点图有效)。
|
||||
/// </summary>
|
||||
public Dictionary<int, List<int>> runtimeSerieIndex { get; internal set; }
|
||||
public Dictionary<int, List<int>> runtimeSerieIndex = new Dictionary<int, List<int>>();
|
||||
/// <summary>
|
||||
/// The data index currently indicated by Tooltip.
|
||||
/// 当前提示框所指示的数据项索引。
|
||||
/// </summary>
|
||||
public List<int> runtimeDataIndex { get; internal set; }
|
||||
public List<int> runtimeDataIndex { get { return m_RuntimeDateIndex; } internal set { m_RuntimeDateIndex = value; } }
|
||||
private List<int> m_RuntimeDateIndex = new List<int>() { -1, -1 };
|
||||
/// <summary>
|
||||
/// the value for x indicator label.
|
||||
/// 指示器X轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] runtimeXValues { get; internal set; }
|
||||
public float[] runtimeXValues { get { return m_RuntimeXValue; } internal set { m_RuntimeXValue = value; } }
|
||||
private float[] m_RuntimeXValue = new float[2] { -1, -1 };
|
||||
/// <summary>
|
||||
/// the value for y indicator label.
|
||||
/// 指示器Y轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] runtimeYValues { get; internal set; }
|
||||
public float[] runtimeYValues { get { return m_RuntimeYValue; } internal set { m_RuntimeYValue = value; } }
|
||||
private float[] m_RuntimeYValue = new float[2] { -1, -1 };
|
||||
/// <summary>
|
||||
/// the current pointer position.
|
||||
/// 当前鼠标位置。
|
||||
@@ -303,12 +306,7 @@ namespace XCharts
|
||||
{
|
||||
var tooltip = new Tooltip
|
||||
{
|
||||
m_Show = true,
|
||||
runtimeXValues = new float[2] { -1, -1 },
|
||||
runtimeYValues = new float[2] { -1, -1 },
|
||||
runtimeDataIndex = new List<int>() { -1, -1 },
|
||||
lastDataIndex = new List<int>() { -1, -1 },
|
||||
runtimeSerieIndex = new Dictionary<int, List<int>>()
|
||||
m_Show = true
|
||||
};
|
||||
return tooltip;
|
||||
}
|
||||
@@ -438,7 +436,8 @@ namespace XCharts
|
||||
public void SetActive(bool flag)
|
||||
{
|
||||
if (!flag && m_AlwayShow) return;
|
||||
lastDataIndex[0] = lastDataIndex[1] = -1;
|
||||
if (lastDataIndex.Count >= 2)
|
||||
lastDataIndex[0] = lastDataIndex[1] = -1;
|
||||
if (m_GameObject && m_GameObject.activeInHierarchy != flag)
|
||||
m_GameObject.SetActive(flag);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user