增加SerieLabel的LineType给饼图配置不同类型的视觉引导线

This commit is contained in:
monitor1394
2019-10-05 18:23:06 +08:00
parent eb641ea825
commit 46462ca05f
10 changed files with 23384 additions and 27754 deletions

View File

@@ -126,6 +126,11 @@ namespace XCharts
return true;
}
public bool IsCategory()
{
return !IsValue();
}
}
}

View File

@@ -296,7 +296,7 @@ namespace XCharts
}
break;
case LineType.Smooth:
ChartHelper.GetBezierList(ref bezierPoints, null, lp, np, llp, nnp, fine, lineSmoothStyle);
ChartHelper.GetBezierList(ref bezierPoints, lp, np, llp, nnp, fine, lineSmoothStyle);
if (bezierPoints.Count > 0) progress = bezierPoints.Count - 1;
break;
case LineType.StepStart:
@@ -858,7 +858,7 @@ namespace XCharts
var smoothDownPoints = serie.GetDownSmoothList(dataIndex);
var fine = isStack && m_Series.IsAnyGradientSerie(serie.stack);
if (isYAxis) ChartHelper.GetBezierListVertical(ref bezierPoints, lp, np, fine, lineSmoothStyle);
else ChartHelper.GetBezierList(ref bezierPoints, vh, lp, np, llp, nnp, fine, lineSmoothStyle);
else ChartHelper.GetBezierList(ref bezierPoints, lp, np, llp, nnp, fine, lineSmoothStyle);
Vector3 start, to;
if (serie.lineType == LineType.SmoothDash)

View File

@@ -28,12 +28,18 @@ namespace XCharts
private float m_LabelPaddingLeftRight;
private float m_LabelPaddingTopBottom;
public int index { get; set; }
/// <summary>
/// the name of data item.
/// 数据项名称。
/// </summary>
public string name { get { return m_Name; } set { m_Name = value; } }
/// <summary>
/// 数据项图例名称。当数据项名称不为空时图例名称即为系列名称反之则为索引index。
/// </summary>
/// <value></value>
public string legendName { get { return string.IsNullOrEmpty(name) ? ChartCached.IntToStr(index) : name; } }
/// <summary>
/// Whether the data item is selected.
/// 该数据项是否被选中。
/// </summary>
@@ -110,6 +116,35 @@ namespace XCharts
/// 关联的gameObject
/// </summary>
public GameObject gameObject { get; private set; }
/// <summary>
/// 饼图数据项的开始角度(运行时自动计算)
/// </summary>
public float pieStartAngle { get; set; }
/// <summary>
/// 饼图数据项的结束角度(运行时自动计算)
/// </summary>
public float pieToAngle { get; set; }
/// <summary>
/// 饼图数据项的一半时的角度(运行时自动计算)
/// </summary>
public float pieHalfAngle { get; set; }
/// <summary>
/// 饼图数据项的当前角度(运行时自动计算)
/// </summary>
public float pieCurrAngle { get; set; }
/// <summary>
/// 饼图数据项的内半径
/// </summary>
public float pieInsideRadius{get;set;}
/// <summary>
/// 饼图数据项的外半径
/// </summary>
public float pieOutsideRadius { get; set; }
/// <summary>
/// 饼图数据项的偏移半径
/// </summary>
public float pieOffsetRadius { get; set; }
public Vector3 pieOffsetCenter { get; set; }
public float GetData(int index)
{

View File

@@ -51,6 +51,25 @@ namespace XCharts
/// </summary>
Bottom,
}
/// <summary>
/// 标签视觉引导线类型
/// </summary>
public enum LineType
{
/// <summary>
/// 折线
/// </summary>
BrokenLine,
/// <summary>
/// 曲线
/// </summary>
Curves,
/// <summary>
/// 水平线
/// </summary>
HorizontalLine
}
[SerializeField] private bool m_Show = false;
[SerializeField] Position m_Position;
[SerializeField] private Vector3 m_Offset;
@@ -65,6 +84,8 @@ namespace XCharts
[SerializeField] private int m_FontSize = 18;
[SerializeField] private FontStyle m_FontStyle = FontStyle.Normal;
[SerializeField] private bool m_Line = true;
[SerializeField] private LineType m_LineType = LineType.BrokenLine;
[SerializeField] private Color m_LineColor = Color.clear;
[SerializeField] private float m_LineWidth = 1.0f;
[SerializeField] private float m_LineLength1 = 25f;
[SerializeField] private float m_LineLength2 = 15f;
@@ -153,6 +174,16 @@ namespace XCharts
/// </summary>
public bool line { get { return m_Line; } set { m_Line = value; } }
/// <summary>
/// the type of visual guide line.
/// 视觉引导线类型。
/// </summary>
public LineType lineType { get { return m_LineType; } set { m_LineType = value; } }
/// <summary>
/// the color of visual guild line.
/// 视觉引导线颜色。默认和serie一致取自调色板。
/// </summary>
public Color lineColor { get { return m_LineColor; } set { m_LineColor = value; } }
/// <summary>
/// the width of visual guild line.
/// 视觉引导线的宽度。
/// </summary>