整理文档

This commit is contained in:
monitor1394
2020-07-10 09:13:26 +08:00
parent 52bfa8babe
commit 70813f5581
41 changed files with 1725 additions and 325 deletions

View File

@@ -11,6 +11,8 @@ using UnityEngine;
namespace XCharts
{
/// <summary>
/// Legend component.The legend component shows different sets of tags, colors, and names.
/// You can control which series are not displayed by clicking on the legend.
/// 图例组件。
/// 图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
/// </summary>
@@ -19,7 +21,6 @@ namespace XCharts
{
/// <summary>
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
/// It is enabled by default, and you may set it to be false to disabled it.
/// 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
/// </summary>
public enum SelectedMode
@@ -64,6 +65,7 @@ namespace XCharts
/// <summary>
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
/// 选择模式。控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 None 关闭。
/// [default:SelectedMode.Multiple]
/// </summary>
/// <value></value>
public SelectedMode selectedMode
@@ -74,6 +76,7 @@ namespace XCharts
/// <summary>
/// Specify whether the layout of legend component is horizontal or vertical.
/// 布局方式是横还是竖。
/// [default:Orient.Horizonal]
/// </summary>
public Orient orient
{
@@ -83,6 +86,7 @@ namespace XCharts
/// <summary>
/// The location of legend.
/// 图例显示的位置。
/// [default:Location.defaultTop]
/// </summary>
public Location location
{
@@ -92,6 +96,7 @@ namespace XCharts
/// <summary>
/// Image width of legend symbol.
/// 图例标记的图形宽度。
/// [default:24f]
/// </summary>
public float itemWidth
{
@@ -101,6 +106,7 @@ namespace XCharts
/// <summary>
/// Image height of legend symbol.
/// 图例标记的图形高度。
/// [default:12f]
/// </summary>
public float itemHeight
{
@@ -110,6 +116,7 @@ namespace XCharts
/// <summary>
/// The distance between each legend, horizontal distance in horizontal layout, and vertical distance in vertical layout.
/// 图例每项之间的间隔。横向布局时为水平间隔,纵向布局时为纵向间隔。
/// [default:10f]
/// </summary>
public float itemGap
{
@@ -119,6 +126,7 @@ namespace XCharts
/// <summary>
/// Whether the legend symbol matches the color automatically.
/// 图例标记的图形是否自动匹配颜色。
/// [default:true]
/// </summary>
public bool itemAutoColor
{
@@ -126,8 +134,10 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_ItemAutoColor, value)) SetComponentDirty(); }
}
/// <summary>
/// Legend content string template formatter. Support for wrapping lines with \n. Template:{name}.
/// 图例内容字符串模版格式器。支持用 \n 换行。
/// 模板变量为图例名称 {name}
/// 模板变量为图例名称 {name}
/// [default:null]
/// </summary>
public string formatter
{
@@ -231,7 +241,8 @@ namespace XCharts
}
/// <summary>
/// 清空
/// Clear legend data.
/// 清空。
/// </summary>
public void ClearData()
{
@@ -240,6 +251,7 @@ namespace XCharts
}
/// <summary>
/// Whether include in legend data by the specified name.
/// 是否包括由指定名字的图例
/// </summary>
/// <param name="name"></param>
@@ -250,7 +262,8 @@ namespace XCharts
}
/// <summary>
/// 移除指定名字的图例
/// Removes the legend with the specified name.
/// 移除指定名字的图例。
/// </summary>
/// <param name="name"></param>
public void RemoveData(string name)
@@ -263,7 +276,8 @@ namespace XCharts
}
/// <summary>
/// 添加图例项
/// Add legend data.
/// 添加图例。
/// </summary>
/// <param name="name"></param>
public void AddData(string name)
@@ -276,7 +290,8 @@ namespace XCharts
}
/// <summary>
/// 获得指定索引的图例
/// Gets the legend for the specified index.
/// 获得指定索引的图例。
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
@@ -290,7 +305,8 @@ namespace XCharts
}
/// <summary>
/// 获得指定图例的索引
/// Gets the index of the specified legend.
/// 获得指定图例的索引。
/// </summary>
/// <param name="legendName"></param>
/// <returns></returns>
@@ -300,7 +316,8 @@ namespace XCharts
}
/// <summary>
/// 移除所有图例按钮
/// Remove all legend buttons.
/// 移除所有图例按钮。
/// </summary>
public void RemoveButton()
{
@@ -308,7 +325,8 @@ namespace XCharts
}
/// <summary>
/// 给图例绑定按钮
/// Bind buttons to legends.
/// 给图例绑定按钮。
/// </summary>
/// <param name="name"></param>
/// <param name="btn"></param>
@@ -321,7 +339,8 @@ namespace XCharts
}
/// <summary>
/// 更新图例按钮颜色
/// Update the legend button color.
/// 更新图例按钮颜色。
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
@@ -333,6 +352,12 @@ namespace XCharts
}
}
/// <summary>
/// Update the text color of legend.
/// 更新图例文字颜色。
/// </summary>
/// <param name="name"></param>
/// <param name="color"></param>
public void UpdateContentColor(string name, Color color)
{
if (m_DataBtnList.ContainsKey(name))
@@ -341,6 +366,12 @@ namespace XCharts
}
}
/// <summary>
/// Gets the legend button for the specified index.
/// 获得指定索引的图例按钮。
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public Sprite GetIcon(int index)
{
if (index >= 0 && index < m_Icons.Count)
@@ -354,7 +385,8 @@ namespace XCharts
}
/// <summary>
/// 参数变更时的回调处理
/// Callback handling when parameters change.
/// 参数变更时的回调处理。
/// </summary>
public void OnChanged()
{
@@ -362,7 +394,8 @@ namespace XCharts
}
/// <summary>
/// 从json字符串解析数据json格式如['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
/// Parsing the data from the JSON string.
/// 从json字符串解析数据json格式如['legend1','legend2','legend3','legend4','legend5']
/// </summary>
/// <param name="jsonData"></param>
public override void ParseJsonData(string jsonData)
@@ -372,6 +405,11 @@ namespace XCharts
SetComponentDirty();
}
/// <summary>
/// 获得图例格式化后的显示内容。
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public string GetFormatterContent(string category)
{
if (string.IsNullOrEmpty(m_Formatter))

View File

@@ -27,8 +27,8 @@ namespace XCharts
/// <summary>
/// Whether to show the grid in rectangular coordinate.
/// 是否显示直角坐标系网格
/// Whether to show the polor component.
/// 是否显示极坐标
/// </summary>
public bool show
{
@@ -36,7 +36,8 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
}
/// <summary>
/// the center of ploar.
/// [default:[0.5f,0.45f]]The center of ploar. The center[0] is the x-coordinate, and the center[1] is the y-coordinate.
/// When value between 0 and 1 represents a percentage relative to the chart.
/// 极坐标的中心点。数组的第一项是横坐标,第二项是纵坐标。
/// 当值为0-1之间时表示百分比设置成百分比时第一项是相对于容器宽度第二项是相对于容器高度。
/// </summary>
@@ -46,7 +47,7 @@ namespace XCharts
set { if (value != null) { m_Center = value; SetAllDirty(); } }
}
/// <summary>
/// the radius of polar.
/// [default:0.35f]the radius of polar.
/// 极坐标的半径。
/// </summary>
public float radius
@@ -55,7 +56,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Radius, value)) SetAllDirty(); }
}
/// <summary>
/// Background color of polar, which is transparent by default.
/// [default:Color.clear]Background color of polar, which is transparent by default.
/// 极坐标的背景色,默认透明。
/// </summary>
public Color backgroundColor
@@ -74,6 +75,7 @@ namespace XCharts
/// 极坐标的运行时实际半径。
/// </summary>
public float runtimeRadius { get; internal set; }
public static Polar defaultPolar
{
get

View File

@@ -14,7 +14,7 @@ using UnityEngine.UI;
namespace XCharts
{
/// <summary>
/// Coordinate for radar charts.
/// Radar coordinate conponnet for radar charts.
/// 雷达图坐标系组件,只适用于雷达图。
/// </summary>
[System.Serializable]
@@ -30,15 +30,18 @@ namespace XCharts
Circle
}
/// <summary>
/// The position type of radar.
/// 显示位置。
/// </summary>
public enum PositionType
{
/// <summary>
/// Display at the vertex.
/// 显示在顶点处。
/// </summary>
Vertice,
/// <summary>
/// Display at the middle of line.
/// 显示在两者之间。
/// </summary>
Between,
@@ -56,6 +59,7 @@ namespace XCharts
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
/// <summary>
/// The name of indicator.
/// 指示器名称。
/// </summary>
public string name { get { return m_Name; } set { m_Name = value; } }
@@ -157,6 +161,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_Indicator, value)) SetComponentDirty(); }
}
/// <summary>
/// The gap of indicator and radar.
/// 指示器和雷达的间距。
/// </summary>
public float indicatorGap
@@ -165,6 +170,7 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_IndicatorGap, value)) SetComponentDirty(); }
}
/// <summary>
/// The ratio of maximum and minimum values rounded upward. The default is 0, which is automatically calculated.
/// 最大最小值向上取整的倍率。默认为0时自动计算。
/// </summary>
public int ceilRate
@@ -173,7 +179,8 @@ namespace XCharts
set { if (PropertyUtility.SetStruct(ref m_CeilRate, value < 0 ? 0 : value)) SetAllDirty(); }
}
/// <summary>
/// /// 显示位置类型。
/// The position type of indicator.
/// 显示位置类型。
/// </summary>
public PositionType positionType
{

View File

@@ -32,7 +32,7 @@ namespace XCharts
/// </summary>
public bool show { get { return m_Show; } set { if (PropertyUtility.SetStruct(ref m_Show, value)) SetComponentDirty(); } }
/// <summary>
/// The main title text, supporting for \n for newlines.
/// The main title text, supporting \n for newlines.
/// 主标题文本,支持使用 \n 换行。
/// </summary>
public string text { get { return m_Text; } set { if (PropertyUtility.SetClass(ref m_Text, value)) SetComponentDirty(); } }
@@ -44,6 +44,7 @@ namespace XCharts
[Obsolete("use textStyle instead.", true)]
public int textFontSize { get { return m_TextStyle.fontSize; } set { m_TextStyle.fontSize = value; } }
/// <summary>
/// The text style of main title.
/// 主标题文本样式。
/// </summary>
public TextStyle textStyle
@@ -61,6 +62,7 @@ namespace XCharts
set { if (PropertyUtility.SetClass(ref m_SubText, value)) SetComponentDirty(); }
}
/// <summary>
/// The text style of sub title.
/// 副标题文本样式。
/// </summary>
public TextStyle subTextStyle