mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 10:50:08 +00:00
优化组件非配置参数变量的命名和访问权限
This commit is contained in:
@@ -21,7 +21,7 @@ namespace XCharts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
||||||
|
|
||||||
public void OnAfterDeserialize()
|
internal void OnAfterDeserialize()
|
||||||
{
|
{
|
||||||
if (m_DataFromJson)
|
if (m_DataFromJson)
|
||||||
{
|
{
|
||||||
@@ -30,7 +30,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnBeforeSerialize()
|
internal void OnBeforeSerialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,22 +208,22 @@ namespace XCharts
|
|||||||
/// the current minimun value.
|
/// the current minimun value.
|
||||||
/// 当前最小值。
|
/// 当前最小值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float minValue { get; set; }
|
public float runtimeMinValue { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the current maximum value.
|
/// the current maximum value.
|
||||||
/// 当前最大值。
|
/// 当前最大值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float maxValue { get; set; }
|
public float runtimeMaxValue { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the x offset of zero position.
|
/// the x offset of zero position.
|
||||||
/// 坐标轴原点在X轴的偏移。
|
/// 坐标轴原点在X轴的偏移。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float zeroXOffset { get; set; }
|
public float runtimeZeroXOffset { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the y offset of zero position.
|
/// the y offset of zero position.
|
||||||
/// 坐标轴原点在Y轴的偏移。
|
/// 坐标轴原点在Y轴的偏移。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float zeroYOffset { get; set; }
|
public float runtimeZeroYOffset { get; internal set; }
|
||||||
|
|
||||||
private int filterStart;
|
private int filterStart;
|
||||||
private int filterEnd;
|
private int filterEnd;
|
||||||
@@ -301,7 +301,7 @@ namespace XCharts
|
|||||||
/// <param name="index">类目数据索引</param>
|
/// <param name="index">类目数据索引</param>
|
||||||
/// <param name="dataZoom">区域缩放</param>
|
/// <param name="dataZoom">区域缩放</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string GetData(int index, DataZoom dataZoom)
|
internal string GetData(int index, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
var showData = GetDataList(dataZoom);
|
var showData = GetDataList(dataZoom);
|
||||||
if (index >= 0 && index < showData.Count)
|
if (index >= 0 && index < showData.Count)
|
||||||
@@ -315,7 +315,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom">区域缩放</param>
|
/// <param name="dataZoom">区域缩放</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<string> GetDataList(DataZoom dataZoom)
|
internal List<string> GetDataList(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (dataZoom != null && dataZoom.enable)
|
if (dataZoom != null && dataZoom.enable)
|
||||||
{
|
{
|
||||||
@@ -333,7 +333,7 @@ namespace XCharts
|
|||||||
/// 更新dataZoom对应的类目数据列表
|
/// 更新dataZoom对应的类目数据列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
public void UpdateFilterData(DataZoom dataZoom)
|
internal void UpdateFilterData(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (dataZoom != null && dataZoom.enable)
|
if (dataZoom != null && dataZoom.enable)
|
||||||
{
|
{
|
||||||
@@ -366,7 +366,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int GetSplitNumber(float coordinateWid, DataZoom dataZoom)
|
internal int GetSplitNumber(float coordinateWid, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (type == AxisType.Value)
|
if (type == AxisType.Value)
|
||||||
{
|
{
|
||||||
@@ -398,7 +398,7 @@ namespace XCharts
|
|||||||
/// <param name="coordinateWidth"></param>
|
/// <param name="coordinateWidth"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
internal float GetSplitWidth(float coordinateWidth, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
||||||
int segment = (m_BoundaryGap ? split : split - 1);
|
int segment = (m_BoundaryGap ? split : split - 1);
|
||||||
@@ -411,7 +411,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int GetDataNumber(DataZoom dataZoom)
|
internal int GetDataNumber(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
return GetDataList(dataZoom).Count;
|
return GetDataList(dataZoom).Count;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ namespace XCharts
|
|||||||
/// <param name="coordinateWidth"></param>
|
/// <param name="coordinateWidth"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <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;
|
if (dataCount < 1) dataCount = 1;
|
||||||
var categoryCount = GetDataNumber(dataZoom);
|
var categoryCount = GetDataNumber(dataZoom);
|
||||||
@@ -439,7 +439,7 @@ namespace XCharts
|
|||||||
/// <param name="maxValue"></param>
|
/// <param name="maxValue"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <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)
|
DataZoom dataZoom, bool forcePercent)
|
||||||
{
|
{
|
||||||
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
int split = GetSplitNumber(coordinateWidth, dataZoom);
|
||||||
@@ -483,7 +483,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int GetScaleNumber(float coordinateWidth, DataZoom dataZoom)
|
internal int GetScaleNumber(float coordinateWidth, DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (type == AxisType.Value)
|
if (type == AxisType.Value)
|
||||||
{
|
{
|
||||||
@@ -508,7 +508,7 @@ namespace XCharts
|
|||||||
/// <param name="coordinateWidth"></param>
|
/// <param name="coordinateWidth"></param>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
/// <returns></returns>
|
/// <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;
|
int num = GetScaleNumber(coordinateWidth, dataZoom) - 1;
|
||||||
if (num <= 0) num = 1;
|
if (num <= 0) num = 1;
|
||||||
@@ -528,18 +528,18 @@ namespace XCharts
|
|||||||
/// 更新刻度标签文字
|
/// 更新刻度标签文字
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <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++)
|
for (int i = 0; i < axisLabelTextList.Count; i++)
|
||||||
{
|
{
|
||||||
if (axisLabelTextList[i] != null)
|
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_TooltipLabel = label;
|
||||||
m_TooltipLabelRect = label.GetComponent<RectTransform>();
|
m_TooltipLabelRect = label.GetComponent<RectTransform>();
|
||||||
@@ -547,13 +547,13 @@ namespace XCharts
|
|||||||
m_TooltipLabel.SetActive(true);
|
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_TooltipLabel.GetComponent<Image>().color = bgColor;
|
||||||
m_TooltipLabelText.color = textColor;
|
m_TooltipLabelText.color = textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTooltipLabelActive(bool flag)
|
internal void SetTooltipLabelActive(bool flag)
|
||||||
{
|
{
|
||||||
if (m_TooltipLabel && m_TooltipLabel.activeInHierarchy != 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)
|
if (m_TooltipLabelText)
|
||||||
{
|
{
|
||||||
@@ -571,7 +571,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateTooltipLabelPos(Vector2 pos)
|
internal void UpdateTooltipLabelPos(Vector2 pos)
|
||||||
{
|
{
|
||||||
if (m_TooltipLabel)
|
if (m_TooltipLabel)
|
||||||
{
|
{
|
||||||
@@ -591,7 +591,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="minValue"></param>
|
/// <param name="minValue"></param>
|
||||||
/// <param name="maxValue"></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)
|
if (minMaxType == Axis.AxisMinMaxType.Custom)
|
||||||
{
|
{
|
||||||
@@ -663,8 +663,8 @@ namespace XCharts
|
|||||||
m_AxisLabel.Equals(other.axisLabel) &&
|
m_AxisLabel.Equals(other.axisLabel) &&
|
||||||
splitLineType == other.splitLineType &&
|
splitLineType == other.splitLineType &&
|
||||||
boundaryGap == other.boundaryGap &&
|
boundaryGap == other.boundaryGap &&
|
||||||
minValue == other.minValue &&
|
runtimeMinValue == other.runtimeMinValue &&
|
||||||
maxValue == other.maxValue &&
|
runtimeMaxValue == other.runtimeMaxValue &&
|
||||||
axisName.Equals(other.axisName) &&
|
axisName.Equals(other.axisName) &&
|
||||||
ChartHelper.IsValueEqualsList<string>(m_Data, other.data);
|
ChartHelper.IsValueEqualsList<string>(m_Data, other.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,12 +208,12 @@ namespace XCharts
|
|||||||
/// The start label.
|
/// The start label.
|
||||||
/// 组件的开始信息文本。
|
/// 组件的开始信息文本。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Text startLabel { get; set; }
|
private Text m_StartLabel { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The end label.
|
/// The end label.
|
||||||
/// 组件的结束信息文本。
|
/// 组件的结束信息文本。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Text endLabel { get; set; }
|
private Text m_EndLabel { get; set; }
|
||||||
|
|
||||||
public static DataZoom defaultDataZoom
|
public static DataZoom defaultDataZoom
|
||||||
{
|
{
|
||||||
@@ -297,15 +297,15 @@ namespace XCharts
|
|||||||
/// 是否显示文本
|
/// 是否显示文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flag"></param>
|
/// <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>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <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>
|
||||||
/// 设置结束文本内容
|
/// 设置结束文本内容
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="text"></param>
|
/// <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>
|
/// <summary>
|
||||||
@@ -332,7 +332,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="gridBottom"></param>
|
/// <param name="gridBottom"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public float GetHeight(float gridBottom)
|
internal float GetHeight(float gridBottom)
|
||||||
{
|
{
|
||||||
if (height <= 0)
|
if (height <= 0)
|
||||||
{
|
{
|
||||||
@@ -342,5 +342,25 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else return height;
|
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.
|
/// the center position of radar in container.
|
||||||
/// 雷达图在容器中的具体中心点。
|
/// 雷达图在容器中的具体中心点。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
public Vector2 runtimeCenterPos { get; internal set; }
|
||||||
public Vector2 centerPos { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the true radius of radar.
|
/// the true radius of radar.
|
||||||
/// 雷达图的运行时实际半径。
|
/// 雷达图的运行时实际半径。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
public float runtimeRadius { get; internal set; }
|
||||||
public float actualRadius { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the data position list of radar.
|
/// the data position list of radar.
|
||||||
/// 雷达图的所有数据坐标点列表。
|
/// 雷达图的所有数据坐标点列表。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
public Dictionary<int, List<Vector3>> runtimeDataPosList = new Dictionary<int, List<Vector3>>();
|
||||||
public Dictionary<int, List<Vector3>> dataPosList = new Dictionary<int, List<Vector3>>();
|
|
||||||
|
|
||||||
public static Radar defaultRadar
|
public static Radar defaultRadar
|
||||||
{
|
{
|
||||||
@@ -344,23 +341,23 @@ namespace XCharts
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateRadarCenter(float chartWidth, float chartHeight)
|
internal void UpdateRadarCenter(float chartWidth, float chartHeight)
|
||||||
{
|
{
|
||||||
if (center.Length < 2) return;
|
if (center.Length < 2) return;
|
||||||
var centerX = center[0] <= 1 ? chartWidth * center[0] : center[0];
|
var centerX = center[0] <= 1 ? chartWidth * center[0] : center[0];
|
||||||
var centerY = center[1] <= 1 ? chartHeight * center[1] : center[1];
|
var centerY = center[1] <= 1 ? chartHeight * center[1] : center[1];
|
||||||
centerPos = new Vector2(centerX, centerY);
|
runtimeCenterPos = new Vector2(centerX, centerY);
|
||||||
if (radius <= 0)
|
if (radius <= 0)
|
||||||
{
|
{
|
||||||
actualRadius = 0;
|
runtimeRadius = 0;
|
||||||
}
|
}
|
||||||
else if (radius <= 1)
|
else if (radius <= 1)
|
||||||
{
|
{
|
||||||
actualRadius = Mathf.Min(chartWidth, chartHeight) * radius;
|
runtimeRadius = Mathf.Min(chartWidth, chartHeight) * radius;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actualRadius = radius;
|
runtimeRadius = radius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,8 +365,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
int indicatorNum = indicatorList.Count;
|
int indicatorNum = indicatorList.Count;
|
||||||
var angle = 2 * Mathf.PI / indicatorNum * index;
|
var angle = 2 * Mathf.PI / indicatorNum * index;
|
||||||
var x = centerPos.x + actualRadius * Mathf.Sin(angle);
|
var x = runtimeCenterPos.x + runtimeRadius * Mathf.Sin(angle);
|
||||||
var y = centerPos.y + actualRadius * Mathf.Cos(angle);
|
var y = runtimeCenterPos.y + runtimeRadius * Mathf.Cos(angle);
|
||||||
return new Vector3(x, y);
|
return new Vector3(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -426,12 +426,12 @@ namespace XCharts
|
|||||||
/// The index of serie,start at 0.
|
/// The index of serie,start at 0.
|
||||||
/// 系列的索引,从0开始。
|
/// 系列的索引,从0开始。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int index { get; set; }
|
public int index { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the serie is highlighted.
|
/// Whether the serie is highlighted.
|
||||||
/// 该系列是否高亮,一般由图例悬停触发。
|
/// 该系列是否高亮,一般由图例悬停触发。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool highlighted { get; set; }
|
public bool highlighted { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the count of data list.
|
/// the count of data list.
|
||||||
/// 数据项个数。
|
/// 数据项个数。
|
||||||
@@ -444,25 +444,25 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的中心点位置。
|
/// 饼图的中心点位置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 pieCenterPos { get; set; }
|
public Vector3 runtimePieCenterPos { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的内径
|
/// 饼图的内径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieInsideRadius { get; set; }
|
public float runtimePieInsideRadius { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的外径
|
/// 饼图的外径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieOutsideRadius { get; set; }
|
public float runtimePieOutsideRadius { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的数据项最大值
|
/// 饼图的数据项最大值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieDataMax { get; set; }
|
public float runtimePieDataMax { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图的数据项之和
|
/// 饼图的数据项之和
|
||||||
/// </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))
|
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))
|
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))
|
if (m_UpSmoothPoints.ContainsKey(dataIndex))
|
||||||
{
|
{
|
||||||
@@ -836,7 +836,7 @@ namespace XCharts
|
|||||||
/// 根据dataZoom更新数据列表缓存
|
/// 根据dataZoom更新数据列表缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
public void UpdateFilterData(DataZoom dataZoom)
|
internal void UpdateFilterData(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (dataZoom != null && dataZoom.enable)
|
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);
|
var color = areaStyle.color != Color.clear ? areaStyle.color : (Color)theme.GetColor(index);
|
||||||
if (highlight)
|
if (highlight)
|
||||||
@@ -951,7 +951,7 @@ namespace XCharts
|
|||||||
return color;
|
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)
|
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)
|
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)
|
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;
|
if (m_BarWidth > 1) return m_BarWidth;
|
||||||
else return m_BarWidth * categoryWidth;
|
else return m_BarWidth * categoryWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetBarGap(float categoryWidth)
|
internal float GetBarGap(float categoryWidth)
|
||||||
{
|
{
|
||||||
if (m_BarGap == -1) return 0;
|
if (m_BarGap == -1) return 0;
|
||||||
else if (m_BarGap <= 1) return GetBarWidth(categoryWidth) * m_BarGap;
|
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)
|
foreach (var data in m_Data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index"></param>
|
/// <param name="index"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Serie GetLastStackSerie(int index)
|
internal Serie GetLastStackSerie(int index)
|
||||||
{
|
{
|
||||||
var serie = GetSerie(index);
|
var serie = GetSerie(index);
|
||||||
return GetLastStackSerie(serie);
|
return GetLastStackSerie(serie);
|
||||||
@@ -154,7 +154,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stack"></param>
|
/// <param name="stack"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsAnyGradientSerie(string stack)
|
internal bool IsAnyGradientSerie(string stack)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stack)) return false;
|
if (string.IsNullOrEmpty(stack)) return false;
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
@@ -172,7 +172,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serie"></param>
|
/// <param name="serie"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Serie GetLastStackSerie(Serie serie)
|
internal Serie GetLastStackSerie(Serie serie)
|
||||||
{
|
{
|
||||||
if (serie == null || string.IsNullOrEmpty(serie.stack)) return null;
|
if (serie == null || string.IsNullOrEmpty(serie.stack)) return null;
|
||||||
for (int i = serie.index - 1; i >= 0; i--)
|
for (int i = serie.index - 1; i >= 0; i--)
|
||||||
@@ -461,7 +461,7 @@ namespace XCharts
|
|||||||
/// dataZoom由变化是更新系列的缓存数据
|
/// dataZoom由变化是更新系列的缓存数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataZoom"></param>
|
/// <param name="dataZoom"></param>
|
||||||
public void UpdateFilterData(DataZoom dataZoom)
|
internal void UpdateFilterData(DataZoom dataZoom)
|
||||||
{
|
{
|
||||||
if (dataZoom != null && dataZoom.enable)
|
if (dataZoom != null && dataZoom.enable)
|
||||||
{
|
{
|
||||||
@@ -527,7 +527,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="axisIndex"></param>
|
/// <param name="axisIndex"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsUsedAxisIndex(int axisIndex)
|
internal bool IsUsedAxisIndex(int axisIndex)
|
||||||
{
|
{
|
||||||
foreach (var serie in list)
|
foreach (var serie in list)
|
||||||
{
|
{
|
||||||
@@ -555,7 +555,7 @@ namespace XCharts
|
|||||||
/// <param name="axisIndex"></param>
|
/// <param name="axisIndex"></param>
|
||||||
/// <param name="minVaule"></param>
|
/// <param name="minVaule"></param>
|
||||||
/// <param name="maxValue"></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)
|
out float minVaule, out float maxValue)
|
||||||
{
|
{
|
||||||
GetMinMaxValue(dataZoom, axisIndex, isValueAxis, false, out minVaule, out maxValue);
|
GetMinMaxValue(dataZoom, axisIndex, isValueAxis, false, out minVaule, out maxValue);
|
||||||
@@ -568,7 +568,7 @@ namespace XCharts
|
|||||||
/// <param name="axisIndex"></param>
|
/// <param name="axisIndex"></param>
|
||||||
/// <param name="minVaule"></param>
|
/// <param name="minVaule"></param>
|
||||||
/// <param name="maxValue"></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)
|
out float minVaule, out float maxValue)
|
||||||
{
|
{
|
||||||
GetMinMaxValue(dataZoom, axisIndex, isValueAxis, true, out minVaule, out 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, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||||
private Dictionary<int, float> _serieTotalValueForMinMax = new Dictionary<int, float>();
|
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)
|
out float minVaule, out float maxValue)
|
||||||
{
|
{
|
||||||
float min = int.MaxValue;
|
float min = int.MaxValue;
|
||||||
@@ -680,7 +680,7 @@ namespace XCharts
|
|||||||
/// 是否由数据堆叠
|
/// 是否由数据堆叠
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsStack()
|
internal bool IsStack()
|
||||||
{
|
{
|
||||||
_setForStack.Clear();
|
_setForStack.Clear();
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
@@ -701,7 +701,7 @@ namespace XCharts
|
|||||||
/// <param name="stackName"></param>
|
/// <param name="stackName"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsStack(string stackName, SerieType type)
|
internal bool IsStack(string stackName, SerieType type)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stackName)) return false;
|
if (string.IsNullOrEmpty(stackName)) return false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -721,7 +721,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsPercentStack(SerieType type)
|
internal bool IsPercentStack(SerieType type)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool isPercentStack = false;
|
bool isPercentStack = false;
|
||||||
@@ -746,7 +746,7 @@ namespace XCharts
|
|||||||
/// <param name="stackName"></param>
|
/// <param name="stackName"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsPercentStack(string stackName, SerieType type)
|
internal bool IsPercentStack(string stackName, SerieType type)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(stackName)) return false;
|
if (string.IsNullOrEmpty(stackName)) return false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -770,7 +770,7 @@ namespace XCharts
|
|||||||
/// 获得堆叠系列列表
|
/// 获得堆叠系列列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Dictionary<int, List<Serie>> GetStackSeries()
|
internal Dictionary<int, List<Serie>> GetStackSeries()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Dictionary<string, int> sets = new Dictionary<string, int>();
|
Dictionary<string, int> sets = new Dictionary<string, int>();
|
||||||
@@ -810,7 +810,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Dictionary<int"></param>
|
/// <param name="Dictionary<int"></param>
|
||||||
/// <param name="stackSeries"></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;
|
int count = 0;
|
||||||
sets.Clear();
|
sets.Clear();
|
||||||
@@ -860,7 +860,7 @@ namespace XCharts
|
|||||||
/// 获得所有系列名,不包含空名字。
|
/// 获得所有系列名,不包含空名字。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<string> GetSerieNameList()
|
internal List<string> GetSerieNameList()
|
||||||
{
|
{
|
||||||
serieNameList.Clear();
|
serieNameList.Clear();
|
||||||
for (int n = 0; n < m_Series.Count; n++)
|
for (int n = 0; n < m_Series.Count; n++)
|
||||||
|
|||||||
@@ -124,42 +124,42 @@ namespace XCharts
|
|||||||
/// The data index currently indicated by Tooltip.
|
/// The data index currently indicated by Tooltip.
|
||||||
/// 当前提示框所指示的数据项索引。
|
/// 当前提示框所指示的数据项索引。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<int> dataIndex { get; set; }
|
public List<int> runtimeDataIndex { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the value for x indicator label.
|
/// the value for x indicator label.
|
||||||
/// 指示器X轴上要显示的值。
|
/// 指示器X轴上要显示的值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float[] xValues { get; set; }
|
public float[] runtimeXValues { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the value for y indicator label.
|
/// the value for y indicator label.
|
||||||
/// 指示器Y轴上要显示的值。
|
/// 指示器Y轴上要显示的值。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float[] yValues { get; set; }
|
public float[] runtimeYValues { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the current pointer position.
|
/// the current pointer position.
|
||||||
/// 当前鼠标位置。
|
/// 当前鼠标位置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 pointerPos { get; set; }
|
public Vector2 runtimePointerPos { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the width of tooltip.
|
/// the width of tooltip.
|
||||||
/// 提示框宽。
|
/// 提示框宽。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float width { get { return m_ContentRect.sizeDelta.x; } }
|
public float runtimeWidth { get { return m_ContentRect.sizeDelta.x; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the height of tooltip.
|
/// the height of tooltip.
|
||||||
/// 提示框高。
|
/// 提示框高。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float height { get { return m_ContentRect.sizeDelta.y; } }
|
public float runtimeHeight { get { return m_ContentRect.sizeDelta.y; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the tooltip has been initialized.
|
/// Whether the tooltip has been initialized.
|
||||||
/// 提示框是否已初始化。
|
/// 提示框是否已初始化。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool inited { get { return m_GameObject != null; } }
|
public bool runtimeInited { get { return m_GameObject != null; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the gameObject of tooltip.
|
/// the gameObject of tooltip.
|
||||||
/// 提示框的gameObject。
|
/// 提示框的gameObject。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GameObject gameObject { get { return m_GameObject; } }
|
public GameObject runtimeGameObject { get { return m_GameObject; } }
|
||||||
|
|
||||||
public static Tooltip defaultTooltip
|
public static Tooltip defaultTooltip
|
||||||
{
|
{
|
||||||
@@ -168,9 +168,9 @@ namespace XCharts
|
|||||||
var tooltip = new Tooltip
|
var tooltip = new Tooltip
|
||||||
{
|
{
|
||||||
m_Show = true,
|
m_Show = true,
|
||||||
xValues = new float[2] { -1, -1 },
|
runtimeXValues = new float[2] { -1, -1 },
|
||||||
yValues = new float[2] { -1, -1 },
|
runtimeYValues = new float[2] { -1, -1 },
|
||||||
dataIndex = new List<int>() { -1, -1 },
|
runtimeDataIndex = new List<int>() { -1, -1 },
|
||||||
lastDataIndex = new List<int>() { -1, -1 }
|
lastDataIndex = new List<int>() { -1, -1 }
|
||||||
};
|
};
|
||||||
return tooltip;
|
return tooltip;
|
||||||
@@ -214,7 +214,8 @@ namespace XCharts
|
|||||||
/// <param name="color"></param>
|
/// <param name="color"></param>
|
||||||
public void SetContentBackgroundColor(Color color)
|
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>
|
/// <summary>
|
||||||
@@ -252,11 +253,11 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清除提示框指示数据
|
/// 清除提示框指示数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearValue()
|
internal void ClearValue()
|
||||||
{
|
{
|
||||||
dataIndex[0] = dataIndex[1] = -1;
|
runtimeDataIndex[0] = runtimeDataIndex[1] = -1;
|
||||||
xValues[0] = xValues[1] = -1;
|
runtimeXValues[0] = runtimeXValues[1] = -1;
|
||||||
yValues[0] = yValues[1] = -1;
|
runtimeYValues[0] = runtimeYValues[1] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -308,17 +309,17 @@ namespace XCharts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsDataIndexChanged()
|
public bool IsDataIndexChanged()
|
||||||
{
|
{
|
||||||
return dataIndex[0] != lastDataIndex[0] ||
|
return runtimeDataIndex[0] != lastDataIndex[0] ||
|
||||||
dataIndex[1] != lastDataIndex[1];
|
runtimeDataIndex[1] != lastDataIndex[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前索引缓存
|
/// 当前索引缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateLastDataIndex()
|
internal void UpdateLastDataIndex()
|
||||||
{
|
{
|
||||||
lastDataIndex[0] = dataIndex[0];
|
lastDataIndex[0] = runtimeDataIndex[0];
|
||||||
lastDataIndex[1] = dataIndex[1];
|
lastDataIndex[1] = runtimeDataIndex[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -327,7 +328,7 @@ namespace XCharts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsSelected()
|
public bool IsSelected()
|
||||||
{
|
{
|
||||||
return dataIndex[0] >= 0 || dataIndex[1] >= 0;
|
return runtimeDataIndex[0] >= 0 || runtimeDataIndex[1] >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -337,10 +338,10 @@ namespace XCharts
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsSelected(int index)
|
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))
|
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))
|
if (string.IsNullOrEmpty(m_Formatter))
|
||||||
return ChartCached.FloatToStr(dataValue, 0, m_ForceENotation);
|
return ChartCached.FloatToStr(dataValue, 0, m_ForceENotation);
|
||||||
|
|||||||
@@ -164,14 +164,14 @@ namespace XCharts
|
|||||||
/// 鼠标悬停选中的index
|
/// 鼠标悬停选中的index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public int rtSelectedIndex { get; set; }
|
public int runtimeSelectedIndex { get; internal set; }
|
||||||
public float rtSelectedValue { get; set; }
|
public float runtimeSelectedValue { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the current pointer position.
|
/// the current pointer position.
|
||||||
/// 当前鼠标位置。
|
/// 当前鼠标位置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector2 pointerPos { get; set; }
|
public Vector2 runtimePointerPos { get; internal set; }
|
||||||
public bool isVertical { get { return orient == Orient.Vertical; } }
|
public bool runtimeIsVertical { get { return orient == Orient.Vertical; } }
|
||||||
public float rangeMin
|
public float rangeMin
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -198,7 +198,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int rtSplitNumber
|
public int runtimeSplitNumber
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -207,18 +207,18 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float rangeMinHeight { get { return (rangeMin - min) / (max - min) * itemHeight; } }
|
public float runtimeRangeMinHeight { get { return (rangeMin - min) / (max - min) * itemHeight; } }
|
||||||
public float rangeMaxHeight { get { return (rangeMax - min) / (max - min) * itemHeight; } }
|
public float runtimeRangeMaxHeight { get { return (rangeMax - min) / (max - min) * itemHeight; } }
|
||||||
|
|
||||||
private List<Color> m_RtInRange = new List<Color>();
|
private List<Color> m_RtInRange = new List<Color>();
|
||||||
public List<Color> rtInRange
|
public List<Color> runtimeInRange
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (splitNumber == 0 || m_InRange.Count >= splitNumber || m_InRange.Count < 1) return m_InRange;
|
if (splitNumber == 0 || m_InRange.Count >= splitNumber || m_InRange.Count < 1) return m_InRange;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_RtInRange.Count != rtSplitNumber)
|
if (m_RtInRange.Count != runtimeSplitNumber)
|
||||||
{
|
{
|
||||||
m_RtInRange.Clear();
|
m_RtInRange.Clear();
|
||||||
var total = max - min;
|
var total = max - min;
|
||||||
@@ -256,7 +256,7 @@ namespace XCharts
|
|||||||
|
|
||||||
public Color GetColor(float value)
|
public Color GetColor(float value)
|
||||||
{
|
{
|
||||||
int splitNumber = rtInRange.Count;
|
int splitNumber = runtimeInRange.Count;
|
||||||
if (splitNumber <= 0) return Color.clear;
|
if (splitNumber <= 0) return Color.clear;
|
||||||
value = Mathf.Clamp(value, min, max);
|
value = Mathf.Clamp(value, min, max);
|
||||||
|
|
||||||
@@ -264,13 +264,13 @@ namespace XCharts
|
|||||||
var index = GetIndex(value);
|
var index = GetIndex(value);
|
||||||
var nowMin = min + index * diff;
|
var nowMin = min + index * diff;
|
||||||
var rate = (value - nowMin) / diff;
|
var rate = (value - nowMin) / diff;
|
||||||
if (index == splitNumber - 1) return rtInRange[index];
|
if (index == splitNumber - 1) return runtimeInRange[index];
|
||||||
else return Color.Lerp(rtInRange[index], rtInRange[index + 1], rate);
|
else return Color.Lerp(runtimeInRange[index], runtimeInRange[index + 1], rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetIndex(float value)
|
public int GetIndex(float value)
|
||||||
{
|
{
|
||||||
int splitNumber = rtInRange.Count;
|
int splitNumber = runtimeInRange.Count;
|
||||||
if (splitNumber <= 0) return -1;
|
if (splitNumber <= 0) return -1;
|
||||||
value = Mathf.Clamp(value, min, max);
|
value = Mathf.Clamp(value, min, max);
|
||||||
|
|
||||||
@@ -289,19 +289,19 @@ namespace XCharts
|
|||||||
|
|
||||||
public bool IsInSelectedValue(float value)
|
public bool IsInSelectedValue(float value)
|
||||||
{
|
{
|
||||||
if (rtSelectedIndex < 0) return true;
|
if (runtimeSelectedIndex < 0) return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return rtSelectedIndex == GetIndex(value);
|
return runtimeSelectedIndex == GetIndex(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetValue(Vector3 pos, float chartWidth, float chartHeight)
|
public float GetValue(Vector3 pos, float chartWidth, float chartHeight)
|
||||||
{
|
{
|
||||||
var centerPos = location.GetPosition(chartWidth, chartHeight);
|
var centerPos = location.GetPosition(chartWidth, chartHeight);
|
||||||
var pos1 = centerPos + (isVertical ? Vector3.down : Vector3.left) * itemHeight / 2;
|
var pos1 = centerPos + (runtimeIsVertical ? Vector3.down : Vector3.left) * itemHeight / 2;
|
||||||
var pos2 = centerPos + (isVertical ? Vector3.up : Vector3.right) * itemHeight / 2;
|
var pos2 = centerPos + (runtimeIsVertical ? Vector3.up : Vector3.right) * itemHeight / 2;
|
||||||
if (isVertical)
|
if (runtimeIsVertical)
|
||||||
{
|
{
|
||||||
if (pos.y < pos1.y) return min;
|
if (pos.y < pos1.y) return min;
|
||||||
else if (pos.y > pos2.y) return max;
|
else if (pos.y > pos2.y) return max;
|
||||||
@@ -337,12 +337,12 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var pos1 = centerPos + Vector3.down * itemHeight / 2;
|
var pos1 = centerPos + Vector3.down * itemHeight / 2;
|
||||||
return local.x >= centerPos.x - itemWidth / 2 && local.x <= centerPos.x + itemWidth / 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
|
else
|
||||||
{
|
{
|
||||||
var pos1 = centerPos + Vector3.left * itemHeight / 2;
|
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;
|
local.y >= centerPos.y - itemWidth / 2 && local.y <= centerPos.y + itemWidth / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var radius = triangleLen / 2;
|
var radius = triangleLen / 2;
|
||||||
var pos1 = centerPos + Vector3.down * itemHeight / 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 &&
|
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||||
@@ -363,7 +363,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var radius = triangleLen / 2;
|
var radius = triangleLen / 2;
|
||||||
var pos1 = centerPos + Vector3.left * itemHeight / 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 &&
|
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||||
}
|
}
|
||||||
@@ -376,7 +376,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var radius = triangleLen / 2;
|
var radius = triangleLen / 2;
|
||||||
var pos1 = centerPos + Vector3.down * itemHeight / 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 &&
|
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||||
@@ -385,7 +385,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var radius = triangleLen / 2;
|
var radius = triangleLen / 2;
|
||||||
var pos1 = centerPos + Vector3.left * itemHeight / 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 &&
|
return local.x >= cpos.x - radius && local.x <= cpos.x + radius &&
|
||||||
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
local.y >= cpos.y - radius && local.y <= cpos.y + radius;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,25 +74,25 @@ namespace XCharts
|
|||||||
/// Location对应的Anchor锚点
|
/// Location对应的Anchor锚点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public TextAnchor textAnchor { get { return m_TextAnchor; } }
|
public TextAnchor runtimeTextAnchor { get { return m_TextAnchor; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the minimum achor.
|
/// the minimum achor.
|
||||||
/// Location对应的anchorMin。
|
/// Location对应的anchorMin。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public Vector2 anchorMin { get { return m_AnchorMin; } }
|
public Vector2 runtimeAnchorMin { get { return m_AnchorMin; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the maximun achor.
|
/// the maximun achor.
|
||||||
/// Location对应的anchorMax.
|
/// Location对应的anchorMax.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public Vector2 anchorMax { get { return m_AnchorMax; } }
|
public Vector2 runtimeAnchorMax { get { return m_AnchorMax; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the povot.
|
/// the povot.
|
||||||
/// Loation对应的中心点。
|
/// Loation对应的中心点。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
/// <value></value>
|
||||||
public Vector2 pivot { get { return m_Pivot; } }
|
public Vector2 runtimePivot { get { return m_Pivot; } }
|
||||||
|
|
||||||
public static Location defaultLeft
|
public static Location defaultLeft
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,31 +37,26 @@ namespace XCharts
|
|||||||
/// Easing method used for the first animation.
|
/// Easing method used for the first animation.
|
||||||
/// 动画的缓动效果。
|
/// 动画的缓动效果。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
|
||||||
public Easing easing { get { return m_Easting; } set { m_Easting = value; } }
|
public Easing easing { get { return m_Easting; } set { m_Easting = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds duration of the first animation.
|
/// The milliseconds duration of the first animation.
|
||||||
/// 设定的动画时长(毫秒)。
|
/// 设定的动画时长(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
|
||||||
public int duration { get { return m_Duration; } set { m_Duration = value; } }
|
public int duration { get { return m_Duration; } set { m_Duration = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds actual duration of the first animation.
|
/// The milliseconds actual duration of the first animation.
|
||||||
/// 实际的动画时长(毫秒)。
|
/// 实际的动画时长(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
|
||||||
public int actualDuration { get { return m_ActualDuration; } }
|
public int actualDuration { get { return m_ActualDuration; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to set graphic number threshold to animation. Animation will be disabled when graphic number is larger than threshold.
|
/// Whether to set graphic number threshold to animation. Animation will be disabled when graphic number is larger than threshold.
|
||||||
/// 是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
|
/// 是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
|
||||||
public int threshold { get { return m_Threshold; } set { m_Threshold = value; } }
|
public int threshold { get { return m_Threshold; } set { m_Threshold = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds delay before updating the first animation.
|
/// The milliseconds delay before updating the first animation.
|
||||||
/// 动画延时(毫秒)。
|
/// 动画延时(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value></value>
|
|
||||||
public int delay { get { return m_Delay; } set { m_Delay = value; if (m_Delay < 0) m_Delay = 0; } }
|
public int delay { get { return m_Delay; } set { m_Delay = value; if (m_Delay < 0) m_Delay = 0; } }
|
||||||
|
|
||||||
private Dictionary<int, float> m_DataAnimationState = new Dictionary<int, float>();
|
private Dictionary<int, float> m_DataAnimationState = new Dictionary<int, float>();
|
||||||
@@ -179,7 +174,7 @@ namespace XCharts
|
|||||||
return dataIndex <= m_CurrDataProgress;
|
return dataIndex <= m_CurrDataProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckProgress(float delta)
|
internal void CheckProgress(float delta)
|
||||||
{
|
{
|
||||||
if (!enable) return;
|
if (!enable) return;
|
||||||
if (IsInDelay()) return;
|
if (IsInDelay()) return;
|
||||||
@@ -195,7 +190,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckSymbol(float delta, float dest)
|
internal void CheckSymbol(float delta, float dest)
|
||||||
{
|
{
|
||||||
m_CurrSymbolProgress += delta;
|
m_CurrSymbolProgress += delta;
|
||||||
if (m_CurrSymbolProgress > dest) m_CurrSymbolProgress = dest;
|
if (m_CurrSymbolProgress > dest) m_CurrSymbolProgress = dest;
|
||||||
|
|||||||
@@ -133,34 +133,34 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的开始角度(运行时自动计算)
|
/// 饼图数据项的开始角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieStartAngle { get; set; }
|
public float runtimePieStartAngle { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的结束角度(运行时自动计算)
|
/// 饼图数据项的结束角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieToAngle { get; set; }
|
public float runtimePieToAngle { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的一半时的角度(运行时自动计算)
|
/// 饼图数据项的一半时的角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieHalfAngle { get; set; }
|
public float runtimePieHalfAngle { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的当前角度(运行时自动计算)
|
/// 饼图数据项的当前角度(运行时自动计算)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieCurrAngle { get; set; }
|
public float runtimePieCurrAngle { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的内半径
|
/// 饼图数据项的内半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieInsideRadius { get; set; }
|
public float runtimePieInsideRadius { get; internal set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的外半径
|
/// 饼图数据项的外半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieOutsideRadius
|
public float runtimePieOutsideRadius
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (radius > 0) return radius;
|
if (radius > 0) return radius;
|
||||||
else return m_RtPieOutsideRadius;
|
else return m_RtPieOutsideRadius;
|
||||||
}
|
}
|
||||||
set
|
internal set
|
||||||
{
|
{
|
||||||
m_RtPieOutsideRadius = value;
|
m_RtPieOutsideRadius = value;
|
||||||
}
|
}
|
||||||
@@ -168,8 +168,8 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 饼图数据项的偏移半径
|
/// 饼图数据项的偏移半径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float pieOffsetRadius { get; set; }
|
public float runtimePieOffsetRadius { get; internal set; }
|
||||||
public Vector3 pieOffsetCenter { get; set; }
|
public Vector3 runtiemPieOffsetCenter { get; internal set; }
|
||||||
|
|
||||||
public float GetData(int index)
|
public float GetData(int index)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ namespace XCharts
|
|||||||
|
|
||||||
protected override void RefreshTooltip()
|
protected override void RefreshTooltip()
|
||||||
{
|
{
|
||||||
var xData = m_Tooltip.xValues[0];
|
var xData = m_Tooltip.runtimeXValues[0];
|
||||||
var yData = m_Tooltip.yValues[0];
|
var yData = m_Tooltip.runtimeYValues[0];
|
||||||
if (IsCategory() && (xData < 0 || yData < 0)) return;
|
if (IsCategory() && (xData < 0 || yData < 0)) return;
|
||||||
sb.Length = 0;
|
sb.Length = 0;
|
||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
@@ -117,13 +117,13 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentText(sb.ToString().Trim());
|
m_Tooltip.UpdateContentText(sb.ToString().Trim());
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
if (pos.x + m_Tooltip.width > chartWidth)
|
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
||||||
{
|
{
|
||||||
pos.x = chartWidth - m_Tooltip.width;
|
pos.x = chartWidth - m_Tooltip.runtimeWidth;
|
||||||
}
|
}
|
||||||
if (pos.y - m_Tooltip.height < 0)
|
if (pos.y - m_Tooltip.runtimeHeight < 0)
|
||||||
{
|
{
|
||||||
pos.y = m_Tooltip.height;
|
pos.y = m_Tooltip.runtimeHeight;
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(pos);
|
m_Tooltip.UpdateContentPos(pos);
|
||||||
m_Tooltip.SetActive(true);
|
m_Tooltip.SetActive(true);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
public static class XAxisPool
|
internal static class XAxisPool
|
||||||
{
|
{
|
||||||
private static readonly ObjectPool<XAxis> s_ListPool = new ObjectPool<XAxis>(null, null);
|
private static readonly ObjectPool<XAxis> s_ListPool = new ObjectPool<XAxis>(null, null);
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class YAxisPool
|
internal static class YAxisPool
|
||||||
{
|
{
|
||||||
private static readonly ObjectPool<YAxis> s_ListPool = new ObjectPool<YAxis>(null, null);
|
private static readonly ObjectPool<YAxis> s_ListPool = new ObjectPool<YAxis>(null, null);
|
||||||
|
|
||||||
|
|||||||
@@ -148,10 +148,10 @@ namespace XCharts
|
|||||||
private void InitTitle()
|
private void InitTitle()
|
||||||
{
|
{
|
||||||
m_Title.OnChanged();
|
m_Title.OnChanged();
|
||||||
TextAnchor anchor = m_Title.location.textAnchor;
|
TextAnchor anchor = m_Title.location.runtimeTextAnchor;
|
||||||
Vector2 anchorMin = m_Title.location.anchorMin;
|
Vector2 anchorMin = m_Title.location.runtimeAnchorMin;
|
||||||
Vector2 anchorMax = m_Title.location.anchorMax;
|
Vector2 anchorMax = m_Title.location.runtimeAnchorMax;
|
||||||
Vector2 pivot = m_Title.location.pivot;
|
Vector2 pivot = m_Title.location.runtimePivot;
|
||||||
Vector3 titlePosition = m_Title.location.GetPosition(chartWidth, chartHeight);
|
Vector3 titlePosition = m_Title.location.GetPosition(chartWidth, chartHeight);
|
||||||
Vector3 subTitlePosition = -new Vector3(0, m_Title.textFontSize + m_Title.itemGap, 0);
|
Vector3 subTitlePosition = -new Vector3(0, m_Title.textFontSize + m_Title.itemGap, 0);
|
||||||
float titleWid = chartWidth;
|
float titleWid = chartWidth;
|
||||||
@@ -183,10 +183,10 @@ namespace XCharts
|
|||||||
private void InitLegend()
|
private void InitLegend()
|
||||||
{
|
{
|
||||||
m_Legend.OnChanged();
|
m_Legend.OnChanged();
|
||||||
TextAnchor anchor = m_Legend.location.textAnchor;
|
TextAnchor anchor = m_Legend.location.runtimeTextAnchor;
|
||||||
Vector2 anchorMin = m_Legend.location.anchorMin;
|
Vector2 anchorMin = m_Legend.location.runtimeAnchorMin;
|
||||||
Vector2 anchorMax = m_Legend.location.anchorMax;
|
Vector2 anchorMax = m_Legend.location.runtimeAnchorMax;
|
||||||
Vector2 pivot = m_Legend.location.pivot;
|
Vector2 pivot = m_Legend.location.runtimePivot;
|
||||||
|
|
||||||
var legendObject = ChartHelper.AddObject(s_LegendObjectName, transform, anchorMin, anchorMax,
|
var legendObject = ChartHelper.AddObject(s_LegendObjectName, transform, anchorMin, anchorMax,
|
||||||
pivot, new Vector2(chartWidth, chartHeight));
|
pivot, new Vector2(chartWidth, chartHeight));
|
||||||
@@ -409,7 +409,7 @@ namespace XCharts
|
|||||||
|
|
||||||
private void CheckPointerPos()
|
private void CheckPointerPos()
|
||||||
{
|
{
|
||||||
var needCheck = (m_Tooltip.show && m_Tooltip.inited)
|
var needCheck = (m_Tooltip.show && m_Tooltip.runtimeInited)
|
||||||
|| raycastTarget;
|
|| raycastTarget;
|
||||||
if (needCheck)
|
if (needCheck)
|
||||||
{
|
{
|
||||||
@@ -429,7 +429,7 @@ namespace XCharts
|
|||||||
|
|
||||||
private void CheckTooltip()
|
private void CheckTooltip()
|
||||||
{
|
{
|
||||||
if (!m_Tooltip.show || !m_Tooltip.inited)
|
if (!m_Tooltip.show || !m_Tooltip.runtimeInited)
|
||||||
{
|
{
|
||||||
if (m_Tooltip.IsActive())
|
if (m_Tooltip.IsActive())
|
||||||
{
|
{
|
||||||
@@ -439,9 +439,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < m_Tooltip.dataIndex.Count; i++)
|
for (int i = 0; i < m_Tooltip.runtimeDataIndex.Count; i++)
|
||||||
{
|
{
|
||||||
m_Tooltip.dataIndex[i] = -1;
|
m_Tooltip.runtimeDataIndex[i] = -1;
|
||||||
}
|
}
|
||||||
Vector2 local = pointerPos;
|
Vector2 local = pointerPos;
|
||||||
if (canvas == null) return;
|
if (canvas == null) return;
|
||||||
@@ -465,7 +465,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_Tooltip.pointerPos = local;
|
m_Tooltip.runtimePointerPos = local;
|
||||||
CheckTootipArea(local);
|
CheckTootipArea(local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,14 +154,14 @@ namespace XCharts
|
|||||||
if (!xAxis.show && !yAxis.show) continue;
|
if (!xAxis.show && !yAxis.show) continue;
|
||||||
if (isCartesian && xAxis.show && yAxis.show)
|
if (isCartesian && xAxis.show && yAxis.show)
|
||||||
{
|
{
|
||||||
var yRate = (yAxis.maxValue - yAxis.minValue) / coordinateHeight;
|
var yRate = (yAxis.runtimeMaxValue - yAxis.runtimeMinValue) / coordinateHeight;
|
||||||
var xRate = (xAxis.maxValue - xAxis.minValue) / coordinateWidth;
|
var xRate = (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) / coordinateWidth;
|
||||||
var yValue = yRate * (local.y - coordinateY - yAxis.zeroYOffset);
|
var yValue = yRate * (local.y - coordinateY - yAxis.runtimeZeroYOffset);
|
||||||
if (yAxis.minValue > 0) yValue += yAxis.minValue;
|
if (yAxis.runtimeMinValue > 0) yValue += yAxis.runtimeMinValue;
|
||||||
m_Tooltip.yValues[i] = yValue;
|
m_Tooltip.runtimeYValues[i] = yValue;
|
||||||
var xValue = xRate * (local.x - coordinateX - xAxis.zeroXOffset);
|
var xValue = xRate * (local.x - coordinateX - xAxis.runtimeZeroXOffset);
|
||||||
if (xAxis.minValue > 0) xValue += xAxis.minValue;
|
if (xAxis.runtimeMinValue > 0) xValue += xAxis.runtimeMinValue;
|
||||||
m_Tooltip.xValues[i] = xValue;
|
m_Tooltip.runtimeXValues[i] = xValue;
|
||||||
|
|
||||||
for (int j = 0; j < m_Series.Count; j++)
|
for (int j = 0; j < m_Series.Count; j++)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ namespace XCharts
|
|||||||
if (Mathf.Abs(xValue - xdata) / xRate < symbolSize
|
if (Mathf.Abs(xValue - xdata) / xRate < symbolSize
|
||||||
&& Mathf.Abs(yValue - ydata) / yRate < symbolSize)
|
&& Mathf.Abs(yValue - ydata) / yRate < symbolSize)
|
||||||
{
|
{
|
||||||
m_Tooltip.dataIndex[i] = n;
|
m_Tooltip.runtimeDataIndex[i] = n;
|
||||||
serieData.highlighted = true;
|
serieData.highlighted = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -195,8 +195,8 @@ namespace XCharts
|
|||||||
if ((xAxis.boundaryGap && (local.x > pX && local.x <= pX + splitWid)) ||
|
if ((xAxis.boundaryGap && (local.x > pX && local.x <= pX + splitWid)) ||
|
||||||
(!xAxis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
|
(!xAxis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
|
||||||
{
|
{
|
||||||
m_Tooltip.xValues[i] = j;
|
m_Tooltip.runtimeXValues[i] = j;
|
||||||
m_Tooltip.dataIndex[i] = j;
|
m_Tooltip.runtimeDataIndex[i] = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,16 +207,16 @@ namespace XCharts
|
|||||||
if ((yAxis.boundaryGap && (local.y > pY && local.y <= pY + splitWid)) ||
|
if ((yAxis.boundaryGap && (local.y > pY && local.y <= pY + splitWid)) ||
|
||||||
(!yAxis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
|
(!yAxis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
|
||||||
{
|
{
|
||||||
m_Tooltip.yValues[i] = j;
|
m_Tooltip.runtimeYValues[i] = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (xAxis.IsCategory())
|
else if (xAxis.IsCategory())
|
||||||
{
|
{
|
||||||
var value = (yAxis.maxValue - yAxis.minValue) * (local.y - coordinateY - yAxis.zeroYOffset) / coordinateHeight;
|
var value = (yAxis.runtimeMaxValue - yAxis.runtimeMinValue) * (local.y - coordinateY - yAxis.runtimeZeroYOffset) / coordinateHeight;
|
||||||
if (yAxis.minValue > 0) value += yAxis.minValue;
|
if (yAxis.runtimeMinValue > 0) value += yAxis.runtimeMinValue;
|
||||||
m_Tooltip.yValues[i] = value;
|
m_Tooltip.runtimeYValues[i] = value;
|
||||||
for (int j = 0; j < xAxis.GetDataNumber(m_DataZoom); j++)
|
for (int j = 0; j < xAxis.GetDataNumber(m_DataZoom); j++)
|
||||||
{
|
{
|
||||||
float splitWid = xAxis.GetDataWidth(coordinateWidth, dataCount, m_DataZoom);
|
float splitWid = xAxis.GetDataWidth(coordinateWidth, dataCount, m_DataZoom);
|
||||||
@@ -224,17 +224,17 @@ namespace XCharts
|
|||||||
if ((xAxis.boundaryGap && (local.x > pX && local.x <= pX + splitWid)) ||
|
if ((xAxis.boundaryGap && (local.x > pX && local.x <= pX + splitWid)) ||
|
||||||
(!xAxis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
|
(!xAxis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
|
||||||
{
|
{
|
||||||
m_Tooltip.xValues[i] = j;
|
m_Tooltip.runtimeXValues[i] = j;
|
||||||
m_Tooltip.dataIndex[i] = j;
|
m_Tooltip.runtimeDataIndex[i] = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (yAxis.IsCategory())
|
else if (yAxis.IsCategory())
|
||||||
{
|
{
|
||||||
var value = (xAxis.maxValue - xAxis.minValue) * (local.x - coordinateX - xAxis.zeroXOffset) / coordinateWidth;
|
var value = (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) * (local.x - coordinateX - xAxis.runtimeZeroXOffset) / coordinateWidth;
|
||||||
if (xAxis.minValue > 0) value += xAxis.minValue;
|
if (xAxis.runtimeMinValue > 0) value += xAxis.runtimeMinValue;
|
||||||
m_Tooltip.xValues[i] = value;
|
m_Tooltip.runtimeXValues[i] = value;
|
||||||
for (int j = 0; j < yAxis.GetDataNumber(m_DataZoom); j++)
|
for (int j = 0; j < yAxis.GetDataNumber(m_DataZoom); j++)
|
||||||
{
|
{
|
||||||
float splitWid = yAxis.GetDataWidth(coordinateHeight, dataCount, m_DataZoom);
|
float splitWid = yAxis.GetDataWidth(coordinateHeight, dataCount, m_DataZoom);
|
||||||
@@ -242,8 +242,8 @@ namespace XCharts
|
|||||||
if ((yAxis.boundaryGap && (local.y > pY && local.y <= pY + splitWid)) ||
|
if ((yAxis.boundaryGap && (local.y > pY && local.y <= pY + splitWid)) ||
|
||||||
(!yAxis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
|
(!yAxis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
|
||||||
{
|
{
|
||||||
m_Tooltip.yValues[i] = j;
|
m_Tooltip.runtimeYValues[i] = j;
|
||||||
m_Tooltip.dataIndex[i] = j;
|
m_Tooltip.runtimeDataIndex[i] = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,17 +276,17 @@ namespace XCharts
|
|||||||
bool isCartesian = IsValue();
|
bool isCartesian = IsValue();
|
||||||
if (isCartesian)
|
if (isCartesian)
|
||||||
{
|
{
|
||||||
index = m_Tooltip.dataIndex[0];
|
index = m_Tooltip.runtimeDataIndex[0];
|
||||||
tempAxis = m_XAxises[0];
|
tempAxis = m_XAxises[0];
|
||||||
}
|
}
|
||||||
else if (m_XAxises[0].type == Axis.AxisType.Value)
|
else if (m_XAxises[0].type == Axis.AxisType.Value)
|
||||||
{
|
{
|
||||||
index = (int)m_Tooltip.yValues[0];
|
index = (int)m_Tooltip.runtimeYValues[0];
|
||||||
tempAxis = m_YAxises[0];
|
tempAxis = m_YAxises[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
index = (int)m_Tooltip.xValues[0];
|
index = (int)m_Tooltip.runtimeXValues[0];
|
||||||
tempAxis = m_XAxises[0];
|
tempAxis = m_XAxises[0];
|
||||||
}
|
}
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
@@ -341,13 +341,13 @@ namespace XCharts
|
|||||||
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, category, m_DataZoom));
|
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, category, m_DataZoom));
|
||||||
}
|
}
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
if (pos.x + m_Tooltip.width > chartWidth)
|
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
||||||
{
|
{
|
||||||
pos.x = chartWidth - m_Tooltip.width;
|
pos.x = chartWidth - m_Tooltip.runtimeWidth;
|
||||||
}
|
}
|
||||||
if (pos.y - m_Tooltip.height < 0)
|
if (pos.y - m_Tooltip.runtimeHeight < 0)
|
||||||
{
|
{
|
||||||
pos.y = m_Tooltip.height;
|
pos.y = m_Tooltip.runtimeHeight;
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(pos);
|
m_Tooltip.UpdateContentPos(pos);
|
||||||
m_Tooltip.SetActive(true);
|
m_Tooltip.SetActive(true);
|
||||||
@@ -375,14 +375,14 @@ namespace XCharts
|
|||||||
var diff = axisIndex > 0 ? -axis.axisLabel.fontSize - axis.axisLabel.margin - 3.5f : axis.axisLabel.margin / 2 + 1;
|
var diff = axisIndex > 0 ? -axis.axisLabel.fontSize - axis.axisLabel.margin - 3.5f : axis.axisLabel.margin / 2 + 1;
|
||||||
if (axis.IsValue())
|
if (axis.IsValue())
|
||||||
{
|
{
|
||||||
labelText = ChartCached.FloatToStr(m_Tooltip.xValues[axisIndex], 2);
|
labelText = ChartCached.FloatToStr(m_Tooltip.runtimeXValues[axisIndex], 2);
|
||||||
labelPos = new Vector2(m_Tooltip.pointerPos.x, posY - diff);
|
labelPos = new Vector2(m_Tooltip.runtimePointerPos.x, posY - diff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelText = axis.GetData((int)m_Tooltip.xValues[axisIndex], m_DataZoom);
|
labelText = axis.GetData((int)m_Tooltip.runtimeXValues[axisIndex], m_DataZoom);
|
||||||
float splitWidth = axis.GetSplitWidth(coordinateWidth, m_DataZoom);
|
float splitWidth = axis.GetSplitWidth(coordinateWidth, m_DataZoom);
|
||||||
int index = (int)m_Tooltip.xValues[axisIndex];
|
int index = (int)m_Tooltip.runtimeXValues[axisIndex];
|
||||||
float px = coordinateX + index * splitWidth + (axis.boundaryGap ? splitWidth / 2 : 0) + 0.5f;
|
float px = coordinateX + index * splitWidth + (axis.boundaryGap ? splitWidth / 2 : 0) + 0.5f;
|
||||||
labelPos = new Vector2(px, posY - diff);
|
labelPos = new Vector2(px, posY - diff);
|
||||||
}
|
}
|
||||||
@@ -393,14 +393,14 @@ namespace XCharts
|
|||||||
var diff = axisIndex > 0 ? -axis.axisLabel.margin + 3 : axis.axisLabel.margin - 3;
|
var diff = axisIndex > 0 ? -axis.axisLabel.margin + 3 : axis.axisLabel.margin - 3;
|
||||||
if (axis.IsValue())
|
if (axis.IsValue())
|
||||||
{
|
{
|
||||||
labelText = ChartCached.FloatToStr(m_Tooltip.yValues[axisIndex], 2);
|
labelText = ChartCached.FloatToStr(m_Tooltip.runtimeYValues[axisIndex], 2);
|
||||||
labelPos = new Vector2(posX - diff, m_Tooltip.pointerPos.y);
|
labelPos = new Vector2(posX - diff, m_Tooltip.runtimePointerPos.y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelText = axis.GetData((int)m_Tooltip.yValues[axisIndex], m_DataZoom);
|
labelText = axis.GetData((int)m_Tooltip.runtimeYValues[axisIndex], m_DataZoom);
|
||||||
float splitWidth = axis.GetSplitWidth(coordinateHeight, m_DataZoom);
|
float splitWidth = axis.GetSplitWidth(coordinateHeight, m_DataZoom);
|
||||||
int index = (int)m_Tooltip.yValues[axisIndex];
|
int index = (int)m_Tooltip.runtimeYValues[axisIndex];
|
||||||
float py = coordinateY + index * splitWidth + (axis.boundaryGap ? splitWidth / 2 : 0);
|
float py = coordinateY + index * splitWidth + (axis.boundaryGap ? splitWidth / 2 : 0);
|
||||||
labelPos = new Vector2(posX - diff, py);
|
labelPos = new Vector2(posX - diff, py);
|
||||||
}
|
}
|
||||||
@@ -439,8 +439,8 @@ namespace XCharts
|
|||||||
m_YAxises.Add(axis1);
|
m_YAxises.Add(axis1);
|
||||||
m_YAxises.Add(axis2);
|
m_YAxises.Add(axis2);
|
||||||
}
|
}
|
||||||
foreach (var axis in m_XAxises) axis.minValue = axis.maxValue = 0;
|
foreach (var axis in m_XAxises) axis.runtimeMinValue = axis.runtimeMaxValue = 0;
|
||||||
foreach (var axis in m_YAxises) axis.minValue = axis.maxValue = 0;
|
foreach (var axis in m_YAxises) axis.runtimeMinValue = axis.runtimeMaxValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitAxisY()
|
private void InitAxisY()
|
||||||
@@ -462,7 +462,7 @@ namespace XCharts
|
|||||||
axisObj.transform.localPosition = Vector3.zero;
|
axisObj.transform.localPosition = Vector3.zero;
|
||||||
axisObj.SetActive(yAxis.show && yAxis.axisLabel.show);
|
axisObj.SetActive(yAxis.show && yAxis.axisLabel.show);
|
||||||
ChartHelper.HideAllObject(axisObj);
|
ChartHelper.HideAllObject(axisObj);
|
||||||
if (yAxis.IsValue() && yAxis.minValue == 0 && yAxis.maxValue == 0) return;
|
if (yAxis.IsValue() && yAxis.runtimeMinValue == 0 && yAxis.runtimeMaxValue == 0) return;
|
||||||
var labelColor = yAxis.axisLabel.color == Color.clear ?
|
var labelColor = yAxis.axisLabel.color == Color.clear ?
|
||||||
(Color)m_ThemeInfo.axisTextColor :
|
(Color)m_ThemeInfo.axisTextColor :
|
||||||
yAxis.axisLabel.color;
|
yAxis.axisLabel.color;
|
||||||
@@ -491,7 +491,7 @@ namespace XCharts
|
|||||||
txt.transform.localPosition = GetLabelYPosition(totalWidth + (yAxis.boundaryGap ? labelWidth / 2 : 0), i, yAxisIndex, yAxis);
|
txt.transform.localPosition = GetLabelYPosition(totalWidth + (yAxis.boundaryGap ? labelWidth / 2 : 0), i, yAxisIndex, yAxis);
|
||||||
|
|
||||||
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
||||||
txt.text = yAxis.GetLabelName(coordinateHeight, i, yAxis.minValue, yAxis.maxValue, m_DataZoom, isPercentStack);
|
txt.text = yAxis.GetLabelName(coordinateHeight, i, yAxis.runtimeMinValue, yAxis.runtimeMaxValue, m_DataZoom, isPercentStack);
|
||||||
txt.gameObject.SetActive(yAxis.show &&
|
txt.gameObject.SetActive(yAxis.show &&
|
||||||
(yAxis.axisLabel.interval == 0 || i % (yAxis.axisLabel.interval + 1) == 0));
|
(yAxis.axisLabel.interval == 0 || i % (yAxis.axisLabel.interval + 1) == 0));
|
||||||
yAxis.axisLabelTextList.Add(txt);
|
yAxis.axisLabelTextList.Add(txt);
|
||||||
@@ -504,7 +504,7 @@ namespace XCharts
|
|||||||
var fontSize = yAxis.axisName.fontSize;
|
var fontSize = yAxis.axisName.fontSize;
|
||||||
var offset = yAxis.axisName.offset;
|
var offset = yAxis.axisName.offset;
|
||||||
Text axisName = null;
|
Text axisName = null;
|
||||||
var zeroPos = new Vector3(coordinateX + m_XAxises[yAxisIndex].zeroXOffset, coordinateY);
|
var zeroPos = new Vector3(coordinateX + m_XAxises[yAxisIndex].runtimeZeroXOffset, coordinateY);
|
||||||
switch (yAxis.axisName.location)
|
switch (yAxis.axisName.location)
|
||||||
{
|
{
|
||||||
case AxisName.Location.Start:
|
case AxisName.Location.Start:
|
||||||
@@ -538,10 +538,10 @@ namespace XCharts
|
|||||||
axisName.text = yAxis.axisName.name;
|
axisName.text = yAxis.axisName.name;
|
||||||
}
|
}
|
||||||
//init tooltip label
|
//init tooltip label
|
||||||
if (m_Tooltip.gameObject)
|
if (m_Tooltip.runtimeGameObject)
|
||||||
{
|
{
|
||||||
Vector2 privot = yAxisIndex > 0 ? new Vector2(0, 0.5f) : new Vector2(1, 0.5f);
|
Vector2 privot = yAxisIndex > 0 ? new Vector2(0, 0.5f) : new Vector2(1, 0.5f);
|
||||||
var labelParent = m_Tooltip.gameObject.transform;
|
var labelParent = m_Tooltip.runtimeGameObject.transform;
|
||||||
GameObject labelObj = ChartHelper.AddTooltipLabel(objName + "_label", labelParent, m_ThemeInfo.font, privot);
|
GameObject labelObj = ChartHelper.AddTooltipLabel(objName + "_label", labelParent, m_ThemeInfo.font, privot);
|
||||||
yAxis.SetTooltipLabel(labelObj);
|
yAxis.SetTooltipLabel(labelObj);
|
||||||
yAxis.SetTooltipLabelColor(m_ThemeInfo.tooltipBackgroundColor, m_ThemeInfo.tooltipTextColor);
|
yAxis.SetTooltipLabelColor(m_ThemeInfo.tooltipBackgroundColor, m_ThemeInfo.tooltipTextColor);
|
||||||
@@ -567,7 +567,7 @@ namespace XCharts
|
|||||||
axisObj.transform.localPosition = Vector3.zero;
|
axisObj.transform.localPosition = Vector3.zero;
|
||||||
axisObj.SetActive(xAxis.show && xAxis.axisLabel.show);
|
axisObj.SetActive(xAxis.show && xAxis.axisLabel.show);
|
||||||
ChartHelper.HideAllObject(axisObj);
|
ChartHelper.HideAllObject(axisObj);
|
||||||
if (xAxis.IsValue() && xAxis.minValue == 0 && xAxis.maxValue == 0) return;
|
if (xAxis.IsValue() && xAxis.runtimeMinValue == 0 && xAxis.runtimeMaxValue == 0) return;
|
||||||
var labelColor = xAxis.axisLabel.color == Color.clear ?
|
var labelColor = xAxis.axisLabel.color == Color.clear ?
|
||||||
(Color)m_ThemeInfo.axisTextColor :
|
(Color)m_ThemeInfo.axisTextColor :
|
||||||
xAxis.axisLabel.color;
|
xAxis.axisLabel.color;
|
||||||
@@ -586,7 +586,7 @@ namespace XCharts
|
|||||||
i, xAxisIndex, xAxis);
|
i, xAxisIndex, xAxis);
|
||||||
totalWidth += labelWidth;
|
totalWidth += labelWidth;
|
||||||
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
||||||
txt.text = xAxis.GetLabelName(coordinateWidth, i, xAxis.minValue, xAxis.maxValue, m_DataZoom, isPercentStack);
|
txt.text = xAxis.GetLabelName(coordinateWidth, i, xAxis.runtimeMinValue, xAxis.runtimeMaxValue, m_DataZoom, isPercentStack);
|
||||||
txt.gameObject.SetActive(xAxis.show &&
|
txt.gameObject.SetActive(xAxis.show &&
|
||||||
(xAxis.axisLabel.interval == 0 || i % (xAxis.axisLabel.interval + 1) == 0));
|
(xAxis.axisLabel.interval == 0 || i % (xAxis.axisLabel.interval + 1) == 0));
|
||||||
xAxis.axisLabelTextList.Add(txt);
|
xAxis.axisLabelTextList.Add(txt);
|
||||||
@@ -598,7 +598,7 @@ namespace XCharts
|
|||||||
var fontSize = xAxis.axisName.fontSize;
|
var fontSize = xAxis.axisName.fontSize;
|
||||||
var offset = xAxis.axisName.offset;
|
var offset = xAxis.axisName.offset;
|
||||||
Text axisName = null;
|
Text axisName = null;
|
||||||
var zeroPos = new Vector3(coordinateX, coordinateY + m_YAxises[xAxisIndex].zeroYOffset);
|
var zeroPos = new Vector3(coordinateX, coordinateY + m_YAxises[xAxisIndex].runtimeZeroYOffset);
|
||||||
switch (xAxis.axisName.location)
|
switch (xAxis.axisName.location)
|
||||||
{
|
{
|
||||||
case AxisName.Location.Start:
|
case AxisName.Location.Start:
|
||||||
@@ -631,10 +631,10 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
axisName.text = xAxis.axisName.name;
|
axisName.text = xAxis.axisName.name;
|
||||||
}
|
}
|
||||||
if (m_Tooltip.gameObject)
|
if (m_Tooltip.runtimeGameObject)
|
||||||
{
|
{
|
||||||
Vector2 privot = xAxisIndex > 0 ? new Vector2(0.5f, 1) : new Vector2(0.5f, 1);
|
Vector2 privot = xAxisIndex > 0 ? new Vector2(0.5f, 1) : new Vector2(0.5f, 1);
|
||||||
var labelParent = m_Tooltip.gameObject.transform;
|
var labelParent = m_Tooltip.runtimeGameObject.transform;
|
||||||
GameObject labelObj = ChartHelper.AddTooltipLabel(ChartHelper.Cancat(objName, "_label"), labelParent, m_ThemeInfo.font, privot);
|
GameObject labelObj = ChartHelper.AddTooltipLabel(ChartHelper.Cancat(objName, "_label"), labelParent, m_ThemeInfo.font, privot);
|
||||||
xAxis.SetTooltipLabel(labelObj);
|
xAxis.SetTooltipLabel(labelObj);
|
||||||
xAxis.SetTooltipLabelColor(m_ThemeInfo.tooltipBackgroundColor, m_ThemeInfo.tooltipTextColor);
|
xAxis.SetTooltipLabelColor(m_ThemeInfo.tooltipBackgroundColor, m_ThemeInfo.tooltipTextColor);
|
||||||
@@ -648,12 +648,14 @@ namespace XCharts
|
|||||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||||
dataZoomObject.transform.localPosition = Vector3.zero;
|
dataZoomObject.transform.localPosition = Vector3.zero;
|
||||||
ChartHelper.HideAllObject(dataZoomObject);
|
ChartHelper.HideAllObject(dataZoomObject);
|
||||||
m_DataZoom.startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start",
|
var startLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "start",
|
||||||
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleRight,
|
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleRight,
|
||||||
Vector2.zero, Vector2.zero, new Vector2(1, 0.5f), new Vector2(200, 20), m_DataZoom.fontSize, 0, m_DataZoom.fontStyle);
|
Vector2.zero, Vector2.zero, new Vector2(1, 0.5f), new Vector2(200, 20), m_DataZoom.fontSize, 0, m_DataZoom.fontStyle);
|
||||||
m_DataZoom.endLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "end",
|
var endLabel = ChartHelper.AddTextObject(s_DefaultDataZoom + "end",
|
||||||
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleLeft,
|
dataZoomObject.transform, m_ThemeInfo.font, m_ThemeInfo.dataZoomTextColor, TextAnchor.MiddleLeft,
|
||||||
Vector2.zero, Vector2.zero, new Vector2(0, 0.5f), new Vector2(200, 20), m_DataZoom.fontSize, 0, m_DataZoom.fontStyle);
|
Vector2.zero, Vector2.zero, new Vector2(0, 0.5f), new Vector2(200, 20), m_DataZoom.fontSize, 0, m_DataZoom.fontStyle);
|
||||||
|
m_DataZoom.SetStartLabel(startLabel);
|
||||||
|
m_DataZoom.SetEndLabel(endLabel);
|
||||||
m_DataZoom.SetLabelActive(false);
|
m_DataZoom.SetLabelActive(false);
|
||||||
CheckRaycastTarget();
|
CheckRaycastTarget();
|
||||||
var xAxis = m_XAxises[m_DataZoom.xAxisIndex];
|
var xAxis = m_XAxises[m_DataZoom.xAxisIndex];
|
||||||
@@ -786,26 +788,26 @@ namespace XCharts
|
|||||||
m_Series.GetYMinMaxValue(m_DataZoom, axisIndex, false, out tempMinValue, out tempMaxValue);
|
m_Series.GetYMinMaxValue(m_DataZoom, axisIndex, false, out tempMinValue, out tempMaxValue);
|
||||||
}
|
}
|
||||||
axis.AdjustMinMaxValue(ref tempMinValue, ref tempMaxValue);
|
axis.AdjustMinMaxValue(ref tempMinValue, ref tempMaxValue);
|
||||||
if (tempMinValue != axis.minValue || tempMaxValue != axis.maxValue)
|
if (tempMinValue != axis.runtimeMinValue || tempMaxValue != axis.runtimeMaxValue)
|
||||||
{
|
{
|
||||||
m_CheckMinMaxValue = true;
|
m_CheckMinMaxValue = true;
|
||||||
axis.minValue = tempMinValue;
|
axis.runtimeMinValue = tempMinValue;
|
||||||
axis.maxValue = tempMaxValue;
|
axis.runtimeMaxValue = tempMaxValue;
|
||||||
axis.zeroXOffset = 0;
|
axis.runtimeZeroXOffset = 0;
|
||||||
axis.zeroYOffset = 0;
|
axis.runtimeZeroYOffset = 0;
|
||||||
if (tempMinValue != 0 || tempMaxValue != 0)
|
if (tempMinValue != 0 || tempMaxValue != 0)
|
||||||
{
|
{
|
||||||
if (axis is XAxis && axis.IsValue())
|
if (axis is XAxis && axis.IsValue())
|
||||||
{
|
{
|
||||||
axis.zeroXOffset = axis.minValue > 0 ? 0 :
|
axis.runtimeZeroXOffset = axis.runtimeMinValue > 0 ? 0 :
|
||||||
axis.maxValue < 0 ? this.coordinateWidth :
|
axis.runtimeMaxValue < 0 ? this.coordinateWidth :
|
||||||
Mathf.Abs(axis.minValue) * (this.coordinateWidth / (Mathf.Abs(axis.minValue) + Mathf.Abs(axis.maxValue)));
|
Mathf.Abs(axis.runtimeMinValue) * (this.coordinateWidth / (Mathf.Abs(axis.runtimeMinValue) + Mathf.Abs(axis.runtimeMaxValue)));
|
||||||
}
|
}
|
||||||
if (axis is YAxis && axis.IsValue())
|
if (axis is YAxis && axis.IsValue())
|
||||||
{
|
{
|
||||||
axis.zeroYOffset = axis.minValue > 0 ? 0 :
|
axis.runtimeZeroYOffset = axis.runtimeMinValue > 0 ? 0 :
|
||||||
axis.maxValue < 0 ? coordinateHeight :
|
axis.runtimeMaxValue < 0 ? coordinateHeight :
|
||||||
Mathf.Abs(axis.minValue) * (coordinateHeight / (Mathf.Abs(axis.minValue) + Mathf.Abs(axis.maxValue)));
|
Mathf.Abs(axis.runtimeMinValue) * (coordinateHeight / (Mathf.Abs(axis.runtimeMinValue) + Mathf.Abs(axis.runtimeMaxValue)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (updateChart)
|
if (updateChart)
|
||||||
@@ -881,7 +883,7 @@ namespace XCharts
|
|||||||
var size = yAxis.GetScaleNumber(coordinateWidth, m_DataZoom);
|
var size = yAxis.GetScaleNumber(coordinateWidth, m_DataZoom);
|
||||||
var totalWidth = coordinateY;
|
var totalWidth = coordinateY;
|
||||||
var xAxis = m_XAxises[yAxisIndex];
|
var xAxis = m_XAxises[yAxisIndex];
|
||||||
var zeroPos = new Vector3(coordinateX + xAxis.zeroXOffset, coordinateY + yAxis.zeroYOffset);
|
var zeroPos = new Vector3(coordinateX + xAxis.runtimeZeroXOffset, coordinateY + yAxis.runtimeZeroYOffset);
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
var scaleWidth = yAxis.GetScaleWidth(coordinateHeight, i, m_DataZoom);
|
var scaleWidth = yAxis.GetScaleWidth(coordinateHeight, i, m_DataZoom);
|
||||||
@@ -901,7 +903,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (yAxis.axisTick.show)
|
if (yAxis.axisTick.show)
|
||||||
{
|
{
|
||||||
var startX = coordinateX + m_XAxises[yAxisIndex].zeroXOffset;
|
var startX = coordinateX + m_XAxises[yAxisIndex].runtimeZeroXOffset;
|
||||||
if (yAxis.IsValue() && yAxisIndex > 0) startX += coordinateWidth;
|
if (yAxis.IsValue() && yAxisIndex > 0) startX += coordinateWidth;
|
||||||
bool inside = yAxis.axisTick.inside;
|
bool inside = yAxis.axisTick.inside;
|
||||||
if ((inside && yAxisIndex == 0) || (!inside && yAxisIndex == 1))
|
if ((inside && yAxisIndex == 0) || (!inside && yAxisIndex == 1))
|
||||||
@@ -935,7 +937,7 @@ namespace XCharts
|
|||||||
var size = xAxis.GetScaleNumber(coordinateWidth, m_DataZoom);
|
var size = xAxis.GetScaleNumber(coordinateWidth, m_DataZoom);
|
||||||
var totalWidth = coordinateX;
|
var totalWidth = coordinateX;
|
||||||
var yAxis = m_YAxises[xAxisIndex];
|
var yAxis = m_YAxises[xAxisIndex];
|
||||||
var zeroPos = new Vector3(coordinateX, coordinateY + yAxis.zeroYOffset);
|
var zeroPos = new Vector3(coordinateX, coordinateY + yAxis.runtimeZeroYOffset);
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
var scaleWidth = xAxis.GetScaleWidth(coordinateWidth, i, m_DataZoom);
|
var scaleWidth = xAxis.GetScaleWidth(coordinateWidth, i, m_DataZoom);
|
||||||
@@ -955,7 +957,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (xAxis.axisTick.show)
|
if (xAxis.axisTick.show)
|
||||||
{
|
{
|
||||||
var startY = coordinateY + m_YAxises[xAxisIndex].zeroYOffset;
|
var startY = coordinateY + m_YAxises[xAxisIndex].runtimeZeroYOffset;
|
||||||
if (xAxis.IsValue() && xAxisIndex > 0) startY += coordinateHeight;
|
if (xAxis.IsValue() && xAxisIndex > 0) startY += coordinateHeight;
|
||||||
bool inside = xAxis.axisTick.inside;
|
bool inside = xAxis.axisTick.inside;
|
||||||
if ((inside && xAxisIndex == 0) || (!inside && xAxisIndex == 1))
|
if ((inside && xAxisIndex == 0) || (!inside && xAxisIndex == 1))
|
||||||
@@ -986,7 +988,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (xAxis.show && xAxis.axisLine.show)
|
if (xAxis.show && xAxis.axisLine.show)
|
||||||
{
|
{
|
||||||
var lineY = coordinateY + (xAxis.axisLine.onZero ? m_YAxises[xAxisIndex].zeroYOffset : 0);
|
var lineY = coordinateY + (xAxis.axisLine.onZero ? m_YAxises[xAxisIndex].runtimeZeroYOffset : 0);
|
||||||
if (xAxis.IsValue() && xAxisIndex > 0) lineY += coordinateHeight;
|
if (xAxis.IsValue() && xAxisIndex > 0) lineY += coordinateHeight;
|
||||||
var left = new Vector3(coordinateX - xAxis.axisLine.width, lineY);
|
var left = new Vector3(coordinateX - xAxis.axisLine.width, lineY);
|
||||||
var top = new Vector3(coordinateX + coordinateWidth + xAxis.axisLine.width, lineY);
|
var top = new Vector3(coordinateX + coordinateWidth + xAxis.axisLine.width, lineY);
|
||||||
@@ -1004,7 +1006,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (yAxis.show && yAxis.axisLine.show)
|
if (yAxis.show && yAxis.axisLine.show)
|
||||||
{
|
{
|
||||||
var lineX = coordinateX + (yAxis.axisLine.onZero ? m_XAxises[yAxisIndex].zeroXOffset : 0);
|
var lineX = coordinateX + (yAxis.axisLine.onZero ? m_XAxises[yAxisIndex].runtimeZeroXOffset : 0);
|
||||||
if (yAxis.IsValue() && yAxisIndex > 0) lineX += coordinateWidth;
|
if (yAxis.IsValue() && yAxisIndex > 0) lineX += coordinateWidth;
|
||||||
var top = new Vector3(lineX, coordinateY + coordinateHeight + yAxis.axisLine.width);
|
var top = new Vector3(lineX, coordinateY + coordinateHeight + yAxis.axisLine.width);
|
||||||
ChartDrawer.DrawLine(vh, new Vector3(lineX, coordinateY - yAxis.axisLine.width),
|
ChartDrawer.DrawLine(vh, new Vector3(lineX, coordinateY - yAxis.axisLine.width),
|
||||||
@@ -1056,8 +1058,8 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
float value = SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i);
|
float value = SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i);
|
||||||
float pX = coordinateX + i * scaleWid;
|
float pX = coordinateX + i * scaleWid;
|
||||||
float dataHig = (axis.maxValue - axis.minValue) == 0 ? 0 :
|
float dataHig = (axis.runtimeMaxValue - axis.runtimeMinValue) == 0 ? 0 :
|
||||||
(value - axis.minValue) / (axis.maxValue - axis.minValue) * hig;
|
(value - axis.runtimeMinValue) / (axis.runtimeMaxValue - axis.runtimeMinValue) * hig;
|
||||||
np = new Vector3(pX, m_DataZoom.bottom + dataHig);
|
np = new Vector3(pX, m_DataZoom.bottom + dataHig);
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
@@ -1127,24 +1129,24 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
case Tooltip.Type.Corss:
|
case Tooltip.Type.Corss:
|
||||||
case Tooltip.Type.Line:
|
case Tooltip.Type.Line:
|
||||||
float pX = coordinateX + m_Tooltip.xValues[i] * splitWidth
|
float pX = coordinateX + m_Tooltip.runtimeXValues[i] * splitWidth
|
||||||
+ (xAxis.boundaryGap ? splitWidth / 2 : 0);
|
+ (xAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||||
if (xAxis.IsValue()) pX = m_Tooltip.pointerPos.x;
|
if (xAxis.IsValue()) pX = m_Tooltip.runtimePointerPos.x;
|
||||||
Vector2 sp = new Vector2(pX, coordinateY);
|
Vector2 sp = new Vector2(pX, coordinateY);
|
||||||
Vector2 ep = new Vector2(pX, coordinateY + coordinateHeight);
|
Vector2 ep = new Vector2(pX, coordinateY + coordinateHeight);
|
||||||
DrawSplitLine(vh, xAxis, Axis.SplitLineType.Solid, sp, ep, m_ThemeInfo.tooltipLineColor);
|
DrawSplitLine(vh, xAxis, Axis.SplitLineType.Solid, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||||
if (m_Tooltip.type == Tooltip.Type.Corss)
|
if (m_Tooltip.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
sp = new Vector2(coordinateX, m_Tooltip.pointerPos.y);
|
sp = new Vector2(coordinateX, m_Tooltip.runtimePointerPos.y);
|
||||||
ep = new Vector2(coordinateX + coordinateWidth, m_Tooltip.pointerPos.y);
|
ep = new Vector2(coordinateX + coordinateWidth, m_Tooltip.runtimePointerPos.y);
|
||||||
DrawSplitLine(vh, yAxis, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
DrawSplitLine(vh, yAxis, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Tooltip.Type.Shadow:
|
case Tooltip.Type.Shadow:
|
||||||
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||||
pX = coordinateX + splitWidth * m_Tooltip.xValues[i] -
|
pX = coordinateX + splitWidth * m_Tooltip.runtimeXValues[i] -
|
||||||
(xAxis.boundaryGap ? 0 : splitWidth / 2);
|
(xAxis.boundaryGap ? 0 : splitWidth / 2);
|
||||||
if (xAxis.IsValue()) pX = m_Tooltip.xValues[i];
|
if (xAxis.IsValue()) pX = m_Tooltip.runtimeXValues[i];
|
||||||
float pY = coordinateY + coordinateHeight;
|
float pY = coordinateY + coordinateHeight;
|
||||||
Vector3 p1 = new Vector3(pX, coordinateY);
|
Vector3 p1 = new Vector3(pX, coordinateY);
|
||||||
Vector3 p2 = new Vector3(pX, pY);
|
Vector3 p2 = new Vector3(pX, pY);
|
||||||
@@ -1172,21 +1174,21 @@ namespace XCharts
|
|||||||
case Tooltip.Type.Corss:
|
case Tooltip.Type.Corss:
|
||||||
case Tooltip.Type.Line:
|
case Tooltip.Type.Line:
|
||||||
|
|
||||||
float pY = coordinateY + m_Tooltip.yValues[i] * splitWidth + (yAxis.boundaryGap ? splitWidth / 2 : 0);
|
float pY = coordinateY + m_Tooltip.runtimeYValues[i] * splitWidth + (yAxis.boundaryGap ? splitWidth / 2 : 0);
|
||||||
Vector2 sp = new Vector2(coordinateX, pY);
|
Vector2 sp = new Vector2(coordinateX, pY);
|
||||||
Vector2 ep = new Vector2(coordinateX + coordinateWidth, pY);
|
Vector2 ep = new Vector2(coordinateX + coordinateWidth, pY);
|
||||||
DrawSplitLine(vh, xAxis, Axis.SplitLineType.Solid, sp, ep, m_ThemeInfo.tooltipLineColor);
|
DrawSplitLine(vh, xAxis, Axis.SplitLineType.Solid, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||||
if (m_Tooltip.type == Tooltip.Type.Corss)
|
if (m_Tooltip.type == Tooltip.Type.Corss)
|
||||||
{
|
{
|
||||||
sp = new Vector2(coordinateX, m_Tooltip.pointerPos.y);
|
sp = new Vector2(coordinateX, m_Tooltip.runtimePointerPos.y);
|
||||||
ep = new Vector2(coordinateX + coordinateWidth, m_Tooltip.pointerPos.y);
|
ep = new Vector2(coordinateX + coordinateWidth, m_Tooltip.runtimePointerPos.y);
|
||||||
DrawSplitLine(vh, yAxis, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
DrawSplitLine(vh, yAxis, Axis.SplitLineType.Dashed, sp, ep, m_ThemeInfo.tooltipLineColor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Tooltip.Type.Shadow:
|
case Tooltip.Type.Shadow:
|
||||||
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||||
float pX = coordinateX + coordinateWidth;
|
float pX = coordinateX + coordinateWidth;
|
||||||
pY = coordinateY + splitWidth * m_Tooltip.yValues[i] -
|
pY = coordinateY + splitWidth * m_Tooltip.runtimeYValues[i] -
|
||||||
(yAxis.boundaryGap ? 0 : splitWidth / 2);
|
(yAxis.boundaryGap ? 0 : splitWidth / 2);
|
||||||
Vector3 p1 = new Vector3(coordinateX, pY);
|
Vector3 p1 = new Vector3(coordinateX, pY);
|
||||||
Vector3 p2 = new Vector3(coordinateX, pY + tooltipSplitWid);
|
Vector3 p2 = new Vector3(coordinateX, pY + tooltipSplitWid);
|
||||||
@@ -1289,10 +1291,8 @@ namespace XCharts
|
|||||||
var start = coordinateX + coordinateWidth * m_DataZoom.start / 100;
|
var start = coordinateX + coordinateWidth * m_DataZoom.start / 100;
|
||||||
var end = coordinateX + coordinateWidth * m_DataZoom.end / 100;
|
var end = coordinateX + coordinateWidth * m_DataZoom.end / 100;
|
||||||
var hig = m_DataZoom.GetHeight(grid.bottom);
|
var hig = m_DataZoom.GetHeight(grid.bottom);
|
||||||
m_DataZoom.startLabel.transform.localPosition =
|
m_DataZoom.UpdateStartLabelPosition(new Vector3(start - 10, m_DataZoom.bottom + hig / 2));
|
||||||
new Vector3(start - 10, m_DataZoom.bottom + hig / 2);
|
m_DataZoom.UpdateEndLabelPosition(new Vector3(end + 10, m_DataZoom.bottom + hig / 2));
|
||||||
m_DataZoom.endLabel.transform.localPosition =
|
|
||||||
new Vector3(end + 10, m_DataZoom.bottom + hig / 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1313,12 +1313,12 @@ namespace XCharts
|
|||||||
if (isYAxis)
|
if (isYAxis)
|
||||||
{
|
{
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
zeroPos = new Vector3(coordinateX + xAxis.zeroXOffset, coordinateY);
|
zeroPos = new Vector3(coordinateX + xAxis.runtimeZeroXOffset, coordinateY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
zeroPos = new Vector3(coordinateX, coordinateY + yAxis.zeroYOffset);
|
zeroPos = new Vector3(coordinateX, coordinateY + yAxis.runtimeZeroYOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ namespace XCharts
|
|||||||
seriesHig.Add(0);
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = showData[i].data[1];
|
float value = showData[i].data[1];
|
||||||
float pX = seriesHig[i] + coordinateX + xAxis.zeroXOffset + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + xAxis.runtimeZeroXOffset + yAxis.axisLine.width;
|
||||||
float pY = coordinateY + +i * categoryWidth;
|
float pY = coordinateY + +i * categoryWidth;
|
||||||
if (!yAxis.boundaryGap) pY -= categoryWidth / 2;
|
if (!yAxis.boundaryGap) pY -= categoryWidth / 2;
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valueTotal = xAxis.maxValue - xAxis.minValue;
|
valueTotal = xAxis.runtimeMaxValue - xAxis.runtimeMinValue;
|
||||||
barHig = (xAxis.minValue > 0 ? value - xAxis.minValue : value)
|
barHig = (xAxis.runtimeMinValue > 0 ? value - xAxis.runtimeMinValue : value)
|
||||||
/ valueTotal * coordinateWidth;
|
/ valueTotal * coordinateWidth;
|
||||||
seriesHig[i] += barHig;
|
seriesHig[i] += barHig;
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
float value = showData[i].data[1];
|
float value = showData[i].data[1];
|
||||||
float pX = coordinateX + i * categoryWidth;
|
float pX = coordinateX + i * categoryWidth;
|
||||||
float zeroY = coordinateY + yAxis.zeroYOffset;
|
float zeroY = coordinateY + yAxis.runtimeZeroYOffset;
|
||||||
if (!xAxis.boundaryGap) pX -= categoryWidth / 2;
|
if (!xAxis.boundaryGap) pX -= categoryWidth / 2;
|
||||||
float pY = seriesHig[i] + zeroY + xAxis.axisLine.width;
|
float pY = seriesHig[i] + zeroY + xAxis.axisLine.width;
|
||||||
|
|
||||||
@@ -174,8 +174,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valueTotal = yAxis.maxValue - yAxis.minValue;
|
valueTotal = yAxis.runtimeMaxValue - yAxis.runtimeMinValue;
|
||||||
barHig = (yAxis.minValue > 0 ? value - yAxis.minValue : value)
|
barHig = (yAxis.runtimeMinValue > 0 ? value - yAxis.runtimeMinValue : value)
|
||||||
/ valueTotal * coordinateHeight;
|
/ valueTotal * coordinateHeight;
|
||||||
seriesHig[i] += barHig;
|
seriesHig[i] += barHig;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ namespace XCharts
|
|||||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||||
Input.mousePosition, canvas.worldCamera, out local))
|
Input.mousePosition, canvas.worldCamera, out local))
|
||||||
{
|
{
|
||||||
if (m_VisualMap.rtSelectedIndex >= 0)
|
if (m_VisualMap.runtimeSelectedIndex >= 0)
|
||||||
{
|
{
|
||||||
m_VisualMap.rtSelectedIndex = -1;
|
m_VisualMap.runtimeSelectedIndex = -1;
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -35,9 +35,9 @@ namespace XCharts
|
|||||||
local.y < 0 || local.y > chartHeight ||
|
local.y < 0 || local.y > chartHeight ||
|
||||||
!m_VisualMap.IsInRangeRect(local, chartWidth, chartHeight))
|
!m_VisualMap.IsInRangeRect(local, chartWidth, chartHeight))
|
||||||
{
|
{
|
||||||
if (m_VisualMap.rtSelectedIndex >= 0)
|
if (m_VisualMap.runtimeSelectedIndex >= 0)
|
||||||
{
|
{
|
||||||
m_VisualMap.rtSelectedIndex = -1;
|
m_VisualMap.runtimeSelectedIndex = -1;
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -63,8 +63,8 @@ namespace XCharts
|
|||||||
selectedIndex = m_VisualMap.GetIndex(value);
|
selectedIndex = m_VisualMap.GetIndex(value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_VisualMap.rtSelectedValue = value;
|
m_VisualMap.runtimeSelectedValue = value;
|
||||||
m_VisualMap.rtSelectedIndex = selectedIndex;
|
m_VisualMap.runtimeSelectedIndex = selectedIndex;
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,8 +161,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if(animationIndex>= 0 && i> animationIndex) continue;
|
if(animationIndex>= 0 && i> animationIndex) continue;
|
||||||
serieData.canShowLabel = true;
|
serieData.canShowLabel = true;
|
||||||
var emphasis = (m_Tooltip.show && i == (int)m_Tooltip.xValues[0] && j == (int)m_Tooltip.yValues[0])
|
var emphasis = (m_Tooltip.show && i == (int)m_Tooltip.runtimeXValues[0] && j == (int)m_Tooltip.runtimeYValues[0])
|
||||||
|| m_VisualMap.rtSelectedIndex > 0;
|
|| m_VisualMap.runtimeSelectedIndex > 0;
|
||||||
var rectWid = xWidth - 2 * borderWidth;
|
var rectWid = xWidth - 2 * borderWidth;
|
||||||
var rectHig = yWidth - 2 * borderWidth;
|
var rectHig = yWidth - 2 * borderWidth;
|
||||||
ChartDrawer.DrawPolygon(vh, pos, rectWid / 2, rectHig / 2, color);
|
ChartDrawer.DrawPolygon(vh, pos, rectWid / 2, rectHig / 2, color);
|
||||||
@@ -199,10 +199,10 @@ namespace XCharts
|
|||||||
var halfHig = m_VisualMap.itemHeight / 2;
|
var halfHig = m_VisualMap.itemHeight / 2;
|
||||||
var xRadius = 0f;
|
var xRadius = 0f;
|
||||||
var yRadius = 0f;
|
var yRadius = 0f;
|
||||||
var splitNum = m_VisualMap.rtInRange.Count;
|
var splitNum = m_VisualMap.runtimeInRange.Count;
|
||||||
var splitWid = m_VisualMap.itemHeight / (splitNum - 1);
|
var splitWid = m_VisualMap.itemHeight / (splitNum - 1);
|
||||||
var isVertical = false;
|
var isVertical = false;
|
||||||
var colors = m_VisualMap.rtInRange;
|
var colors = m_VisualMap.runtimeInRange;
|
||||||
var triangeLen = m_Settings.visualMapTriangeLen;
|
var triangeLen = m_Settings.visualMapTriangeLen;
|
||||||
switch (m_VisualMap.orient)
|
switch (m_VisualMap.orient)
|
||||||
{
|
{
|
||||||
@@ -215,13 +215,13 @@ namespace XCharts
|
|||||||
isVertical = false;
|
isVertical = false;
|
||||||
if (m_VisualMap.calculable)
|
if (m_VisualMap.calculable)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + Vector3.right * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + Vector3.right * m_VisualMap.runtimeRangeMinHeight;
|
||||||
var p1 = p0 + Vector3.up * halfWid;
|
var p1 = p0 + Vector3.up * halfWid;
|
||||||
var p2 = p0 + Vector3.up * (halfWid + triangeLen);
|
var p2 = p0 + Vector3.up * (halfWid + triangeLen);
|
||||||
var p3 = p2 + Vector3.left * triangeLen;
|
var p3 = p2 + Vector3.left * triangeLen;
|
||||||
var color = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
var color = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
||||||
ChartDrawer.DrawTriangle(vh, p1, p2, p3, color);
|
ChartDrawer.DrawTriangle(vh, p1, p2, p3, color);
|
||||||
p0 = pos1 + Vector3.right * m_VisualMap.rangeMaxHeight;
|
p0 = pos1 + Vector3.right * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
p1 = p0 + Vector3.up * halfWid;
|
p1 = p0 + Vector3.up * halfWid;
|
||||||
p2 = p0 + Vector3.up * (halfWid + triangeLen);
|
p2 = p0 + Vector3.up * (halfWid + triangeLen);
|
||||||
p3 = p2 + Vector3.right * triangeLen;
|
p3 = p2 + Vector3.right * triangeLen;
|
||||||
@@ -238,13 +238,13 @@ namespace XCharts
|
|||||||
isVertical = true;
|
isVertical = true;
|
||||||
if (m_VisualMap.calculable)
|
if (m_VisualMap.calculable)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + Vector3.up * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + Vector3.up * m_VisualMap.runtimeRangeMinHeight;
|
||||||
var p1 = p0 + Vector3.right * halfWid;
|
var p1 = p0 + Vector3.right * halfWid;
|
||||||
var p2 = p0 + Vector3.right * (halfWid + triangeLen);
|
var p2 = p0 + Vector3.right * (halfWid + triangeLen);
|
||||||
var p3 = p2 + Vector3.down * triangeLen;
|
var p3 = p2 + Vector3.down * triangeLen;
|
||||||
var color = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
var color = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
||||||
ChartDrawer.DrawTriangle(vh, p1, p2, p3, color);
|
ChartDrawer.DrawTriangle(vh, p1, p2, p3, color);
|
||||||
p0 = pos1 + Vector3.up * m_VisualMap.rangeMaxHeight;
|
p0 = pos1 + Vector3.up * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
p1 = p0 + Vector3.right * halfWid;
|
p1 = p0 + Vector3.right * halfWid;
|
||||||
p2 = p0 + Vector3.right * (halfWid + triangeLen);
|
p2 = p0 + Vector3.right * (halfWid + triangeLen);
|
||||||
p3 = p2 + Vector3.up * triangeLen;
|
p3 = p2 + Vector3.up * triangeLen;
|
||||||
@@ -276,7 +276,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (rangeMin > splitMin && rangeMax >= splitMax)
|
else if (rangeMin > splitMin && rangeMax >= splitMax)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + dir * m_VisualMap.runtimeRangeMinHeight;
|
||||||
var splitMaxPos = pos1 + dir * i * splitWid;
|
var splitMaxPos = pos1 + dir * i * splitWid;
|
||||||
var splitPos = p0 + (splitMaxPos - p0) / 2;
|
var splitPos = p0 + (splitMaxPos - p0) / 2;
|
||||||
var startColor = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
var startColor = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
||||||
@@ -289,7 +289,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else if (rangeMax < splitMax && rangeMin <= splitMin)
|
else if (rangeMax < splitMax && rangeMin <= splitMin)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
var p0 = pos1 + dir * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
var splitMinPos = pos1 + dir * (i - 1) * splitWid;
|
var splitMinPos = pos1 + dir * (i - 1) * splitWid;
|
||||||
var splitPos = splitMinPos + (p0 - splitMinPos) / 2;
|
var splitPos = splitMinPos + (p0 - splitMinPos) / 2;
|
||||||
var startColor = colors[i - 1];
|
var startColor = colors[i - 1];
|
||||||
@@ -302,8 +302,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + dir * m_VisualMap.runtimeRangeMinHeight;
|
||||||
var p1 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
var p1 = pos1 + dir * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
var splitPos = (p0 + p1) / 2;
|
var splitPos = (p0 + p1) / 2;
|
||||||
var startColor = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
var startColor = m_VisualMap.GetColor(m_VisualMap.rangeMin);
|
||||||
var toColor = m_VisualMap.GetColor(m_VisualMap.rangeMax);
|
var toColor = m_VisualMap.GetColor(m_VisualMap.rangeMax);
|
||||||
@@ -328,38 +328,38 @@ namespace XCharts
|
|||||||
|
|
||||||
if (m_VisualMap.rangeMin > m_VisualMap.min)
|
if (m_VisualMap.rangeMin > m_VisualMap.min)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + dir * m_VisualMap.runtimeRangeMinHeight;
|
||||||
ChartDrawer.DrawPolygon(vh, pos1, p0, m_VisualMap.itemWidth / 2, m_ThemeInfo.visualMapBackgroundColor);
|
ChartDrawer.DrawPolygon(vh, pos1, p0, m_VisualMap.itemWidth / 2, m_ThemeInfo.visualMapBackgroundColor);
|
||||||
}
|
}
|
||||||
if (m_VisualMap.rangeMax < m_VisualMap.max)
|
if (m_VisualMap.rangeMax < m_VisualMap.max)
|
||||||
{
|
{
|
||||||
var p1 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
var p1 = pos1 + dir * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
ChartDrawer.DrawPolygon(vh, p1, pos2, m_VisualMap.itemWidth / 2, m_ThemeInfo.visualMapBackgroundColor);
|
ChartDrawer.DrawPolygon(vh, p1, pos2, m_VisualMap.itemWidth / 2, m_ThemeInfo.visualMapBackgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_VisualMap.hoverLink)
|
if (m_VisualMap.hoverLink)
|
||||||
{
|
{
|
||||||
if (m_VisualMap.rtSelectedIndex >= 0)
|
if (m_VisualMap.runtimeSelectedIndex >= 0)
|
||||||
{
|
{
|
||||||
var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
var p0 = pos1 + dir * m_VisualMap.runtimeRangeMinHeight;
|
||||||
var p1 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
var p1 = pos1 + dir * m_VisualMap.runtimeRangeMaxHeight;
|
||||||
|
|
||||||
if (m_VisualMap.orient == Orient.Vertical)
|
if (m_VisualMap.orient == Orient.Vertical)
|
||||||
{
|
{
|
||||||
var p2 = new Vector3(centerPos.x + halfWid, Mathf.Clamp(pointerPos.y + (triangeLen / 2), p0.y, p1.y));
|
var p2 = new Vector3(centerPos.x + halfWid, Mathf.Clamp(pointerPos.y + (triangeLen / 2), p0.y, p1.y));
|
||||||
var p3 = new Vector3(centerPos.x + halfWid, Mathf.Clamp(pointerPos.y - (triangeLen / 2), p0.y, p1.y));
|
var p3 = new Vector3(centerPos.x + halfWid, Mathf.Clamp(pointerPos.y - (triangeLen / 2), p0.y, p1.y));
|
||||||
var p4 = new Vector3(centerPos.x + halfWid + triangeLen / 2, pointerPos.y);
|
var p4 = new Vector3(centerPos.x + halfWid + triangeLen / 2, pointerPos.y);
|
||||||
ChartDrawer.DrawTriangle(vh, p2, p3, p4, colors[m_VisualMap.rtSelectedIndex]);
|
ChartDrawer.DrawTriangle(vh, p2, p3, p4, colors[m_VisualMap.runtimeSelectedIndex]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var p2 = new Vector3(Mathf.Clamp(pointerPos.x + (triangeLen / 2), p0.x, p1.x), centerPos.y + halfWid);
|
var p2 = new Vector3(Mathf.Clamp(pointerPos.x + (triangeLen / 2), p0.x, p1.x), centerPos.y + halfWid);
|
||||||
var p3 = new Vector3(Mathf.Clamp(pointerPos.x - (triangeLen / 2), p0.x, p1.x), centerPos.y + halfWid);
|
var p3 = new Vector3(Mathf.Clamp(pointerPos.x - (triangeLen / 2), p0.x, p1.x), centerPos.y + halfWid);
|
||||||
var p4 = new Vector3(pointerPos.x, centerPos.y + halfWid + triangeLen / 2);
|
var p4 = new Vector3(pointerPos.x, centerPos.y + halfWid + triangeLen / 2);
|
||||||
ChartDrawer.DrawTriangle(vh, p2, p3, p4, colors[m_VisualMap.rtSelectedIndex]);
|
ChartDrawer.DrawTriangle(vh, p2, p3, p4, colors[m_VisualMap.runtimeSelectedIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_Tooltip.show && m_Tooltip.xValues[0] >= 0 && m_Tooltip.yValues[0] >= 0)
|
else if (m_Tooltip.show && m_Tooltip.runtimeXValues[0] >= 0 && m_Tooltip.runtimeYValues[0] >= 0)
|
||||||
{
|
{
|
||||||
// var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
// var p0 = pos1 + dir * m_VisualMap.rangeMinHeight;
|
||||||
// var p1 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
// var p1 = pos1 + dir * m_VisualMap.rangeMaxHeight;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace XCharts
|
|||||||
Vector3 lp = Vector3.zero, np = Vector3.zero, llp = Vector3.zero, nnp = Vector3.zero;
|
Vector3 lp = Vector3.zero, np = Vector3.zero, llp = Vector3.zero, nnp = Vector3.zero;
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
var zeroPos = new Vector3(coordinateX, coordinateY + yAxis.zeroYOffset);
|
var zeroPos = new Vector3(coordinateX, coordinateY + yAxis.runtimeZeroYOffset);
|
||||||
var isStack = m_Series.IsStack(serie.stack, SerieType.Line);
|
var isStack = m_Series.IsStack(serie.stack, SerieType.Line);
|
||||||
if (!xAxis.show) xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
|
if (!xAxis.show) xAxis = m_XAxises[(serie.axisIndex + 1) % m_XAxises.Count];
|
||||||
float scaleWid = xAxis.GetDataWidth(coordinateWidth, showData.Count, m_DataZoom);
|
float scaleWid = xAxis.GetDataWidth(coordinateWidth, showData.Count, m_DataZoom);
|
||||||
@@ -168,7 +168,7 @@ namespace XCharts
|
|||||||
serie.ClearSmoothList(i);
|
serie.ClearSmoothList(i);
|
||||||
if (!serie.animation.NeedAnimation(i)) break;
|
if (!serie.animation.NeedAnimation(i)) break;
|
||||||
bool isFinish = true;
|
bool isFinish = true;
|
||||||
if (serie.areaStyle.tooltipHighlight && m_Tooltip.show && i <= m_Tooltip.dataIndex[0])
|
if (serie.areaStyle.tooltipHighlight && m_Tooltip.show && i <= m_Tooltip.runtimeDataIndex[0])
|
||||||
{
|
{
|
||||||
areaColor = highlightAreaColor;
|
areaColor = highlightAreaColor;
|
||||||
areaToColor = highlightAreaToColor;
|
areaToColor = highlightAreaToColor;
|
||||||
@@ -294,18 +294,18 @@ namespace XCharts
|
|||||||
float xValue = i > showData.Count - 1 ? 0 : showData[i].data[0];
|
float xValue = i > showData.Count - 1 ? 0 : showData[i].data[0];
|
||||||
float pX = coordinateX + xAxis.axisLine.width;
|
float pX = coordinateX + xAxis.axisLine.width;
|
||||||
float pY = serieHig + coordinateY + xAxis.axisLine.width;
|
float pY = serieHig + coordinateY + xAxis.axisLine.width;
|
||||||
if ((xAxis.maxValue - xAxis.minValue) <= 0) xDataHig = 0;
|
if ((xAxis.runtimeMaxValue - xAxis.runtimeMinValue) <= 0) xDataHig = 0;
|
||||||
else xDataHig = (xValue - xAxis.minValue) / (xAxis.maxValue - xAxis.minValue) * coordinateWidth;
|
else xDataHig = (xValue - xAxis.runtimeMinValue) / (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) * coordinateWidth;
|
||||||
if ((yAxis.maxValue - yAxis.minValue) <= 0) yDataHig = 0;
|
if ((yAxis.runtimeMaxValue - yAxis.runtimeMinValue) <= 0) yDataHig = 0;
|
||||||
else yDataHig = (yValue - yAxis.minValue) / (yAxis.maxValue - yAxis.minValue) * coordinateHeight;
|
else yDataHig = (yValue - yAxis.runtimeMinValue) / (yAxis.runtimeMaxValue - yAxis.runtimeMinValue) * coordinateHeight;
|
||||||
np = new Vector3(pX + xDataHig, pY + yDataHig);
|
np = new Vector3(pX + xDataHig, pY + yDataHig);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float pX = startX + i * scaleWid;
|
float pX = startX + i * scaleWid;
|
||||||
float pY = serieHig + coordinateY + yAxis.axisLine.width;
|
float pY = serieHig + coordinateY + yAxis.axisLine.width;
|
||||||
if ((yAxis.maxValue - yAxis.minValue) <= 0) yDataHig = 0;
|
if ((yAxis.runtimeMaxValue - yAxis.runtimeMinValue) <= 0) yDataHig = 0;
|
||||||
else yDataHig = (yValue - yAxis.minValue) / (yAxis.maxValue - yAxis.minValue) * coordinateHeight;
|
else yDataHig = (yValue - yAxis.runtimeMinValue) / (yAxis.runtimeMaxValue - yAxis.runtimeMinValue) * coordinateHeight;
|
||||||
np = new Vector3(pX, pY + yDataHig);
|
np = new Vector3(pX, pY + yDataHig);
|
||||||
}
|
}
|
||||||
return yDataHig;
|
return yDataHig;
|
||||||
@@ -327,7 +327,7 @@ namespace XCharts
|
|||||||
Color areaColor, areaToColor;
|
Color areaColor, areaToColor;
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
var zeroPos = new Vector3(coordinateX + xAxis.zeroXOffset, coordinateY);
|
var zeroPos = new Vector3(coordinateX + xAxis.runtimeZeroXOffset, coordinateY);
|
||||||
var isStack = m_Series.IsStack(serie.stack, SerieType.Line);
|
var isStack = m_Series.IsStack(serie.stack, SerieType.Line);
|
||||||
if (!yAxis.show) yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
|
if (!yAxis.show) yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
|
||||||
float scaleWid = yAxis.GetDataWidth(coordinateHeight, showData.Count, m_DataZoom);
|
float scaleWid = yAxis.GetDataWidth(coordinateHeight, showData.Count, m_DataZoom);
|
||||||
@@ -356,7 +356,7 @@ namespace XCharts
|
|||||||
float value = showData[i].data[1];
|
float value = showData[i].data[1];
|
||||||
float pY = startY + i * scaleWid;
|
float pY = startY + i * scaleWid;
|
||||||
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
||||||
float dataHig = (value - xAxis.minValue) / (xAxis.maxValue - xAxis.minValue) * coordinateWidth;
|
float dataHig = (value - xAxis.runtimeMinValue) / (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) * coordinateWidth;
|
||||||
np = new Vector3(pX + dataHig, pY);
|
np = new Vector3(pX + dataHig, pY);
|
||||||
serie.dataPoints.Add(np);
|
serie.dataPoints.Add(np);
|
||||||
seriesHig[i] += dataHig;
|
seriesHig[i] += dataHig;
|
||||||
@@ -368,7 +368,7 @@ namespace XCharts
|
|||||||
float value = showData[i].data[1];
|
float value = showData[i].data[1];
|
||||||
float pY = startY + i * scaleWid;
|
float pY = startY + i * scaleWid;
|
||||||
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
||||||
float dataHig = (value - xAxis.minValue) / (xAxis.maxValue - xAxis.minValue) * coordinateWidth;
|
float dataHig = (value - xAxis.runtimeMinValue) / (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) * coordinateWidth;
|
||||||
np = new Vector3(pX + dataHig, pY);
|
np = new Vector3(pX + dataHig, pY);
|
||||||
serie.dataPoints.Add(np);
|
serie.dataPoints.Add(np);
|
||||||
seriesHig[i] += dataHig;
|
seriesHig[i] += dataHig;
|
||||||
@@ -384,7 +384,7 @@ namespace XCharts
|
|||||||
serie.ClearSmoothList(i);
|
serie.ClearSmoothList(i);
|
||||||
if (!serie.animation.NeedAnimation(i)) break;
|
if (!serie.animation.NeedAnimation(i)) break;
|
||||||
bool isFinish = true;
|
bool isFinish = true;
|
||||||
if (serie.areaStyle.tooltipHighlight && m_Tooltip.show && i < m_Tooltip.dataIndex[0])
|
if (serie.areaStyle.tooltipHighlight && m_Tooltip.show && i < m_Tooltip.runtimeDataIndex[0])
|
||||||
{
|
{
|
||||||
areaColor = highlightAreaColor;
|
areaColor = highlightAreaColor;
|
||||||
areaToColor = highlightAreaToColor;
|
areaToColor = highlightAreaToColor;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ namespace XCharts
|
|||||||
float yValue = serieData.data[1];
|
float yValue = serieData.data[1];
|
||||||
float pX = coordinateX + xAxis.axisLine.width;
|
float pX = coordinateX + xAxis.axisLine.width;
|
||||||
float pY = coordinateY + yAxis.axisLine.width;
|
float pY = coordinateY + yAxis.axisLine.width;
|
||||||
float xDataHig = (xValue - xAxis.minValue) / (xAxis.maxValue - xAxis.minValue) * coordinateWidth;
|
float xDataHig = (xValue - xAxis.runtimeMinValue) / (xAxis.runtimeMaxValue - xAxis.runtimeMinValue) * coordinateWidth;
|
||||||
float yDataHig = (yValue - yAxis.minValue) / (yAxis.maxValue - yAxis.minValue) * coordinateHeight;
|
float yDataHig = (yValue - yAxis.runtimeMinValue) / (yAxis.runtimeMaxValue - yAxis.runtimeMinValue) * coordinateHeight;
|
||||||
var pos = new Vector3(pX + xDataHig, pY + yDataHig);
|
var pos = new Vector3(pX + xDataHig, pY + yDataHig);
|
||||||
|
|
||||||
var datas = serie.data[n].data;
|
var datas = serie.data[n].data;
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/******************************************/
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) 2018 monitor1394 */
|
|
||||||
/* https://github.com/monitor1394 */
|
|
||||||
/* */
|
|
||||||
/******************************************/
|
|
||||||
|
|
||||||
using UnityEngine;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace XCharts
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 支持从json格式的字符串中导入数据
|
|
||||||
/// </summary>
|
|
||||||
public class JsonDataSupport : IJsonData, ISerializationCallbackReceiver
|
|
||||||
{
|
|
||||||
[SerializeField] protected string m_JsonData;
|
|
||||||
[SerializeField] protected bool m_DataFromJson;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// json格式的字符串数据
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
|
||||||
|
|
||||||
public void OnAfterDeserialize()
|
|
||||||
{
|
|
||||||
if (m_DataFromJson)
|
|
||||||
{
|
|
||||||
ParseJsonData(m_JsonData);
|
|
||||||
m_DataFromJson = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnBeforeSerialize()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void ParseJsonData(string json)
|
|
||||||
{
|
|
||||||
throw new Exception("no support yet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 73e326ed8a76f90408bfa9feb1797433
|
|
||||||
timeCreated: 1555379601
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -11,7 +11,7 @@ using UnityEngine.Events;
|
|||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
public class ObjectPool<T> where T : new()
|
internal class ObjectPool<T> where T : new()
|
||||||
{
|
{
|
||||||
private readonly Stack<T> m_Stack = new Stack<T>();
|
private readonly Stack<T> m_Stack = new Stack<T>();
|
||||||
private readonly UnityAction<T> m_ActionOnGet;
|
private readonly UnityAction<T> m_ActionOnGet;
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
bool isFinish = true;
|
bool isFinish = true;
|
||||||
if (serie.pieClickOffset) isClickOffset = true;
|
if (serie.pieClickOffset) isClickOffset = true;
|
||||||
serie.pieDataMax = serie.yMax;
|
serie.runtimePieDataMax = serie.yMax;
|
||||||
serie.pieDataTotal = serie.yTotal;
|
serie.runtimePieDataTotal = serie.yTotal;
|
||||||
UpdatePieCenter(serie);
|
UpdatePieCenter(serie);
|
||||||
|
|
||||||
float totalDegree = 360;
|
float totalDegree = 360;
|
||||||
@@ -85,73 +85,73 @@ namespace XCharts
|
|||||||
float value = serieData.data[1];
|
float value = serieData.data[1];
|
||||||
serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
|
serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
||||||
serieData.pieStartAngle = startDegree;
|
serieData.runtimePieStartAngle = startDegree;
|
||||||
serieData.pieToAngle = startDegree;
|
serieData.runtimePieToAngle = startDegree;
|
||||||
serieData.pieHalfAngle = startDegree;
|
serieData.runtimePieHalfAngle = startDegree;
|
||||||
serieData.pieCurrAngle = startDegree;
|
serieData.runtimePieCurrAngle = startDegree;
|
||||||
if (!serieData.show)
|
if (!serieData.show)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
float degree = serie.pieRoseType == RoseType.Area ?
|
float degree = serie.pieRoseType == RoseType.Area ?
|
||||||
(totalDegree / showdataCount) : (totalDegree * value / serie.pieDataTotal);
|
(totalDegree / showdataCount) : (totalDegree * value / serie.runtimePieDataTotal);
|
||||||
serieData.pieToAngle = startDegree + degree;
|
serieData.runtimePieToAngle = startDegree + degree;
|
||||||
|
|
||||||
serieData.pieOutsideRadius = serie.pieRoseType > 0 ?
|
serieData.runtimePieOutsideRadius = serie.pieRoseType > 0 ?
|
||||||
serie.pieInsideRadius + (serie.pieOutsideRadius - serie.pieInsideRadius) * value / serie.pieDataMax :
|
serie.runtimePieInsideRadius + (serie.runtimePieOutsideRadius - serie.runtimePieInsideRadius) * value / serie.runtimePieDataMax :
|
||||||
serie.pieOutsideRadius;
|
serie.runtimePieOutsideRadius;
|
||||||
if (serieData.highlighted)
|
if (serieData.highlighted)
|
||||||
{
|
{
|
||||||
isDataHighlight = true;
|
isDataHighlight = true;
|
||||||
color *= 1.2f;
|
color *= 1.2f;
|
||||||
serieData.pieOutsideRadius += m_Settings.pieTooltipExtraRadius;
|
serieData.runtimePieOutsideRadius += m_Settings.pieTooltipExtraRadius;
|
||||||
}
|
}
|
||||||
var offset = serie.pieSpace;
|
var offset = serie.pieSpace;
|
||||||
if (serie.pieClickOffset && serieData.selected)
|
if (serie.pieClickOffset && serieData.selected)
|
||||||
{
|
{
|
||||||
offset += m_Settings.pieSelectedOffset;
|
offset += m_Settings.pieSelectedOffset;
|
||||||
}
|
}
|
||||||
var halfDegree = (serieData.pieToAngle - startDegree) / 2;
|
var halfDegree = (serieData.runtimePieToAngle - startDegree) / 2;
|
||||||
serieData.pieHalfAngle = startDegree + halfDegree;
|
serieData.runtimePieHalfAngle = startDegree + halfDegree;
|
||||||
float currRad = serieData.pieHalfAngle * Mathf.Deg2Rad;
|
float currRad = serieData.runtimePieHalfAngle * Mathf.Deg2Rad;
|
||||||
float currSin = Mathf.Sin(currRad);
|
float currSin = Mathf.Sin(currRad);
|
||||||
float currCos = Mathf.Cos(currRad);
|
float currCos = Mathf.Cos(currRad);
|
||||||
var center = serie.pieCenterPos;
|
var center = serie.runtimePieCenterPos;
|
||||||
|
|
||||||
serieData.pieCurrAngle = serieData.pieToAngle;
|
serieData.runtimePieCurrAngle = serieData.runtimePieToAngle;
|
||||||
serieData.pieOffsetCenter = center;
|
serieData.runtiemPieOffsetCenter = center;
|
||||||
serieData.pieInsideRadius = serie.pieInsideRadius;
|
serieData.runtimePieInsideRadius = serie.runtimePieInsideRadius;
|
||||||
if (serie.animation.CheckDetailBreak(n, serieData.pieToAngle))
|
if (serie.animation.CheckDetailBreak(n, serieData.runtimePieToAngle))
|
||||||
{
|
{
|
||||||
isFinish = false;
|
isFinish = false;
|
||||||
serieData.pieCurrAngle = serie.animation.GetCurrDetail();
|
serieData.runtimePieCurrAngle = serie.animation.GetCurrDetail();
|
||||||
}
|
}
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
serieData.pieOffsetRadius = serie.pieSpace / Mathf.Sin(halfDegree * Mathf.Deg2Rad);
|
serieData.runtimePieOffsetRadius = serie.pieSpace / Mathf.Sin(halfDegree * Mathf.Deg2Rad);
|
||||||
serieData.pieInsideRadius -= serieData.pieOffsetRadius;
|
serieData.runtimePieInsideRadius -= serieData.runtimePieOffsetRadius;
|
||||||
serieData.pieOutsideRadius -= serieData.pieOffsetRadius;
|
serieData.runtimePieOutsideRadius -= serieData.runtimePieOffsetRadius;
|
||||||
if (serie.pieClickOffset && serieData.selected)
|
if (serie.pieClickOffset && serieData.selected)
|
||||||
{
|
{
|
||||||
serieData.pieOffsetRadius += m_Settings.pieSelectedOffset;
|
serieData.runtimePieOffsetRadius += m_Settings.pieSelectedOffset;
|
||||||
if (serieData.pieInsideRadius > 0) serieData.pieInsideRadius += m_Settings.pieSelectedOffset;
|
if (serieData.runtimePieInsideRadius > 0) serieData.runtimePieInsideRadius += m_Settings.pieSelectedOffset;
|
||||||
serieData.pieOutsideRadius += m_Settings.pieSelectedOffset;
|
serieData.runtimePieOutsideRadius += m_Settings.pieSelectedOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
serieData.pieOffsetCenter = new Vector3(center.x + serieData.pieOffsetRadius * currSin,
|
serieData.runtiemPieOffsetCenter = new Vector3(center.x + serieData.runtimePieOffsetRadius * currSin,
|
||||||
center.y + serieData.pieOffsetRadius * currCos);
|
center.y + serieData.runtimePieOffsetRadius * currCos);
|
||||||
|
|
||||||
ChartDrawer.DrawDoughnut(vh, serieData.pieOffsetCenter, serieData.pieInsideRadius, serieData.pieOutsideRadius,
|
ChartDrawer.DrawDoughnut(vh, serieData.runtiemPieOffsetCenter, serieData.runtimePieInsideRadius, serieData.runtimePieOutsideRadius,
|
||||||
color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, startDegree, serieData.pieCurrAngle);
|
color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, startDegree, serieData.runtimePieCurrAngle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChartDrawer.DrawDoughnut(vh, center, serieData.pieInsideRadius, serieData.pieOutsideRadius,
|
ChartDrawer.DrawDoughnut(vh, center, serieData.runtimePieInsideRadius, serieData.runtimePieOutsideRadius,
|
||||||
color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, startDegree, serieData.pieCurrAngle);
|
color, m_ThemeInfo.backgroundColor, m_Settings.cicleSmoothness, startDegree, serieData.runtimePieCurrAngle);
|
||||||
}
|
}
|
||||||
serieData.canShowLabel = serieData.pieCurrAngle >= serieData.pieHalfAngle;
|
serieData.canShowLabel = serieData.runtimePieCurrAngle >= serieData.runtimePieHalfAngle;
|
||||||
isDrawPie = true;
|
isDrawPie = true;
|
||||||
startDegree = serieData.pieToAngle;
|
startDegree = serieData.runtimePieToAngle;
|
||||||
if (isFinish) serie.animation.SetDataFinish(n);
|
if (isFinish) serie.animation.SetDataFinish(n);
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
@@ -213,17 +213,17 @@ namespace XCharts
|
|||||||
&& serie.label.position == SerieLabel.Position.Outside
|
&& serie.label.position == SerieLabel.Position.Outside
|
||||||
&& serie.label.line)
|
&& serie.label.line)
|
||||||
{
|
{
|
||||||
var insideRadius = serieData.pieInsideRadius;
|
var insideRadius = serieData.runtimePieInsideRadius;
|
||||||
var outSideRadius = serieData.pieOutsideRadius;
|
var outSideRadius = serieData.runtimePieOutsideRadius;
|
||||||
var center = serie.pieCenterPos;
|
var center = serie.runtimePieCenterPos;
|
||||||
var currAngle = serieData.pieHalfAngle;
|
var currAngle = serieData.runtimePieHalfAngle;
|
||||||
if (serie.label.lineColor != Color.clear) color = serie.label.lineColor;
|
if (serie.label.lineColor != Color.clear) color = serie.label.lineColor;
|
||||||
else if (serie.label.lineType == SerieLabel.LineType.HorizontalLine) color *= color;
|
else if (serie.label.lineType == SerieLabel.LineType.HorizontalLine) color *= color;
|
||||||
float currSin = Mathf.Sin(currAngle * Mathf.Deg2Rad);
|
float currSin = Mathf.Sin(currAngle * Mathf.Deg2Rad);
|
||||||
float currCos = Mathf.Cos(currAngle * Mathf.Deg2Rad);
|
float currCos = Mathf.Cos(currAngle * Mathf.Deg2Rad);
|
||||||
var radius1 = serie.label.lineType == SerieLabel.LineType.HorizontalLine ?
|
var radius1 = serie.label.lineType == SerieLabel.LineType.HorizontalLine ?
|
||||||
serie.pieOutsideRadius : outSideRadius;
|
serie.runtimePieOutsideRadius : outSideRadius;
|
||||||
var radius2 = serie.pieOutsideRadius + serie.label.lineLength1;
|
var radius2 = serie.runtimePieOutsideRadius + serie.label.lineLength1;
|
||||||
var radius3 = insideRadius + (outSideRadius - insideRadius) / 2;
|
var radius3 = insideRadius + (outSideRadius - insideRadius) / 2;
|
||||||
var pos0 = new Vector3(center.x + radius3 * currSin, center.y + radius3 * currCos);
|
var pos0 = new Vector3(center.x + radius3 * currSin, center.y + radius3 * currCos);
|
||||||
var pos1 = new Vector3(center.x + radius1 * currSin, center.y + radius1 * currCos);
|
var pos1 = new Vector3(center.x + radius1 * currSin, center.y + radius1 * currCos);
|
||||||
@@ -332,7 +332,7 @@ namespace XCharts
|
|||||||
private void DrawLabel(Serie serie, int dataIndex, SerieData serieData, Color serieColor)
|
private void DrawLabel(Serie serie, int dataIndex, SerieData serieData, Color serieColor)
|
||||||
{
|
{
|
||||||
if (serieData.labelText == null) return;
|
if (serieData.labelText == null) return;
|
||||||
var currAngle = serieData.pieHalfAngle;
|
var currAngle = serieData.runtimePieHalfAngle;
|
||||||
var isHighlight = (serieData.highlighted && serie.emphasis.label.show);
|
var isHighlight = (serieData.highlighted && serie.emphasis.label.show);
|
||||||
var showLabel = ((serie.label.show || isHighlight) && serieData.canShowLabel);
|
var showLabel = ((serie.label.show || isHighlight) && serieData.canShowLabel);
|
||||||
if (showLabel || serieData.showIcon)
|
if (showLabel || serieData.showIcon)
|
||||||
@@ -387,30 +387,30 @@ namespace XCharts
|
|||||||
|
|
||||||
protected void UpdateLabelPostion(Serie serie, SerieData serieData)
|
protected void UpdateLabelPostion(Serie serie, SerieData serieData)
|
||||||
{
|
{
|
||||||
var currAngle = serieData.pieHalfAngle;
|
var currAngle = serieData.runtimePieHalfAngle;
|
||||||
var currRad = currAngle * Mathf.Deg2Rad;
|
var currRad = currAngle * Mathf.Deg2Rad;
|
||||||
var offsetRadius = serieData.pieOffsetRadius;
|
var offsetRadius = serieData.runtimePieOffsetRadius;
|
||||||
var insideRadius = serieData.pieInsideRadius;
|
var insideRadius = serieData.runtimePieInsideRadius;
|
||||||
var outsideRadius = serieData.pieOutsideRadius;
|
var outsideRadius = serieData.runtimePieOutsideRadius;
|
||||||
switch (serie.label.position)
|
switch (serie.label.position)
|
||||||
{
|
{
|
||||||
case SerieLabel.Position.Center:
|
case SerieLabel.Position.Center:
|
||||||
serieData.labelPosition = serie.pieCenterPos;
|
serieData.labelPosition = serie.runtimePieCenterPos;
|
||||||
break;
|
break;
|
||||||
case SerieLabel.Position.Inside:
|
case SerieLabel.Position.Inside:
|
||||||
var labelRadius = offsetRadius + insideRadius + (outsideRadius - insideRadius) / 2;
|
var labelRadius = offsetRadius + insideRadius + (outsideRadius - insideRadius) / 2;
|
||||||
var labelCenter = new Vector2(serie.pieCenterPos.x + labelRadius * Mathf.Sin(currRad),
|
var labelCenter = new Vector2(serie.runtimePieCenterPos.x + labelRadius * Mathf.Sin(currRad),
|
||||||
serie.pieCenterPos.y + labelRadius * Mathf.Cos(currRad));
|
serie.runtimePieCenterPos.y + labelRadius * Mathf.Cos(currRad));
|
||||||
serieData.labelPosition = labelCenter;
|
serieData.labelPosition = labelCenter;
|
||||||
break;
|
break;
|
||||||
case SerieLabel.Position.Outside:
|
case SerieLabel.Position.Outside:
|
||||||
if (serie.label.lineType == SerieLabel.LineType.HorizontalLine)
|
if (serie.label.lineType == SerieLabel.LineType.HorizontalLine)
|
||||||
{
|
{
|
||||||
var radius1 = serie.pieOutsideRadius;
|
var radius1 = serie.runtimePieOutsideRadius;
|
||||||
var radius3 = insideRadius + (outsideRadius - insideRadius) / 2;
|
var radius3 = insideRadius + (outsideRadius - insideRadius) / 2;
|
||||||
var currSin = Mathf.Sin(currRad);
|
var currSin = Mathf.Sin(currRad);
|
||||||
var currCos = Mathf.Cos(currRad);
|
var currCos = Mathf.Cos(currRad);
|
||||||
var pos0 = new Vector3(serie.pieCenterPos.x + radius3 * currSin, serie.pieCenterPos.y + radius3 * currCos);
|
var pos0 = new Vector3(serie.runtimePieCenterPos.x + radius3 * currSin, serie.runtimePieCenterPos.y + radius3 * currCos);
|
||||||
if (currAngle > 180)
|
if (currAngle > 180)
|
||||||
{
|
{
|
||||||
currSin = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad);
|
currSin = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad);
|
||||||
@@ -423,9 +423,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelRadius = serie.pieOutsideRadius + serie.label.lineLength1;
|
labelRadius = serie.runtimePieOutsideRadius + serie.label.lineLength1;
|
||||||
labelCenter = new Vector2(serie.pieCenterPos.x + labelRadius * Mathf.Sin(currRad),
|
labelCenter = new Vector2(serie.runtimePieCenterPos.x + labelRadius * Mathf.Sin(currRad),
|
||||||
serie.pieCenterPos.y + labelRadius * Mathf.Cos(currRad));
|
serie.runtimePieCenterPos.y + labelRadius * Mathf.Cos(currRad));
|
||||||
float labelWidth = serieData.labelText.preferredWidth;
|
float labelWidth = serieData.labelText.preferredWidth;
|
||||||
if (currAngle > 180)
|
if (currAngle > 180)
|
||||||
{
|
{
|
||||||
@@ -467,21 +467,21 @@ namespace XCharts
|
|||||||
if (serie.pieCenter.Length < 2) return;
|
if (serie.pieCenter.Length < 2) return;
|
||||||
var centerX = serie.pieCenter[0] <= 1 ? chartWidth * serie.pieCenter[0] : serie.pieCenter[0];
|
var centerX = serie.pieCenter[0] <= 1 ? chartWidth * serie.pieCenter[0] : serie.pieCenter[0];
|
||||||
var centerY = serie.pieCenter[1] <= 1 ? chartHeight * serie.pieCenter[1] : serie.pieCenter[1];
|
var centerY = serie.pieCenter[1] <= 1 ? chartHeight * serie.pieCenter[1] : serie.pieCenter[1];
|
||||||
serie.pieCenterPos = new Vector2(centerX, centerY);
|
serie.runtimePieCenterPos = new Vector2(centerX, centerY);
|
||||||
var minWidth = Mathf.Min(chartWidth, chartHeight);
|
var minWidth = Mathf.Min(chartWidth, chartHeight);
|
||||||
serie.pieInsideRadius = serie.pieRadius[0] <= 1 ? minWidth * serie.pieRadius[0] : serie.pieRadius[0];
|
serie.runtimePieInsideRadius = serie.pieRadius[0] <= 1 ? minWidth * serie.pieRadius[0] : serie.pieRadius[0];
|
||||||
serie.pieOutsideRadius = serie.pieRadius[1] <= 1 ? minWidth * serie.pieRadius[1] : serie.pieRadius[1];
|
serie.runtimePieOutsideRadius = serie.pieRadius[1] <= 1 ? minWidth * serie.pieRadius[1] : serie.pieRadius[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckTootipArea(Vector2 local)
|
protected override void CheckTootipArea(Vector2 local)
|
||||||
{
|
{
|
||||||
if (m_IsEnterLegendButtom) return;
|
if (m_IsEnterLegendButtom) return;
|
||||||
m_Tooltip.dataIndex.Clear();
|
m_Tooltip.runtimeDataIndex.Clear();
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
foreach (var serie in m_Series.list)
|
foreach (var serie in m_Series.list)
|
||||||
{
|
{
|
||||||
int index = GetPosPieIndex(serie, local);
|
int index = GetPosPieIndex(serie, local);
|
||||||
m_Tooltip.dataIndex.Add(index);
|
m_Tooltip.runtimeDataIndex.Add(index);
|
||||||
if (serie.type != SerieType.Pie) continue;
|
if (serie.type != SerieType.Pie) continue;
|
||||||
bool refresh = false;
|
bool refresh = false;
|
||||||
for (int j = 0; j < serie.data.Count; j++)
|
for (int j = 0; j < serie.data.Count; j++)
|
||||||
@@ -508,14 +508,14 @@ namespace XCharts
|
|||||||
private int GetPosPieIndex(Serie serie, Vector2 local)
|
private int GetPosPieIndex(Serie serie, Vector2 local)
|
||||||
{
|
{
|
||||||
if (serie.type != SerieType.Pie) return -1;
|
if (serie.type != SerieType.Pie) return -1;
|
||||||
var dist = Vector2.Distance(local, serie.pieCenterPos);
|
var dist = Vector2.Distance(local, serie.runtimePieCenterPos);
|
||||||
if (dist < serie.pieInsideRadius || dist > serie.pieOutsideRadius) return -1;
|
if (dist < serie.runtimePieInsideRadius || dist > serie.runtimePieOutsideRadius) return -1;
|
||||||
Vector2 dir = local - new Vector2(serie.pieCenterPos.x, serie.pieCenterPos.y);
|
Vector2 dir = local - new Vector2(serie.runtimePieCenterPos.x, serie.runtimePieCenterPos.y);
|
||||||
float angle = VectorAngle(Vector2.up, dir);
|
float angle = VectorAngle(Vector2.up, dir);
|
||||||
for (int i = 0; i < serie.data.Count; i++)
|
for (int i = 0; i < serie.data.Count; i++)
|
||||||
{
|
{
|
||||||
var serieData = serie.data[i];
|
var serieData = serie.data[i];
|
||||||
if (angle >= serieData.pieStartAngle && angle <= serieData.pieToAngle)
|
if (angle >= serieData.runtimePieStartAngle && angle <= serieData.runtimePieToAngle)
|
||||||
{
|
{
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ namespace XCharts
|
|||||||
bool showTooltip = false;
|
bool showTooltip = false;
|
||||||
foreach (var serie in m_Series.list)
|
foreach (var serie in m_Series.list)
|
||||||
{
|
{
|
||||||
int index = m_Tooltip.dataIndex[serie.index];
|
int index = m_Tooltip.runtimeDataIndex[serie.index];
|
||||||
if (index < 0) continue;
|
if (index < 0) continue;
|
||||||
showTooltip = true;
|
showTooltip = true;
|
||||||
if (string.IsNullOrEmpty(tooltip.formatter))
|
if (string.IsNullOrEmpty(tooltip.formatter))
|
||||||
@@ -565,13 +565,13 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
if (pos.x + m_Tooltip.width > chartWidth)
|
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
||||||
{
|
{
|
||||||
pos.x = chartWidth - m_Tooltip.width;
|
pos.x = chartWidth - m_Tooltip.runtimeWidth;
|
||||||
}
|
}
|
||||||
if (pos.y - m_Tooltip.height < 0)
|
if (pos.y - m_Tooltip.runtimeHeight < 0)
|
||||||
{
|
{
|
||||||
pos.y = m_Tooltip.height;
|
pos.y = m_Tooltip.runtimeHeight;
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(pos);
|
m_Tooltip.UpdateContentPos(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace XCharts
|
|||||||
var indicator = radar.indicatorList[i];
|
var indicator = radar.indicatorList[i];
|
||||||
var pos = radar.GetIndicatorPosition(i);
|
var pos = radar.GetIndicatorPosition(i);
|
||||||
TextAnchor anchor = TextAnchor.MiddleCenter;
|
TextAnchor anchor = TextAnchor.MiddleCenter;
|
||||||
var diff = pos.x - radar.centerPos.x;
|
var diff = pos.x - radar.runtimeCenterPos.x;
|
||||||
if (diff < -1f)
|
if (diff < -1f)
|
||||||
{
|
{
|
||||||
pos = new Vector3(pos.x - 5, pos.y);
|
pos = new Vector3(pos.x - 5, pos.y);
|
||||||
@@ -124,7 +124,7 @@ namespace XCharts
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
anchor = TextAnchor.MiddleCenter;
|
anchor = TextAnchor.MiddleCenter;
|
||||||
float y = pos.y > radar.centerPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
|
float y = pos.y > radar.runtimeCenterPos.y ? pos.y + txtHig / 2 : pos.y - txtHig / 2;
|
||||||
pos = new Vector3(pos.x + txtWid / 2, y);
|
pos = new Vector3(pos.x + txtWid / 2, y);
|
||||||
}
|
}
|
||||||
var textColor = indicator.color == Color.clear ? (Color)m_ThemeInfo.axisTextColor : indicator.color;
|
var textColor = indicator.color == Color.clear ? (Color)m_ThemeInfo.axisTextColor : indicator.color;
|
||||||
@@ -212,7 +212,7 @@ namespace XCharts
|
|||||||
var radar = m_Radars[serie.radarIndex];
|
var radar = m_Radars[serie.radarIndex];
|
||||||
int indicatorNum = radar.indicatorList.Count;
|
int indicatorNum = radar.indicatorList.Count;
|
||||||
var angle = 2 * Mathf.PI / indicatorNum;
|
var angle = 2 * Mathf.PI / indicatorNum;
|
||||||
Vector3 p = radar.centerPos;
|
Vector3 p = radar.runtimeCenterPos;
|
||||||
serie.animation.InitProgress(1, 0, 1);
|
serie.animation.InitProgress(1, 0, 1);
|
||||||
if (!IsActive(i))
|
if (!IsActive(i))
|
||||||
{
|
{
|
||||||
@@ -223,13 +223,13 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
var serieData = serie.data[j];
|
var serieData = serie.data[j];
|
||||||
int key = i * 100 + j;
|
int key = i * 100 + j;
|
||||||
if (!radar.dataPosList.ContainsKey(key))
|
if (!radar.runtimeDataPosList.ContainsKey(key))
|
||||||
{
|
{
|
||||||
radar.dataPosList.Add(i * 100 + j, new List<Vector3>(serieData.data.Count));
|
radar.runtimeDataPosList.Add(i * 100 + j, new List<Vector3>(serieData.data.Count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
radar.dataPosList[key].Clear();
|
radar.runtimeDataPosList[key].Clear();
|
||||||
}
|
}
|
||||||
string dataName = serieData.name;
|
string dataName = serieData.name;
|
||||||
int serieIndex = 0;
|
int serieIndex = 0;
|
||||||
@@ -253,11 +253,11 @@ namespace XCharts
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var isHighlight = serie.highlighted || serieData.highlighted ||
|
var isHighlight = serie.highlighted || serieData.highlighted ||
|
||||||
(m_Tooltip.show && m_Tooltip.dataIndex[0] == i && m_Tooltip.dataIndex[1] == j);
|
(m_Tooltip.show && m_Tooltip.runtimeDataIndex[0] == i && m_Tooltip.runtimeDataIndex[1] == j);
|
||||||
var areaColor = serie.GetAreaColor(m_ThemeInfo, serieIndex, isHighlight);
|
var areaColor = serie.GetAreaColor(m_ThemeInfo, serieIndex, isHighlight);
|
||||||
var lineColor = serie.GetLineColor(m_ThemeInfo, serieIndex, isHighlight);
|
var lineColor = serie.GetLineColor(m_ThemeInfo, serieIndex, isHighlight);
|
||||||
int dataCount = radar.indicatorList.Count;
|
int dataCount = radar.indicatorList.Count;
|
||||||
List<Vector3> pointList = radar.dataPosList[key];
|
List<Vector3> pointList = radar.runtimeDataPosList[key];
|
||||||
for (int n = 0; n < dataCount; n++)
|
for (int n = 0; n < dataCount; n++)
|
||||||
{
|
{
|
||||||
if (n >= serieData.data.Count) break;
|
if (n >= serieData.data.Count) break;
|
||||||
@@ -269,8 +269,8 @@ namespace XCharts
|
|||||||
serie.GetMinMaxData(n, out min, out max);
|
serie.GetMinMaxData(n, out min, out max);
|
||||||
min = radar.GetIndicatorMin(n);
|
min = radar.GetIndicatorMin(n);
|
||||||
}
|
}
|
||||||
var radius = max < 0 ? radar.actualRadius - radar.actualRadius * value / max
|
var radius = max < 0 ? radar.runtimeRadius - radar.runtimeRadius * value / max
|
||||||
: radar.actualRadius * value / max;
|
: radar.runtimeRadius * value / max;
|
||||||
var currAngle = n * angle;
|
var currAngle = n * angle;
|
||||||
radius *= rate;
|
radius *= rate;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
@@ -331,10 +331,10 @@ namespace XCharts
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float insideRadius = 0, outsideRadius = 0;
|
float insideRadius = 0, outsideRadius = 0;
|
||||||
float block = radar.actualRadius / radar.splitNumber;
|
float block = radar.runtimeRadius / radar.splitNumber;
|
||||||
int indicatorNum = radar.indicatorList.Count;
|
int indicatorNum = radar.indicatorList.Count;
|
||||||
Vector3 p1, p2, p3, p4;
|
Vector3 p1, p2, p3, p4;
|
||||||
Vector3 p = radar.centerPos;
|
Vector3 p = radar.runtimeCenterPos;
|
||||||
float angle = 2 * Mathf.PI / indicatorNum;
|
float angle = 2 * Mathf.PI / indicatorNum;
|
||||||
var lineColor = GetLineColor(radar);
|
var lineColor = GetLineColor(radar);
|
||||||
for (int i = 0; i < radar.splitNumber; i++)
|
for (int i = 0; i < radar.splitNumber; i++)
|
||||||
@@ -382,9 +382,9 @@ namespace XCharts
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float insideRadius = 0, outsideRadius = 0;
|
float insideRadius = 0, outsideRadius = 0;
|
||||||
float block = radar.actualRadius / radar.splitNumber;
|
float block = radar.runtimeRadius / radar.splitNumber;
|
||||||
int indicatorNum = radar.indicatorList.Count;
|
int indicatorNum = radar.indicatorList.Count;
|
||||||
Vector3 p = radar.centerPos;
|
Vector3 p = radar.runtimeCenterPos;
|
||||||
Vector3 p1;
|
Vector3 p1;
|
||||||
float angle = 2 * Mathf.PI / indicatorNum;
|
float angle = 2 * Mathf.PI / indicatorNum;
|
||||||
var lineColor = GetLineColor(radar);
|
var lineColor = GetLineColor(radar);
|
||||||
@@ -443,23 +443,23 @@ namespace XCharts
|
|||||||
if (!IsActive(i)) continue;
|
if (!IsActive(i)) continue;
|
||||||
var serie = m_Series.GetSerie(i);
|
var serie = m_Series.GetSerie(i);
|
||||||
var radar = m_Radars[serie.radarIndex];
|
var radar = m_Radars[serie.radarIndex];
|
||||||
var dist = Vector2.Distance(radar.centerPos, local);
|
var dist = Vector2.Distance(radar.runtimeCenterPos, local);
|
||||||
if (dist > radar.actualRadius + serie.symbol.size)
|
if (dist > radar.runtimeRadius + serie.symbol.size)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int n = 0; n < serie.data.Count; n++)
|
for (int n = 0; n < serie.data.Count; n++)
|
||||||
{
|
{
|
||||||
var posKey = i * 100 + n;
|
var posKey = i * 100 + n;
|
||||||
if (radar.dataPosList.ContainsKey(posKey))
|
if (radar.runtimeDataPosList.ContainsKey(posKey))
|
||||||
{
|
{
|
||||||
var posList = radar.dataPosList[posKey];
|
var posList = radar.runtimeDataPosList[posKey];
|
||||||
foreach (var pos in posList)
|
foreach (var pos in posList)
|
||||||
{
|
{
|
||||||
if (Vector2.Distance(pos, local) <= serie.symbol.size * 1.2f)
|
if (Vector2.Distance(pos, local) <= serie.symbol.size * 1.2f)
|
||||||
{
|
{
|
||||||
m_Tooltip.dataIndex[0] = i;
|
m_Tooltip.runtimeDataIndex[0] = i;
|
||||||
m_Tooltip.dataIndex[1] = n;
|
m_Tooltip.runtimeDataIndex[1] = n;
|
||||||
highlight = true;
|
highlight = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ namespace XCharts
|
|||||||
protected override void RefreshTooltip()
|
protected override void RefreshTooltip()
|
||||||
{
|
{
|
||||||
base.RefreshTooltip();
|
base.RefreshTooltip();
|
||||||
int serieIndex = m_Tooltip.dataIndex[0];
|
int serieIndex = m_Tooltip.runtimeDataIndex[0];
|
||||||
if (serieIndex < 0)
|
if (serieIndex < 0)
|
||||||
{
|
{
|
||||||
if (m_Tooltip.IsActive())
|
if (m_Tooltip.IsActive())
|
||||||
@@ -500,7 +500,7 @@ namespace XCharts
|
|||||||
m_Tooltip.SetActive(true);
|
m_Tooltip.SetActive(true);
|
||||||
var serie = m_Series.GetSerie(serieIndex);
|
var serie = m_Series.GetSerie(serieIndex);
|
||||||
var radar = m_Radars[serie.radarIndex];
|
var radar = m_Radars[serie.radarIndex];
|
||||||
var serieData = serie.GetSerieData(m_Tooltip.dataIndex[1]);
|
var serieData = serie.GetSerieData(m_Tooltip.runtimeDataIndex[1]);
|
||||||
StringBuilder sb = new StringBuilder(serieData.name);
|
StringBuilder sb = new StringBuilder(serieData.name);
|
||||||
for (int i = 0; i < radar.indicatorList.Count; i++)
|
for (int i = 0; i < radar.indicatorList.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -511,13 +511,13 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentText(sb.ToString());
|
m_Tooltip.UpdateContentText(sb.ToString());
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
if (pos.x + m_Tooltip.width > chartWidth)
|
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
||||||
{
|
{
|
||||||
pos.x = chartWidth - m_Tooltip.width;
|
pos.x = chartWidth - m_Tooltip.runtimeWidth;
|
||||||
}
|
}
|
||||||
if (pos.y - m_Tooltip.height < 0)
|
if (pos.y - m_Tooltip.runtimeHeight < 0)
|
||||||
{
|
{
|
||||||
pos.y = m_Tooltip.height;
|
pos.y = m_Tooltip.runtimeHeight;
|
||||||
}
|
}
|
||||||
m_Tooltip.UpdateContentPos(pos);
|
m_Tooltip.UpdateContentPos(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ namespace XCharts
|
|||||||
return btnObj.GetComponent<Button>();
|
return btnObj.GetComponent<Button>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject AddTooltipContent(string name, Transform parent, Font font, int fontSize, FontStyle fontStyle)
|
internal static GameObject AddTooltipContent(string name, Transform parent, Font font, int fontSize, FontStyle fontStyle)
|
||||||
{
|
{
|
||||||
var anchorMax = new Vector2(0, 1);
|
var anchorMax = new Vector2(0, 1);
|
||||||
var anchorMin = new Vector2(0, 1);
|
var anchorMin = new Vector2(0, 1);
|
||||||
@@ -218,7 +218,7 @@ namespace XCharts
|
|||||||
return iconObj;
|
return iconObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject AddSerieLabel(string name, Transform parent, Font font, Color textColor, Color backgroundColor,
|
internal static GameObject AddSerieLabel(string name, Transform parent, Font font, Color textColor, Color backgroundColor,
|
||||||
int fontSize, FontStyle fontStyle, float rotate, float width, float height)
|
int fontSize, FontStyle fontStyle, float rotate, float width, float height)
|
||||||
{
|
{
|
||||||
var anchorMin = new Vector2(0.5f, 0.5f);
|
var anchorMin = new Vector2(0.5f, 0.5f);
|
||||||
@@ -238,7 +238,7 @@ namespace XCharts
|
|||||||
return labelObj;
|
return labelObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject AddTooltipLabel(string name, Transform parent, Font font, Vector2 pivot)
|
internal static GameObject AddTooltipLabel(string name, Transform parent, Font font, Vector2 pivot)
|
||||||
{
|
{
|
||||||
var anchorMax = new Vector2(0, 0);
|
var anchorMax = new Vector2(0, 0);
|
||||||
var anchorMin = new Vector2(0, 0);
|
var anchorMin = new Vector2(0, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user