增加LegendWidthHeight可设置固定宽高

This commit is contained in:
monitor1394
2026-05-17 18:47:47 +08:00
parent 0174453b05
commit 4120b61f2a
4 changed files with 39 additions and 1 deletions

View File

@@ -80,6 +80,8 @@ namespace XCharts.Runtime
[SerializeField] private bool m_ItemAutoColor = true;
[SerializeField] private float m_ItemOpacity = 1;
[SerializeField][Since("v3.15.0")] private float m_ItemInactiveOpacity = 1;
[SerializeField][Since("v3.16.0")] private float m_Width = 0;
[SerializeField][Since("v3.16.0")] private float m_Height = 0;
[SerializeField] private string m_Formatter;
[SerializeField] private LabelStyle m_LabelStyle = new LabelStyle();
[SerializeField][Since("v3.10.0")] private TextLimit m_TextLimit = new TextLimit();
@@ -202,6 +204,25 @@ namespace XCharts.Runtime
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetComponentDirty(); }
}
/// <summary>
/// the width of legend component. Default is 0 for auto adapt. When set a value between 0 and 1, it means the percentage relative to chart width and height.
/// ||图例组件的宽。默认为0自适应。当设置0-1的值时表示相对于图表宽高的比例。
/// </summary>
public float width
{
get { return m_Width; }
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
}
/// <summary>
/// the height of legend component. Default is 0 for auto adapt. When set a value between 0 and 1, it means the percentage relative to chart width and height.
/// ||图例组件的高。默认为0自适应。当设置0-1的值时表示相对于图表宽高的比例。
/// </summary>
/// <value></value>
public float height
{
get { return m_Height; }
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
}
/// <summary>
/// the style of text.
/// ||文本样式。
/// </summary>