mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-27 19:50:10 +00:00
[feature][serie] support the colorBy of serie
This commit is contained in:
@@ -194,6 +194,29 @@ namespace XCharts.Runtime
|
||||
Auto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The policy to take color from theme.
|
||||
/// |从主题中取色策略。
|
||||
/// </summary>
|
||||
public enum SerieColorBy
|
||||
{
|
||||
/// <summary>
|
||||
/// Select state.
|
||||
/// |默认策略。每种Serie都有自己的默认的取颜色策略。比如Line默认是Series策略,Pie默认是Data策略
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// assigns the colors in the palette by serie, so that all data in the same series are in the same color;.
|
||||
/// |按照系列分配调色盘中的颜色,同一系列中的所有数据都是用相同的颜色。
|
||||
/// </summary>
|
||||
Serie,
|
||||
/// <summary>
|
||||
/// assigns colors in the palette according to data items, with each data item using a different color..
|
||||
/// |按照数据项分配调色盘中的颜色,每个数据项都使用不同的颜色。
|
||||
/// </summary>
|
||||
Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系列。
|
||||
/// </summary>
|
||||
@@ -206,6 +229,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private string m_SerieType = "";
|
||||
[SerializeField] private string m_SerieName;
|
||||
[SerializeField][Since("v3.2.0")] private SerieState m_State = SerieState.Normal;
|
||||
[SerializeField][Since("v3.2.0")] private SerieColorBy m_ColorBy = SerieColorBy.Default;
|
||||
[SerializeField] private string m_Stack;
|
||||
[SerializeField] private int m_XAxisIndex = 0;
|
||||
[SerializeField] private int m_YAxisIndex = 0;
|
||||
@@ -339,6 +363,16 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_State, value)) { SetAllDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// The policy to take color from theme.
|
||||
/// |从主题中取色的策略。
|
||||
/// </summary>
|
||||
public SerieColorBy colorBy
|
||||
{
|
||||
//get { return m_ColorBy; }
|
||||
get { return m_ColorBy == SerieColorBy.Default?defaultColorBy : m_ColorBy; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ColorBy, value)) { SetAllDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
|
||||
/// |数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。
|
||||
/// </summary>
|
||||
@@ -860,7 +894,10 @@ namespace XCharts.Runtime
|
||||
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
||||
/// </summary>
|
||||
public List<SerieData> data { get { return m_Data; } }
|
||||
|
||||
/// <summary>
|
||||
/// 取色策略是否为按数据项分配。
|
||||
/// </summary>
|
||||
public bool colorByData { get { return colorBy == SerieColorBy.Data; } }
|
||||
public override bool vertsDirty
|
||||
{
|
||||
get
|
||||
@@ -1703,7 +1740,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public bool IsLegendName(string legendName)
|
||||
{
|
||||
if (useDataNameForColor)
|
||||
if (colorBy == SerieColorBy.Data)
|
||||
{
|
||||
return IsSerieDataLegendName(legendName) || IsSerieLegendName(legendName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user