mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 10:20:10 +00:00
增加Pie的radiusGradient可设置半径方向的渐变效果
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
@@ -9,9 +11,21 @@ namespace XCharts.Runtime
|
||||
[SerieDataExtraField("m_Ignore", "m_Selected", "m_Radius")]
|
||||
public class Pie : Serie
|
||||
{
|
||||
[SerializeField][Since("v3.8.1")] private bool m_RadiusGradient = false;
|
||||
|
||||
public override SerieColorBy defaultColorBy { get { return SerieColorBy.Data; } }
|
||||
public override bool titleJustForSerie { get { return true; } }
|
||||
|
||||
/// <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 static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
{
|
||||
var serie = chart.AddSerie<Pie>(serieName);
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawPie(VertexHelper vh, Serie serie)
|
||||
private void DrawPie(VertexHelper vh, Pie serie)
|
||||
{
|
||||
if (!serie.show || serie.animation.HasFadeOut())
|
||||
{
|
||||
@@ -387,7 +387,7 @@ namespace XCharts.Runtime
|
||||
UGL.DrawDoughnut(vh, offsetCenter, insideRadius,
|
||||
outsideRadius, color, toColor, Color.clear, serieData.context.startAngle,
|
||||
drawEndDegree, borderWidth, borderColor, serie.gap / 2, chart.settings.cicleSmoothness,
|
||||
needRoundCap, true);
|
||||
needRoundCap, true, serie.radiusGradient);
|
||||
DrawPieCenter(vh, serie, itemStyle, insideRadius);
|
||||
|
||||
if (serie.animation.CheckDetailBreak(serieData.context.toAngle))
|
||||
|
||||
Reference in New Issue
Block a user