mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +00:00
增加SerieData的ItemStyle和Emphasis可单独配置数据项样式的支持
This commit is contained in:
@@ -36,6 +36,7 @@ namespace XCharts
|
||||
}
|
||||
[SerializeField] private bool m_Show = false;
|
||||
[SerializeField] private Color m_Color;
|
||||
[SerializeField] private Color m_ToColor;
|
||||
[SerializeField] private Color m_BackgroundColor;
|
||||
[SerializeField] private float m_BackgroundWidth;
|
||||
[SerializeField] private Color m_CenterColor;
|
||||
@@ -62,6 +63,15 @@ namespace XCharts
|
||||
set { if (PropertyUtility.SetColor(ref m_Color, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gradient color, start color to toColor.
|
||||
/// 渐变色的终点颜色。
|
||||
/// </summary>
|
||||
public Color toColor
|
||||
{
|
||||
get { return m_ToColor; }
|
||||
set { if (PropertyUtility.SetColor(ref m_ToColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 数据项背景颜色。
|
||||
/// </summary>
|
||||
public Color backgroundColor
|
||||
@@ -138,6 +148,11 @@ namespace XCharts
|
||||
return borderWidth != 0 && borderColor != Color.clear;
|
||||
}
|
||||
|
||||
|
||||
public Color GetColor()
|
||||
{
|
||||
var color = m_Color;
|
||||
color.a *= m_Opacity;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,32 +112,11 @@ namespace XCharts
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public void Copy(LineStyle other)
|
||||
public Color GetColor()
|
||||
{
|
||||
m_Show = other.show;
|
||||
m_Type = other.type;
|
||||
m_Color = other.color;
|
||||
m_Width = other.width;
|
||||
m_Opacity = other.opacity;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var other = (LineStyle)obj;
|
||||
return m_Show == other.show &&
|
||||
m_Type == other.type &&
|
||||
m_Width == other.width &&
|
||||
m_Opacity == other.opacity &&
|
||||
ChartHelper.IsValueEqualsColor(m_Color, other.color);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
var color = m_Color;
|
||||
color.a *= m_Opacity;
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,10 @@ namespace XCharts
|
||||
[SerializeField] private IconStyle m_IconStyle = new IconStyle();
|
||||
[SerializeField] private bool m_EnableLabel = false;
|
||||
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
||||
[SerializeField] private bool m_EnableItemStyle = false;
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
[SerializeField] private bool m_EnableEmphasis = false;
|
||||
[SerializeField] private Emphasis m_Emphasis = new Emphasis();
|
||||
[SerializeField] private List<float> m_Data = new List<float>();
|
||||
|
||||
private bool m_Show = true;
|
||||
@@ -68,6 +72,22 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public SerieLabel label { get { return m_Label; } set { m_Label = value; } }
|
||||
/// <summary>
|
||||
/// 是否启用单个数据项的样式。
|
||||
/// </summary>
|
||||
public bool enableItemStyle { get { return m_EnableItemStyle; } set { m_EnableItemStyle = value; } }
|
||||
/// <summary>
|
||||
/// 单个数据项的样式设置。
|
||||
/// </summary>
|
||||
public ItemStyle itemStyle { get { return m_ItemStyle; } set { m_ItemStyle = value; } }
|
||||
/// <summary>
|
||||
/// 是否启用单个数据项的高亮样式。
|
||||
/// </summary>
|
||||
public bool enableEmphasis{ get { return m_EnableEmphasis; } set { m_EnableEmphasis = value; } }
|
||||
/// <summary>
|
||||
/// 单个数据项的高亮样式设置。
|
||||
/// </summary>
|
||||
public Emphasis emphasis { get { return m_Emphasis; } set { m_Emphasis = value; } }
|
||||
/// <summary>
|
||||
/// An arbitrary dimension data list of data item.
|
||||
/// 可指定任意维数的数值列表。
|
||||
/// </summary>
|
||||
@@ -336,11 +356,5 @@ namespace XCharts
|
||||
{
|
||||
return labelText != null;
|
||||
}
|
||||
|
||||
public SerieLabel GetSerieLabel(SerieLabel parentLabel)
|
||||
{
|
||||
if (enableLabel) return label;
|
||||
else return parentLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace XCharts
|
||||
[SerializeField] private float m_LineWidth = 1.0f;
|
||||
[SerializeField] private float m_LineLength1 = 25f;
|
||||
[SerializeField] private float m_LineLength2 = 15f;
|
||||
[SerializeField] private bool m_Border = true;
|
||||
[SerializeField] private bool m_Border = false;
|
||||
[SerializeField] private float m_BorderWidth = 0.5f;
|
||||
[SerializeField] private Color m_BorderColor = Color.grey;
|
||||
[SerializeField] private bool m_ForceENotation = false;
|
||||
|
||||
@@ -176,24 +176,6 @@ namespace XCharts
|
||||
set { if (PropertyUtility.SetClass(ref m_SelectedSizeCallback, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of symbol,default from serie.
|
||||
/// 标记图形的颜色,默认和系列一致。
|
||||
/// </summary>
|
||||
public Color color
|
||||
{
|
||||
get { return m_Color; }
|
||||
set { if (PropertyUtility.SetColor(ref m_Color, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the opacity of color.
|
||||
/// 图形标记的透明度。
|
||||
/// </summary>
|
||||
public float opacity
|
||||
{
|
||||
get { return m_Opacity; }
|
||||
set { if (PropertyUtility.SetStruct(ref m_Opacity, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the index start to show symbol.
|
||||
/// 开始显示图形标记的索引。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user