mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +00:00
增加Serie的minRadius可设置最小半径
This commit is contained in:
@@ -221,13 +221,23 @@ namespace XCharts.Runtime
|
||||
|
||||
private void UpdateSerieDataRadius(SerieData serieData, double value)
|
||||
{
|
||||
var minChartWidth = Mathf.Min(chart.chartWidth, chart.chartHeight);
|
||||
var minRadius = serie.minRadius > 0 ? ChartHelper.GetActualValue(serie.minRadius, minChartWidth) : 0;
|
||||
if (serieData.radius > 0)
|
||||
serieData.context.outsideRadius = ChartHelper.GetActualValue(serieData.radius, Mathf.Min(chart.chartWidth, chart.chartHeight));
|
||||
{
|
||||
serieData.context.outsideRadius = ChartHelper.GetActualValue(serieData.radius, minChartWidth);
|
||||
}
|
||||
else
|
||||
{
|
||||
var minInsideRadius = minRadius > 0 ? minRadius : serie.context.insideRadius;
|
||||
serieData.context.outsideRadius = serie.pieRoseType > 0 ?
|
||||
serie.context.insideRadius + (float)((serie.context.outsideRadius - serie.context.insideRadius) * value / serie.context.dataMax) :
|
||||
minInsideRadius + (float)((serie.context.outsideRadius - minInsideRadius) * value / serie.context.dataMax) :
|
||||
serie.context.outsideRadius;
|
||||
|
||||
}
|
||||
if (minRadius > 0 && serieData.context.outsideRadius < minRadius)
|
||||
{
|
||||
serieData.context.outsideRadius = minRadius;
|
||||
}
|
||||
var offset = 0f;
|
||||
var interactOffset = serie.animation.interaction.GetOffset(serie.context.outsideRadius);
|
||||
if (serie.pieClickOffset && (serieData.selected || serieData.context.selected))
|
||||
@@ -424,7 +434,7 @@ namespace XCharts.Runtime
|
||||
var outSideRadius = serieData.context.outsideRadius;
|
||||
var center = serieData.context.offsetCenter;
|
||||
var interact = false;
|
||||
serieData.interact.TryGetValueAndColor(ref outSideRadius,ref center,ref interact, serie.animation.GetInteractionDuration());
|
||||
serieData.interact.TryGetValueAndColor(ref outSideRadius, ref center, ref interact, serie.animation.GetInteractionDuration());
|
||||
var currAngle = serieData.context.halfAngle;
|
||||
if (!ChartHelper.IsClearColor(labelLine.lineColor))
|
||||
color = labelLine.lineColor;
|
||||
|
||||
@@ -279,6 +279,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private float m_Gap;
|
||||
[SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.48f };
|
||||
[SerializeField] private float[] m_Radius = new float[2] { 0, 0.28f };
|
||||
[SerializeField][Since("v3.8.0")] private float m_MinRadius = 0f;
|
||||
|
||||
[SerializeField][Range(2, 10)] private int m_ShowDataDimension;
|
||||
[SerializeField] private bool m_ShowDataName;
|
||||
@@ -679,6 +680,15 @@ namespace XCharts.Runtime
|
||||
set { if (value != null && value.Length == 2) { m_Radius = value; SetVerticesDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// the min radius of chart. It can be used to limit the minimum radius of the rose chart.
|
||||
/// |最小半径。可用于限制玫瑰图的最小半径。
|
||||
/// </summary>
|
||||
public float minRadius
|
||||
{
|
||||
get { return m_MinRadius; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_MinRadius, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 最小值。
|
||||
/// </summary>
|
||||
public float min
|
||||
|
||||
Reference in New Issue
Block a user