2022-05-22 22:17:38 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XCharts.Runtime
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// comment of chart.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||注解项。
|
2022-05-22 22:17:38 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class CommentItem : ChildComponent
|
|
|
|
|
|
{
|
|
|
|
|
|
[SerializeField] private bool m_Show = true;
|
2025-03-22 09:24:46 +08:00
|
|
|
|
[SerializeField] private string m_Content = "xcharts";
|
2022-05-22 22:17:38 +08:00
|
|
|
|
[SerializeField] private Rect m_MarkRect;
|
|
|
|
|
|
[SerializeField] private CommentMarkStyle m_MarkStyle = new CommentMarkStyle() { show = false };
|
|
|
|
|
|
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle() { show = false };
|
2025-03-22 09:24:46 +08:00
|
|
|
|
[SerializeField][Since("v3.5.0")] private Location m_Location = new Location() { align = Location.Align.BottomRight, right = 0.1f, bottom = 0.05f };
|
2025-03-01 22:30:51 +08:00
|
|
|
|
|
|
|
|
|
|
public ChartLabel labelObject { get; set; }
|
2022-11-27 17:28:37 +08:00
|
|
|
|
|
2022-05-22 22:17:38 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Set this to false to prevent this comment item from showing.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||是否显示当前注解项。
|
2022-05-22 22:17:38 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool show { get { return m_Show; } set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// content of comment.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||注解的文本内容。支持模板参数,可以参考Tooltip的itemFormatter。
|
2022-05-22 22:17:38 +08:00
|
|
|
|
/// </summary>
|
2025-03-01 22:30:51 +08:00
|
|
|
|
public string content
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_Content; }
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (PropertyUtil.SetClass(ref m_Content, value))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (labelObject != null) labelObject.SetText(value);
|
|
|
|
|
|
else SetComponentDirty();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-15 07:36:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// the mark rect of comment.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||注解区域。
|
2022-06-15 07:36:05 +08:00
|
|
|
|
/// </summary>
|
2022-05-22 22:17:38 +08:00
|
|
|
|
public Rect markRect { get { return m_MarkRect; } set { if (PropertyUtil.SetStruct(ref m_MarkRect, value)) SetVerticesDirty(); } }
|
2022-06-15 07:36:05 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// the mark rect style.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||注解标记区域样式。
|
2022-06-15 07:36:05 +08:00
|
|
|
|
/// </summary>
|
2022-05-22 22:17:38 +08:00
|
|
|
|
public CommentMarkStyle markStyle { get { return m_MarkStyle; } set { if (PropertyUtil.SetClass(ref m_MarkStyle, value)) SetVerticesDirty(); } }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The text style of all comments.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||注解项的文本样式。
|
2022-05-22 22:17:38 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public LabelStyle labelStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_LabelStyle; }
|
|
|
|
|
|
set { if (PropertyUtil.SetClass(ref m_LabelStyle, value)) SetComponentDirty(); }
|
|
|
|
|
|
}
|
2022-11-27 17:28:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The location of comment.
|
2023-11-11 23:32:24 +08:00
|
|
|
|
/// ||Comment显示的位置。
|
2022-11-27 17:28:37 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Location location
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_Location; }
|
|
|
|
|
|
set { if (PropertyUtil.SetClass(ref m_Location, value)) SetComponentDirty(); }
|
|
|
|
|
|
}
|
2022-05-22 22:17:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|