mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
增加SerieData的radius自定义数据项的半径
This commit is contained in:
20
Demo/Scripts/Demo30_Pie.cs
Normal file
20
Demo/Scripts/Demo30_Pie.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XCharts;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Demo30_Pie : MonoBehaviour
|
||||
{
|
||||
private PieChart chart;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<PieChart>();
|
||||
if (chart == null) return;
|
||||
|
||||
var serie = chart.series.GetSerie(0);
|
||||
var serieData = serie.GetSerieData(0);
|
||||
serieData.radius = 100;
|
||||
}
|
||||
}
|
||||
11
Demo/Scripts/Demo30_Pie.cs.meta
Normal file
11
Demo/Scripts/Demo30_Pie.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00a8daeea9dce492c8c1ed93c90ae409
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -14,6 +14,7 @@ namespace XCharts
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private float m_Radius;
|
||||
[SerializeField] private bool m_ShowIcon;
|
||||
[SerializeField] private Sprite m_IconImage;
|
||||
[SerializeField] private Color m_IconColor = Color.white;
|
||||
@@ -27,6 +28,7 @@ namespace XCharts
|
||||
private bool m_LabelAutoSize;
|
||||
private float m_LabelPaddingLeftRight;
|
||||
private float m_LabelPaddingTopBottom;
|
||||
private float m_RtPieOutsideRadius;
|
||||
|
||||
public int index { get; set; }
|
||||
/// <summary>
|
||||
@@ -40,6 +42,10 @@ namespace XCharts
|
||||
/// <value></value>
|
||||
public string legendName { get { return string.IsNullOrEmpty(name) ? ChartCached.IntToStr(index) : name; } }
|
||||
/// <summary>
|
||||
/// 自定义半径。可用在饼图中自定义某个数据项的半径。
|
||||
/// </summary>
|
||||
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// Whether the data item is selected.
|
||||
/// 该数据项是否被选中。
|
||||
/// </summary>
|
||||
@@ -135,11 +141,22 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 饼图数据项的内半径
|
||||
/// </summary>
|
||||
public float pieInsideRadius{get;set;}
|
||||
public float pieInsideRadius { get; set; }
|
||||
/// <summary>
|
||||
/// 饼图数据项的外半径
|
||||
/// </summary>
|
||||
public float pieOutsideRadius { get; set; }
|
||||
public float pieOutsideRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
if (radius > 0) return radius;
|
||||
else return m_RtPieOutsideRadius;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_RtPieOutsideRadius = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 饼图数据项的偏移半径
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user