增加RingradiusGradient参数设置渐变方向

This commit is contained in:
monitor1394
2024-08-31 22:22:33 +08:00
parent 59cd12d0eb
commit e40e19c197
4 changed files with 18 additions and 1 deletions

View File

@@ -76,6 +76,9 @@ slug: /changelog
## master
* (2024.09.01) 增加`Ring``radiusGradient`参数设置渐变方向
* (2024.09.01) 优化`Axis`为时间轴时首个Label的位置
## v3.11.2
* (2024.08.01) 发布`v3.11.2`版本

View File

@@ -16,6 +16,7 @@ namespace XCharts.Editor
PropertyField("m_RoundCap");
PropertyField("m_Clockwise");
PropertyField("m_AvoidLabelOverlap");
PropertyField("m_RadiusGradient");
PropertyField("m_ItemStyle");
PropertyField("m_Animation");

View File

@@ -9,7 +9,20 @@ namespace XCharts.Runtime
[SerieDataExtraField()]
public class Ring : Serie
{
[SerializeField][Since("v3.12.0")] private bool m_RadiusGradient = false;
/// <summary>
/// Whether to use gradient color in pie chart.
/// || 是否开启半径方向的渐变效果。
/// </summary>
public bool radiusGradient
{
get { return m_RadiusGradient; }
set { if (PropertyUtil.SetStruct(ref m_RadiusGradient, value)) { SetVerticesDirty(); } }
}
public override SerieColorBy defaultColorBy { get { return SerieColorBy.Data; } }
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
{
var serie = chart.AddSerie<Ring>(serieName);

View File

@@ -162,7 +162,7 @@ namespace XCharts.Runtime
DrawBackground(vh, serie, serieData, j, insideRadius, outsideRadius);
UGL.DrawDoughnut(vh, serie.context.center, insideRadius, outsideRadius, itemColor, itemToColor,
Color.clear, startDegree, toDegree, borderWidth, borderColor, 0, chart.settings.cicleSmoothness,
roundCap, serie.clockwise);
roundCap, serie.clockwise, serie.radiusGradient);
DrawCenter(vh, serie, serieData, insideRadius, j == data.Count - 1);
}