mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
增加Serie的iconStyle统一配置图标
This commit is contained in:
@@ -319,6 +319,7 @@ namespace XCharts
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
|
||||
[SerializeField] private TitleStyle m_TitleStyle = new TitleStyle();
|
||||
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
|
||||
[SerializeField] private MarkLine m_MarkLine = MarkLine.defaultMarkLine;
|
||||
[SerializeField] [Range(1, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField] private bool m_ShowDataName;
|
||||
@@ -862,6 +863,15 @@ namespace XCharts
|
||||
set { if (PropertyUtil.SetClass(ref m_MarkLine, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the icon of data.
|
||||
/// 数据项图标样式。
|
||||
/// </summary>
|
||||
public IconStyle iconStyle
|
||||
{
|
||||
get { return m_IconStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_IconStyle, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项里的数据维数。
|
||||
/// </summary>
|
||||
public int showDataDimension { get { return m_ShowDataDimension; } set { m_ShowDataDimension = value; } }
|
||||
@@ -1097,6 +1107,7 @@ namespace XCharts
|
||||
gaugePointer.ClearVerticesDirty();
|
||||
titleStyle.ClearVerticesDirty();
|
||||
markLine.ClearVerticesDirty();
|
||||
iconStyle.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
@@ -1113,6 +1124,7 @@ namespace XCharts
|
||||
gaugePointer.ClearComponentDirty();
|
||||
titleStyle.ClearComponentDirty();
|
||||
markLine.ClearComponentDirty();
|
||||
iconStyle.ClearComponentDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1789,60 +1801,6 @@ namespace XCharts
|
||||
else return m_BarWidth * categoryWidth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置所有数据的图标是否显示
|
||||
/// </summary>
|
||||
/// <param name="flag"></param>
|
||||
public void SetDataIconActive(bool flag)
|
||||
{
|
||||
foreach (var data in m_Data)
|
||||
{
|
||||
data.iconStyle.show = flag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定index的数据图标是否显示
|
||||
/// </summary>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <param name="flag"></param>
|
||||
public void SetDataIconActive(int dataIndex, bool flag)
|
||||
{
|
||||
if (dataIndex >= 0 && dataIndex < m_Data.Count)
|
||||
{
|
||||
var data = m_Data[dataIndex];
|
||||
data.iconStyle.show = flag;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一设置图标的尺寸
|
||||
/// </summary>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
public void SetDataIconSize(float width, float height)
|
||||
{
|
||||
foreach (var data in m_Data)
|
||||
{
|
||||
data.iconStyle.width = width;
|
||||
data.iconStyle.height = height;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定index的数据图标的图片
|
||||
/// </summary>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <param name="image"></param>
|
||||
public void SetDataIcon(int dataIndex, Sprite image)
|
||||
{
|
||||
if (dataIndex >= 0 && dataIndex < m_Data.Count)
|
||||
{
|
||||
var data = m_Data[dataIndex];
|
||||
data.iconStyle.sprite = image;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsIgnoreIndex(int index, int dimension = 1)
|
||||
{
|
||||
var serieData = GetSerieData(index);
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace XCharts
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private bool m_Ignore = false;
|
||||
[SerializeField] private float m_Radius;
|
||||
[SerializeField] private bool m_EnableIconStyle = false;
|
||||
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
|
||||
[SerializeField] private bool m_EnableLabel = false;
|
||||
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
||||
@@ -58,6 +59,10 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
||||
/// <summary>
|
||||
/// 是否启用单个数据项的图标设置。
|
||||
/// </summary>
|
||||
public bool enableIconStyle { get { return m_EnableIconStyle; } set { m_EnableIconStyle = value; } }
|
||||
/// <summary>
|
||||
/// the icon of data.
|
||||
/// 数据项图标样式。
|
||||
/// </summary>
|
||||
@@ -185,6 +190,7 @@ namespace XCharts
|
||||
m_Show = true;
|
||||
m_Selected = false;
|
||||
m_CanShowLabel = true;
|
||||
m_EnableIconStyle = false;
|
||||
m_EnableSymbol = false;
|
||||
m_EnableLabel = false;
|
||||
m_EnableEmphasis = false;
|
||||
@@ -381,6 +387,10 @@ namespace XCharts
|
||||
{
|
||||
if (labelObject != null) labelObject.SetLabelActive(flag);
|
||||
}
|
||||
public void SetIconActive(bool flag)
|
||||
{
|
||||
if (labelObject != null) labelObject.SetIconActive(flag);
|
||||
}
|
||||
|
||||
public void SetPolygon(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user