mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
优化组件非配置参数变量的命名和访问权限
This commit is contained in:
@@ -208,22 +208,22 @@ namespace XCharts
|
||||
/// the current minimun value.
|
||||
/// 当前最小值。
|
||||
/// </summary>
|
||||
public float minValue { get; set; }
|
||||
public float runtimeMinValue { get; internal set; }
|
||||
/// <summary>
|
||||
/// the current maximum value.
|
||||
/// 当前最大值。
|
||||
/// </summary>
|
||||
public float maxValue { get; set; }
|
||||
public float runtimeMaxValue { get; internal set; }
|
||||
/// <summary>
|
||||
/// the x offset of zero position.
|
||||
/// 坐标轴原点在X轴的偏移。
|
||||
/// </summary>
|
||||
public float zeroXOffset { get; set; }
|
||||
public float runtimeZeroXOffset { get; internal set; }
|
||||
/// <summary>
|
||||
/// the y offset of zero position.
|
||||
/// 坐标轴原点在Y轴的偏移。
|
||||
/// </summary>
|
||||
public float zeroYOffset { get; set; }
|
||||
public float runtimeZeroYOffset { get; internal set; }
|
||||
|
||||
private int filterStart;
|
||||
private int filterEnd;
|
||||
@@ -301,7 +301,7 @@ namespace XCharts
|
||||
/// <param name="index">类目数据索引</param>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
/// <returns></returns>
|
||||
public string GetData(int index, DataZoom dataZoom)
|
||||
internal string GetData(int index, DataZoom dataZoom)
|
||||
{
|
||||
var showData = GetDataList(dataZoom);
|
||||
if (index >= 0 && index < showData.Count)
|
||||
@@ -315,7 +315,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="dataZoom">区域缩放</param>
|
||||
/// <returns></returns>
|
||||
public List<string> GetDataList(DataZoom dataZoom)
|
||||
internal List<string> GetDataList(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
@@ -333,7 +333,7 @@ namespace XCharts
|
||||
/// 更新dataZoom对应的类目数据列表
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
internal void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
@@ -366,7 +366,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetSplitNumber(float coordinateWid, DataZoom dataZoom)
|
||||
internal int GetSplitNumber(float coordinateWid, DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value)
|
||||
{
|
||||
@@ -398,7 +398,7 @@ namespace XCharts
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
internal float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
||||
int segment = (m_BoundaryGap ? split : split - 1);
|
||||
@@ -411,7 +411,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetDataNumber(DataZoom dataZoom)
|
||||
internal int GetDataNumber(DataZoom dataZoom)
|
||||
{
|
||||
return GetDataList(dataZoom).Count;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ namespace XCharts
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetDataWidth(float coordinateWidth, int dataCount, DataZoom dataZoom)
|
||||
internal float GetDataWidth(float coordinateWidth, int dataCount, DataZoom dataZoom)
|
||||
{
|
||||
if (dataCount < 1) dataCount = 1;
|
||||
var categoryCount = GetDataNumber(dataZoom);
|
||||
@@ -439,7 +439,7 @@ namespace XCharts
|
||||
/// <param name="maxValue"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public string GetLabelName(float coordinateWidth, int index, float minValue, float maxValue,
|
||||
internal string GetLabelName(float coordinateWidth, int index, float minValue, float maxValue,
|
||||
DataZoom dataZoom, bool forcePercent)
|
||||
{
|
||||
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
||||
@@ -483,7 +483,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public int GetScaleNumber(float coordinateWidth, DataZoom dataZoom)
|
||||
internal int GetScaleNumber(float coordinateWidth, DataZoom dataZoom)
|
||||
{
|
||||
if (type == AxisType.Value)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ namespace XCharts
|
||||
/// <param name="coordinateWidth"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetScaleWidth(float coordinateWidth, int index, DataZoom dataZoom)
|
||||
internal float GetScaleWidth(float coordinateWidth, int index, DataZoom dataZoom)
|
||||
{
|
||||
int num = GetScaleNumber(coordinateWidth, dataZoom) - 1;
|
||||
if (num <= 0) num = 1;
|
||||
@@ -528,18 +528,18 @@ namespace XCharts
|
||||
/// 更新刻度标签文字
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateLabelText(float coordinateWidth, DataZoom dataZoom, bool forcePercent)
|
||||
internal void UpdateLabelText(float coordinateWidth, DataZoom dataZoom, bool forcePercent)
|
||||
{
|
||||
for (int i = 0; i < axisLabelTextList.Count; i++)
|
||||
{
|
||||
if (axisLabelTextList[i] != null)
|
||||
{
|
||||
axisLabelTextList[i].text = GetLabelName(coordinateWidth, i, minValue, maxValue, dataZoom, forcePercent);
|
||||
axisLabelTextList[i].text = GetLabelName(coordinateWidth, i, runtimeMinValue, runtimeMaxValue, dataZoom, forcePercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTooltipLabel(GameObject label)
|
||||
internal void SetTooltipLabel(GameObject label)
|
||||
{
|
||||
m_TooltipLabel = label;
|
||||
m_TooltipLabelRect = label.GetComponent<RectTransform>();
|
||||
@@ -547,13 +547,13 @@ namespace XCharts
|
||||
m_TooltipLabel.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetTooltipLabelColor(Color bgColor, Color textColor)
|
||||
internal void SetTooltipLabelColor(Color bgColor, Color textColor)
|
||||
{
|
||||
m_TooltipLabel.GetComponent<Image>().color = bgColor;
|
||||
m_TooltipLabelText.color = textColor;
|
||||
}
|
||||
|
||||
public void SetTooltipLabelActive(bool flag)
|
||||
internal void SetTooltipLabelActive(bool flag)
|
||||
{
|
||||
if (m_TooltipLabel && m_TooltipLabel.activeInHierarchy != flag)
|
||||
{
|
||||
@@ -561,7 +561,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTooptipLabelText(string text)
|
||||
internal void UpdateTooptipLabelText(string text)
|
||||
{
|
||||
if (m_TooltipLabelText)
|
||||
{
|
||||
@@ -571,7 +571,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTooltipLabelPos(Vector2 pos)
|
||||
internal void UpdateTooltipLabelPos(Vector2 pos)
|
||||
{
|
||||
if (m_TooltipLabel)
|
||||
{
|
||||
@@ -591,7 +591,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void AdjustMinMaxValue(ref float minValue, ref float maxValue)
|
||||
internal void AdjustMinMaxValue(ref float minValue, ref float maxValue)
|
||||
{
|
||||
if (minMaxType == Axis.AxisMinMaxType.Custom)
|
||||
{
|
||||
@@ -663,8 +663,8 @@ namespace XCharts
|
||||
m_AxisLabel.Equals(other.axisLabel) &&
|
||||
splitLineType == other.splitLineType &&
|
||||
boundaryGap == other.boundaryGap &&
|
||||
minValue == other.minValue &&
|
||||
maxValue == other.maxValue &&
|
||||
runtimeMinValue == other.runtimeMinValue &&
|
||||
runtimeMaxValue == other.runtimeMaxValue &&
|
||||
axisName.Equals(other.axisName) &&
|
||||
ChartHelper.IsValueEqualsList<string>(m_Data, other.data);
|
||||
}
|
||||
|
||||
@@ -208,12 +208,12 @@ namespace XCharts
|
||||
/// The start label.
|
||||
/// 组件的开始信息文本。
|
||||
/// </summary>
|
||||
public Text startLabel { get; set; }
|
||||
private Text m_StartLabel { get; set; }
|
||||
/// <summary>
|
||||
/// The end label.
|
||||
/// 组件的结束信息文本。
|
||||
/// </summary>
|
||||
public Text endLabel { get; set; }
|
||||
private Text m_EndLabel { get; set; }
|
||||
|
||||
public static DataZoom defaultDataZoom
|
||||
{
|
||||
@@ -297,15 +297,15 @@ namespace XCharts
|
||||
/// 是否显示文本
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
public void SetLabelActive(bool flag)
|
||||
internal void SetLabelActive(bool flag)
|
||||
{
|
||||
if (startLabel && startLabel.gameObject.activeInHierarchy != flag)
|
||||
if (m_StartLabel && m_StartLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
startLabel.gameObject.SetActive(flag);
|
||||
m_StartLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
if (endLabel && endLabel.gameObject.activeInHierarchy != flag)
|
||||
if (m_EndLabel && m_EndLabel.gameObject.activeInHierarchy != flag)
|
||||
{
|
||||
endLabel.gameObject.SetActive(flag);
|
||||
m_EndLabel.gameObject.SetActive(flag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,18 +313,18 @@ namespace XCharts
|
||||
/// 设置开始文本内容
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void SetStartLabelText(string text)
|
||||
internal void SetStartLabelText(string text)
|
||||
{
|
||||
if (startLabel) startLabel.text = text;
|
||||
if (m_StartLabel) m_StartLabel.text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置结束文本内容
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public void SetEndLabelText(string text)
|
||||
internal void SetEndLabelText(string text)
|
||||
{
|
||||
if (endLabel) endLabel.text = text;
|
||||
if (m_EndLabel) m_EndLabel.text = text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -332,7 +332,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="gridBottom"></param>
|
||||
/// <returns></returns>
|
||||
public float GetHeight(float gridBottom)
|
||||
internal float GetHeight(float gridBottom)
|
||||
{
|
||||
if (height <= 0)
|
||||
{
|
||||
@@ -342,5 +342,25 @@ namespace XCharts
|
||||
}
|
||||
else return height;
|
||||
}
|
||||
|
||||
internal void SetStartLabel(Text startLabel)
|
||||
{
|
||||
m_StartLabel = startLabel;
|
||||
}
|
||||
|
||||
internal void SetEndLabel(Text endLabel)
|
||||
{
|
||||
m_EndLabel = endLabel;
|
||||
}
|
||||
|
||||
internal void UpdateStartLabelPosition(Vector3 pos)
|
||||
{
|
||||
m_StartLabel.transform.localPosition = pos;
|
||||
}
|
||||
|
||||
internal void UpdateEndLabelPosition(Vector3 pos)
|
||||
{
|
||||
m_EndLabel.transform.localPosition = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -162,20 +162,17 @@ namespace XCharts
|
||||
/// the center position of radar in container.
|
||||
/// 雷达图在容器中的具体中心点。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Vector2 centerPos { get; set; }
|
||||
public Vector2 runtimeCenterPos { get; internal set; }
|
||||
/// <summary>
|
||||
/// the true radius of radar.
|
||||
/// 雷达图的运行时实际半径。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float actualRadius { get; set; }
|
||||
public float runtimeRadius { get; internal set; }
|
||||
/// <summary>
|
||||
/// the data position list of radar.
|
||||
/// 雷达图的所有数据坐标点列表。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int, List<Vector3>> dataPosList = new Dictionary<int, List<Vector3>>();
|
||||
public Dictionary<int, List<Vector3>> runtimeDataPosList = new Dictionary<int, List<Vector3>>();
|
||||
|
||||
public static Radar defaultRadar
|
||||
{
|
||||
@@ -344,23 +341,23 @@ namespace XCharts
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void UpdateRadarCenter(float chartWidth, float chartHeight)
|
||||
internal void UpdateRadarCenter(float chartWidth, float chartHeight)
|
||||
{
|
||||
if (center.Length < 2) return;
|
||||
var centerX = center[0] <= 1 ? chartWidth * center[0] : center[0];
|
||||
var centerY = center[1] <= 1 ? chartHeight * center[1] : center[1];
|
||||
centerPos = new Vector2(centerX, centerY);
|
||||
runtimeCenterPos = new Vector2(centerX, centerY);
|
||||
if (radius <= 0)
|
||||
{
|
||||
actualRadius = 0;
|
||||
runtimeRadius = 0;
|
||||
}
|
||||
else if (radius <= 1)
|
||||
{
|
||||
actualRadius = Mathf.Min(chartWidth, chartHeight) * radius;
|
||||
runtimeRadius = Mathf.Min(chartWidth, chartHeight) * radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
actualRadius = radius;
|
||||
runtimeRadius = radius;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,8 +365,8 @@ namespace XCharts
|
||||
{
|
||||
int indicatorNum = indicatorList.Count;
|
||||
var angle = 2 * Mathf.PI / indicatorNum * index;
|
||||
var x = centerPos.x + actualRadius * Mathf.Sin(angle);
|
||||
var y = centerPos.y + actualRadius * Mathf.Cos(angle);
|
||||
var x = runtimeCenterPos.x + runtimeRadius * Mathf.Sin(angle);
|
||||
var y = runtimeCenterPos.y + runtimeRadius * Mathf.Cos(angle);
|
||||
return new Vector3(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,12 +426,12 @@ namespace XCharts
|
||||
/// The index of serie,start at 0.
|
||||
/// 系列的索引,从0开始。
|
||||
/// </summary>
|
||||
public int index { get; set; }
|
||||
public int index { get; internal set; }
|
||||
/// <summary>
|
||||
/// Whether the serie is highlighted.
|
||||
/// 该系列是否高亮,一般由图例悬停触发。
|
||||
/// </summary>
|
||||
public bool highlighted { get; set; }
|
||||
public bool highlighted { get; internal set; }
|
||||
/// <summary>
|
||||
/// the count of data list.
|
||||
/// 数据项个数。
|
||||
@@ -444,25 +444,25 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 饼图的中心点位置。
|
||||
/// </summary>
|
||||
public Vector3 pieCenterPos { get; set; }
|
||||
public Vector3 runtimePieCenterPos { get; internal set; }
|
||||
/// <summary>
|
||||
/// 饼图的内径
|
||||
/// </summary>
|
||||
public float pieInsideRadius { get; set; }
|
||||
public float runtimePieInsideRadius { get; internal set; }
|
||||
/// <summary>
|
||||
/// 饼图的外径
|
||||
/// </summary>
|
||||
public float pieOutsideRadius { get; set; }
|
||||
public float runtimePieOutsideRadius { get; internal set; }
|
||||
/// <summary>
|
||||
/// 饼图的数据项最大值
|
||||
/// </summary>
|
||||
public float pieDataMax { get; set; }
|
||||
public float runtimePieDataMax { get; internal set; }
|
||||
/// <summary>
|
||||
/// 饼图的数据项之和
|
||||
/// </summary>
|
||||
public float pieDataTotal { get; set; }
|
||||
public float runtimePieDataTotal { get; internal set; }
|
||||
|
||||
public List<Vector3> GetUpSmoothList(int dataIndex, int size = 100)
|
||||
internal List<Vector3> GetUpSmoothList(int dataIndex, int size = 100)
|
||||
{
|
||||
if (m_UpSmoothPoints.ContainsKey(dataIndex))
|
||||
{
|
||||
@@ -476,7 +476,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public List<Vector3> GetDownSmoothList(int dataIndex, int size = 100)
|
||||
internal List<Vector3> GetDownSmoothList(int dataIndex, int size = 100)
|
||||
{
|
||||
if (m_DownSmoothPoints.ContainsKey(dataIndex))
|
||||
{
|
||||
@@ -490,7 +490,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearSmoothList(int dataIndex)
|
||||
internal void ClearSmoothList(int dataIndex)
|
||||
{
|
||||
if (m_UpSmoothPoints.ContainsKey(dataIndex))
|
||||
{
|
||||
@@ -836,7 +836,7 @@ namespace XCharts
|
||||
/// 根据dataZoom更新数据列表缓存
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
internal void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
@@ -939,7 +939,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetAreaColor(ThemeInfo theme, int index, bool highlight)
|
||||
internal Color GetAreaColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
var color = areaStyle.color != Color.clear ? areaStyle.color : (Color)theme.GetColor(index);
|
||||
if (highlight)
|
||||
@@ -951,7 +951,7 @@ namespace XCharts
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color GetAreaToColor(ThemeInfo theme, int index, bool highlight)
|
||||
internal Color GetAreaToColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (areaStyle.toColor != Color.clear)
|
||||
{
|
||||
@@ -970,7 +970,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetLineColor(ThemeInfo theme, int index, bool highlight)
|
||||
internal Color GetLineColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (lineStyle.color != Color.clear)
|
||||
{
|
||||
@@ -988,7 +988,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public Color GetSymbolColor(ThemeInfo theme, int index, bool highlight)
|
||||
internal Color GetSymbolColor(ThemeInfo theme, int index, bool highlight)
|
||||
{
|
||||
if (symbol.color != Color.clear)
|
||||
{
|
||||
@@ -1006,13 +1006,13 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float GetBarWidth(float categoryWidth)
|
||||
internal float GetBarWidth(float categoryWidth)
|
||||
{
|
||||
if (m_BarWidth > 1) return m_BarWidth;
|
||||
else return m_BarWidth * categoryWidth;
|
||||
}
|
||||
|
||||
public float GetBarGap(float categoryWidth)
|
||||
internal float GetBarGap(float categoryWidth)
|
||||
{
|
||||
if (m_BarGap == -1) return 0;
|
||||
else if (m_BarGap <= 1) return GetBarWidth(categoryWidth) * m_BarGap;
|
||||
@@ -1073,7 +1073,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsNeedShowDataIcon()
|
||||
internal bool IsNeedShowDataIcon()
|
||||
{
|
||||
foreach (var data in m_Data)
|
||||
{
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public Serie GetLastStackSerie(int index)
|
||||
internal Serie GetLastStackSerie(int index)
|
||||
{
|
||||
var serie = GetSerie(index);
|
||||
return GetLastStackSerie(serie);
|
||||
@@ -154,7 +154,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="stack"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsAnyGradientSerie(string stack)
|
||||
internal bool IsAnyGradientSerie(string stack)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stack)) return false;
|
||||
foreach (var serie in m_Series)
|
||||
@@ -172,7 +172,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="serie"></param>
|
||||
/// <returns></returns>
|
||||
public Serie GetLastStackSerie(Serie serie)
|
||||
internal Serie GetLastStackSerie(Serie serie)
|
||||
{
|
||||
if (serie == null || string.IsNullOrEmpty(serie.stack)) return null;
|
||||
for (int i = serie.index - 1; i >= 0; i--)
|
||||
@@ -461,7 +461,7 @@ namespace XCharts
|
||||
/// dataZoom由变化是更新系列的缓存数据
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
public void UpdateFilterData(DataZoom dataZoom)
|
||||
internal void UpdateFilterData(DataZoom dataZoom)
|
||||
{
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
@@ -527,7 +527,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsUsedAxisIndex(int axisIndex)
|
||||
internal bool IsUsedAxisIndex(int axisIndex)
|
||||
{
|
||||
foreach (var serie in list)
|
||||
{
|
||||
@@ -555,7 +555,7 @@ namespace XCharts
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <param name="minVaule"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void GetXMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||
internal void GetXMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||
out float minVaule, out float maxValue)
|
||||
{
|
||||
GetMinMaxValue(dataZoom, axisIndex, isValueAxis, false, out minVaule, out maxValue);
|
||||
@@ -568,7 +568,7 @@ namespace XCharts
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <param name="minVaule"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public void GetYMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||
internal void GetYMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis,
|
||||
out float minVaule, out float maxValue)
|
||||
{
|
||||
GetMinMaxValue(dataZoom, axisIndex, isValueAxis, true, out minVaule, out maxValue);
|
||||
@@ -576,7 +576,7 @@ namespace XCharts
|
||||
|
||||
private Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||
private Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
||||
public void GetMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis, bool yValue,
|
||||
internal void GetMinMaxValue(DataZoom dataZoom, int axisIndex, bool isValueAxis, bool yValue,
|
||||
out float minVaule, out float maxValue)
|
||||
{
|
||||
float min = int.MaxValue;
|
||||
@@ -680,7 +680,7 @@ namespace XCharts
|
||||
/// 是否由数据堆叠
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsStack()
|
||||
internal bool IsStack()
|
||||
{
|
||||
_setForStack.Clear();
|
||||
foreach (var serie in m_Series)
|
||||
@@ -701,7 +701,7 @@ namespace XCharts
|
||||
/// <param name="stackName"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsStack(string stackName, SerieType type)
|
||||
internal bool IsStack(string stackName, SerieType type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stackName)) return false;
|
||||
int count = 0;
|
||||
@@ -721,7 +721,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsPercentStack(SerieType type)
|
||||
internal bool IsPercentStack(SerieType type)
|
||||
{
|
||||
int count = 0;
|
||||
bool isPercentStack = false;
|
||||
@@ -746,7 +746,7 @@ namespace XCharts
|
||||
/// <param name="stackName"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsPercentStack(string stackName, SerieType type)
|
||||
internal bool IsPercentStack(string stackName, SerieType type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stackName)) return false;
|
||||
int count = 0;
|
||||
@@ -770,7 +770,7 @@ namespace XCharts
|
||||
/// 获得堆叠系列列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int, List<Serie>> GetStackSeries()
|
||||
internal Dictionary<int, List<Serie>> GetStackSeries()
|
||||
{
|
||||
int count = 0;
|
||||
Dictionary<string, int> sets = new Dictionary<string, int>();
|
||||
@@ -810,7 +810,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
/// <param name="Dictionary<int"></param>
|
||||
/// <param name="stackSeries"></param>
|
||||
public void GetStackSeries(ref Dictionary<int, List<Serie>> stackSeries)
|
||||
internal void GetStackSeries(ref Dictionary<int, List<Serie>> stackSeries)
|
||||
{
|
||||
int count = 0;
|
||||
sets.Clear();
|
||||
@@ -860,7 +860,7 @@ namespace XCharts
|
||||
/// 获得所有系列名,不包含空名字。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> GetSerieNameList()
|
||||
internal List<string> GetSerieNameList()
|
||||
{
|
||||
serieNameList.Clear();
|
||||
for (int n = 0; n < m_Series.Count; n++)
|
||||
|
||||
@@ -124,42 +124,42 @@ namespace XCharts
|
||||
/// The data index currently indicated by Tooltip.
|
||||
/// 当前提示框所指示的数据项索引。
|
||||
/// </summary>
|
||||
public List<int> dataIndex { get; set; }
|
||||
public List<int> runtimeDataIndex { get; internal set; }
|
||||
/// <summary>
|
||||
/// the value for x indicator label.
|
||||
/// 指示器X轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] xValues { get; set; }
|
||||
public float[] runtimeXValues { get; internal set; }
|
||||
/// <summary>
|
||||
/// the value for y indicator label.
|
||||
/// 指示器Y轴上要显示的值。
|
||||
/// </summary>
|
||||
public float[] yValues { get; set; }
|
||||
public float[] runtimeYValues { get; internal set; }
|
||||
/// <summary>
|
||||
/// the current pointer position.
|
||||
/// 当前鼠标位置。
|
||||
/// </summary>
|
||||
public Vector2 pointerPos { get; set; }
|
||||
public Vector2 runtimePointerPos { get; internal set; }
|
||||
/// <summary>
|
||||
/// the width of tooltip.
|
||||
/// 提示框宽。
|
||||
/// </summary>
|
||||
public float width { get { return m_ContentRect.sizeDelta.x; } }
|
||||
public float runtimeWidth { get { return m_ContentRect.sizeDelta.x; } }
|
||||
/// <summary>
|
||||
/// the height of tooltip.
|
||||
/// 提示框高。
|
||||
/// </summary>
|
||||
public float height { get { return m_ContentRect.sizeDelta.y; } }
|
||||
public float runtimeHeight { get { return m_ContentRect.sizeDelta.y; } }
|
||||
/// <summary>
|
||||
/// Whether the tooltip has been initialized.
|
||||
/// 提示框是否已初始化。
|
||||
/// </summary>
|
||||
public bool inited { get { return m_GameObject != null; } }
|
||||
public bool runtimeInited { get { return m_GameObject != null; } }
|
||||
/// <summary>
|
||||
/// the gameObject of tooltip.
|
||||
/// 提示框的gameObject。
|
||||
/// </summary>
|
||||
public GameObject gameObject { get { return m_GameObject; } }
|
||||
public GameObject runtimeGameObject { get { return m_GameObject; } }
|
||||
|
||||
public static Tooltip defaultTooltip
|
||||
{
|
||||
@@ -168,9 +168,9 @@ namespace XCharts
|
||||
var tooltip = new Tooltip
|
||||
{
|
||||
m_Show = true,
|
||||
xValues = new float[2] { -1, -1 },
|
||||
yValues = new float[2] { -1, -1 },
|
||||
dataIndex = new List<int>() { -1, -1 },
|
||||
runtimeXValues = new float[2] { -1, -1 },
|
||||
runtimeYValues = new float[2] { -1, -1 },
|
||||
runtimeDataIndex = new List<int>() { -1, -1 },
|
||||
lastDataIndex = new List<int>() { -1, -1 }
|
||||
};
|
||||
return tooltip;
|
||||
@@ -214,7 +214,8 @@ namespace XCharts
|
||||
/// <param name="color"></param>
|
||||
public void SetContentBackgroundColor(Color color)
|
||||
{
|
||||
m_Content.GetComponent<Image>().color = color;
|
||||
if (m_Content != null && m_Content.GetComponent<Image>() != null)
|
||||
m_Content.GetComponent<Image>().color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -252,11 +253,11 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 清除提示框指示数据
|
||||
/// </summary>
|
||||
public void ClearValue()
|
||||
internal void ClearValue()
|
||||
{
|
||||
dataIndex[0] = dataIndex[1] = -1;
|
||||
xValues[0] = xValues[1] = -1;
|
||||
yValues[0] = yValues[1] = -1;
|
||||
runtimeDataIndex[0] = runtimeDataIndex[1] = -1;
|
||||
runtimeXValues[0] = runtimeXValues[1] = -1;
|
||||
runtimeYValues[0] = runtimeYValues[1] = -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -308,17 +309,17 @@ namespace XCharts
|
||||
/// <returns></returns>
|
||||
public bool IsDataIndexChanged()
|
||||
{
|
||||
return dataIndex[0] != lastDataIndex[0] ||
|
||||
dataIndex[1] != lastDataIndex[1];
|
||||
return runtimeDataIndex[0] != lastDataIndex[0] ||
|
||||
runtimeDataIndex[1] != lastDataIndex[1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前索引缓存
|
||||
/// </summary>
|
||||
public void UpdateLastDataIndex()
|
||||
internal void UpdateLastDataIndex()
|
||||
{
|
||||
lastDataIndex[0] = dataIndex[0];
|
||||
lastDataIndex[1] = dataIndex[1];
|
||||
lastDataIndex[0] = runtimeDataIndex[0];
|
||||
lastDataIndex[1] = runtimeDataIndex[1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -327,7 +328,7 @@ namespace XCharts
|
||||
/// <returns></returns>
|
||||
public bool IsSelected()
|
||||
{
|
||||
return dataIndex[0] >= 0 || dataIndex[1] >= 0;
|
||||
return runtimeDataIndex[0] >= 0 || runtimeDataIndex[1] >= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -337,10 +338,10 @@ namespace XCharts
|
||||
/// <returns></returns>
|
||||
public bool IsSelected(int index)
|
||||
{
|
||||
return dataIndex[0] == index || dataIndex[1] == index;
|
||||
return runtimeDataIndex[0] == index || runtimeDataIndex[1] == index;
|
||||
}
|
||||
|
||||
public string GetFormatterContent(int dataIndex, Series series, string category, DataZoom dataZoom = null)
|
||||
internal string GetFormatterContent(int dataIndex, Series series, string category, DataZoom dataZoom = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(m_Formatter))
|
||||
{
|
||||
@@ -383,7 +384,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFormatterContent(string serieName, string dataName, float dataValue)
|
||||
internal string GetFormatterContent(string serieName, string dataName, float dataValue)
|
||||
{
|
||||
if (string.IsNullOrEmpty(m_Formatter))
|
||||
return ChartCached.FloatToStr(dataValue, 0, m_ForceENotation);
|
||||
|
||||
@@ -164,14 +164,14 @@ namespace XCharts
|
||||
/// 鼠标悬停选中的index
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int rtSelectedIndex { get; set; }
|
||||
public float rtSelectedValue { get; set; }
|
||||
public int runtimeSelectedIndex { get; internal set; }
|
||||
public float runtimeSelectedValue { get; internal set; }
|
||||
/// <summary>
|
||||
/// the current pointer position.
|
||||
/// 当前鼠标位置。
|
||||
/// </summary>
|
||||
public Vector2 pointerPos { get; set; }
|
||||
public bool isVertical { get { return orient == Orient.Vertical; } }
|
||||
public Vector2 runtimePointerPos { get; internal set; }
|
||||
public bool runtimeIsVertical { get { return orient == Orient.Vertical; } }
|
||||
public float rangeMin
|
||||
{
|
||||
get
|
||||
@@ -198,7 +198,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public int rtSplitNumber
|
||||
public int runtimeSplitNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -207,18 +207,18 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
public float rangeMinHeight { get { return (rangeMin - min) / (max - min) * itemHeight; } }
|
||||
public float rangeMaxHeight { get { return (rangeMax - min) / (max - min) * itemHeight; } }
|
||||
public float runtimeRangeMinHeight { get { return (rangeMin - min) / (max - min) * itemHeight; } }
|
||||
public float runtimeRangeMaxHeight { get { return (rangeMax - min) / (max - min) * itemHeight; } }
|
||||
|
||||
private List<Color> m_RtInRange = new List<Color>();
|
||||
public List<Color> rtInRange
|
||||
public List<Color> runtimeInRange
|
||||
{
|
||||
get
|
||||
{
|
||||
if (splitNumber == 0 || m_InRange.Count >= splitNumber || m_InRange.Count < 1) return m_InRange;
|
||||
else
|
||||
{
|
||||
if (m_RtInRange.Count != rtSplitNumber)
|
||||
if (m_RtInRange.Count != runtimeSplitNumber)
|
||||
{
|
||||
m_RtInRange.Clear();
|
||||
var total = max - min;
|
||||
@@ -256,7 +256,7 @@ namespace XCharts
|
||||
|
||||
public Color GetColor(float value)
|
||||
{
|
||||
int splitNumber = rtInRange.Count;
|
||||
int splitNumber = runtimeInRange.Count;
|
||||
if (splitNumber <= 0) return Color.clear;
|
||||
value = Mathf.Clamp(value, min, max);
|
||||
|
||||
@@ -264,13 +264,13 @@ namespace XCharts
|
||||
var index = GetIndex(value);
|
||||
var nowMin = min + index * diff;
|
||||
var rate = (value - nowMin) / diff;
|
||||
if (index == splitNumber - 1) return rtInRange[index];
|
||||
else return Color.Lerp(rtInRange[index], rtInRange[index + 1], rate);
|
||||
if (index == splitNumber - 1) return runtimeInRange[index];
|
||||
else return Color.Lerp(runtimeInRange[index], runtimeInRange[index + 1], rate);
|
||||
}
|
||||
|
||||
public int GetIndex(float value)
|
||||
{
|
||||
int splitNumber = rtInRange.Count;
|
||||
int splitNumber = runtimeInRange.Count;
|
||||
if (splitNumber <= 0) return -1;
|
||||
value = Mathf.Clamp(value, min, max);
|
||||
|
||||
@@ -289,19 +289,19 @@ namespace XCharts
|
||||
|
||||
public bool IsInSelectedValue(float value)
|
||||
{
|
||||
if (rtSelectedIndex < 0) return true;
|
||||
if (runtimeSelectedIndex < 0) return true;
|
||||
else
|
||||
{
|
||||
return rtSelectedIndex == GetIndex(value);
|
||||
return runtimeSelectedIndex == GetIndex(value);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetValue(Vector3 pos, float chartWidth, float chartHeight)
|
||||
{
|
||||
var centerPos = location.GetPosition(chartWidth, chartHeight);
|
||||
var pos1 = centerPos + (isVertical ? Vector3.down : Vector3.left) * itemHeight / 2;
|
||||
var pos2 = centerPos + (isVertical ? Vector3.up : Vector3.right) * itemHeight / 2;
|
||||
if (isVertical)
|
||||
var pos1 = centerPos + (runtimeIsVertical ? Vector3.down : Vector3.left) * itemHeight / 2;
|
||||
var pos2 = centerPos + (runtimeIsVertical ? Vector3.up : Vector3.right) * itemHeight / 2;
|
||||
if (runtimeIsVertical)
|
||||
{
|
||||
if (pos.y < pos1.y) return min;
|
||||
else if (pos.y > pos2.y) return max;
|
||||
@@ -337,12 +337,12 @@ namespace XCharts
|
||||
{
|
||||
var pos1 = centerPos + Vector3.down * itemHeight / 2;
|
||||
return local.x >= centerPos.x - itemWidth / 2 && local.x <= centerPos.x + itemWidth / 2 &&
|
||||
local.y >= pos1.y + rangeMinHeight && local.y <= pos1.y + rangeMaxHeight;
|
||||
local.y >= pos1.y + runtimeRangeMinHeight && local.y <= pos1.y + runtimeRangeMaxHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos1 = centerPos + Vector3.left * itemHeight / 2;
|
||||
return local.x >= pos1.x + rangeMinHeight && local.x <= pos1.x + rangeMaxHeight &&
|
||||
return local.x >= pos1.x + runtimeRangeMinHeight && local.x <= pos1.x + runtimeRangeMaxHeight &&
|
||||
local.y >= centerPos.y - itemWidth / 2 && local.y <= centerPos.y + itemWidth / 2;
|
||||
}
|
||||
}
|
||||
@@ -354,7 +354,7 @@ namespace XCharts
|
||||
{
|
||||
var radius = triangleLen / 2;
|
||||
var pos1 = centerPos + Vector3.down * itemHeight / 2;
|
||||
var cpos = new Vector3(pos1.x + itemWidth / 2 + radius, pos1.y + rangeMinHeight - radius);
|
||||
var cpos = new Vector3(pos1.x + itemWidth / 2 + radius, pos1.y + runtimeRangeMinHeight - radius);
|
||||
|
||||
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||
@@ -363,7 +363,7 @@ namespace XCharts
|
||||
{
|
||||
var radius = triangleLen / 2;
|
||||
var pos1 = centerPos + Vector3.left * itemHeight / 2;
|
||||
var cpos = new Vector3(pos1.x + rangeMinHeight, pos1.y + itemWidth / 2 + radius);
|
||||
var cpos = new Vector3(pos1.x + runtimeRangeMinHeight, pos1.y + itemWidth / 2 + radius);
|
||||
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ namespace XCharts
|
||||
{
|
||||
var radius = triangleLen / 2;
|
||||
var pos1 = centerPos + Vector3.down * itemHeight / 2;
|
||||
var cpos = new Vector3(pos1.x + itemWidth / 2 + radius, pos1.y + rangeMaxHeight + radius);
|
||||
var cpos = new Vector3(pos1.x + itemWidth / 2 + radius, pos1.y + runtimeRangeMaxHeight + radius);
|
||||
|
||||
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||
@@ -385,7 +385,7 @@ namespace XCharts
|
||||
{
|
||||
var radius = triangleLen / 2;
|
||||
var pos1 = centerPos + Vector3.left * itemHeight / 2;
|
||||
var cpos = new Vector3(pos1.x + rangeMaxHeight + radius, pos1.y + itemWidth / 2 + radius);
|
||||
var cpos = new Vector3(pos1.x + runtimeRangeMaxHeight + radius, pos1.y + itemWidth / 2 + radius);
|
||||
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user