增加LineChart的Label配置

This commit is contained in:
monitor1394
2019-08-16 00:13:01 +08:00
parent 3e506f9576
commit b464f5b25f
9 changed files with 21259 additions and 8069 deletions

View File

@@ -48,6 +48,8 @@ namespace XCharts
/// 该数据项的文本标签。
/// </summary>
public Text label { get; set; }
public RectTransform labelRect { get; set; }
public Image labelImage { get; set; }
/// <summary>
/// the maxinum value.
/// 最大值。
@@ -64,5 +66,31 @@ namespace XCharts
if (index >= 0 && index < m_Data.Count) return m_Data[index];
else return 0;
}
public void SetLabelActive(bool active)
{
if (labelImage)
{
ChartHelper.SetActive(labelImage.gameObject, active);
}
}
public void SetLabelText(string text)
{
if (label)
{
label.text = text;
labelRect.sizeDelta = new Vector2(label.preferredWidth + 4,
label.preferredHeight + 4);
}
}
public void SetLabelPosition(Vector3 position)
{
if (labelImage)
{
labelImage.transform.localPosition = position;
}
}
}
}