mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 15:30:09 +00:00
3.0
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
@@ -33,11 +31,12 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
End
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private AreaOrigin m_Origin;
|
||||
[SerializeField] private Color32 m_Color;
|
||||
[SerializeField] private Color32 m_ToColor;
|
||||
[SerializeField] [Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
[SerializeField] private Color32 m_HighlightColor;
|
||||
[SerializeField] private Color32 m_HighlightToColor;
|
||||
|
||||
@@ -111,7 +110,7 @@ namespace XCharts.Runtime
|
||||
return m_Color;
|
||||
|
||||
var color = m_Color;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -124,7 +123,7 @@ namespace XCharts.Runtime
|
||||
else
|
||||
{
|
||||
var color = themeColor;
|
||||
color.a = (byte)(color.a * opacity);
|
||||
color.a = (byte) (color.a * opacity);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 高亮的图形样式和文本标签样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Emphasis : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private LabelStyle m_Label = new LabelStyle();
|
||||
[SerializeField] private LabelLine m_LabelLine = new LabelLine();
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Label.Reset();
|
||||
m_LabelLine.Reset();
|
||||
m_ItemStyle.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用高亮样式。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { m_Show = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形文本标签。
|
||||
/// </summary>
|
||||
public LabelStyle label
|
||||
{
|
||||
get { return m_Label; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Label, value, true)) SetAllDirty(); }
|
||||
}
|
||||
public LabelLine labelLine
|
||||
{
|
||||
get { return m_LabelLine; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelLine, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形样式。
|
||||
/// </summary>
|
||||
public ItemStyle itemStyle
|
||||
{
|
||||
get { return m_ItemStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_ItemStyle, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || label.vertsDirty || itemStyle.vertsDirty; } }
|
||||
|
||||
public override bool componentDirty { get { return m_ComponentDirty || label.componentDirty; } }
|
||||
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
label.ClearVerticesDirty();
|
||||
itemStyle.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
label.ClearComponentDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e0b1690532674b24952a87e0aead6fa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
public class EndLabelStyle : LabelStyle
|
||||
{
|
||||
public EndLabelStyle()
|
||||
{
|
||||
m_Offset = new Vector3(5, 0, 0);
|
||||
m_TextStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_NumericFormatter = "f0";
|
||||
m_Formatter = "{a}:{c}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3ca55f3ab0314339ae171c8ac07c4e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -20,6 +19,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
AboveText
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = false;
|
||||
[SerializeField] private Layer m_Layer;
|
||||
[SerializeField] private Align m_Align = Align.Left;
|
||||
@@ -115,4 +115,4 @@ namespace XCharts.Runtime
|
||||
autoHideWhenLabelEmpty = iconStyle.autoHideWhenLabelEmpty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -79,4 +78,4 @@ namespace XCharts.Runtime
|
||||
height = imageStyle.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_BorderColor;
|
||||
[SerializeField] private Color32 m_BorderColor0;
|
||||
[SerializeField] private Color32 m_BorderToColor;
|
||||
[SerializeField] [Range(0, 1)] private float m_Opacity = 1;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 1;
|
||||
[SerializeField] private string m_ItemMarker;
|
||||
[SerializeField] private string m_ItemFormatter;
|
||||
[SerializeField] private string m_NumericFormatter = "";
|
||||
@@ -237,7 +237,7 @@ namespace XCharts.Runtime
|
||||
return m_Color;
|
||||
|
||||
var color = m_Color;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ namespace XCharts.Runtime
|
||||
return m_ToColor;
|
||||
|
||||
var color = m_ToColor;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ namespace XCharts.Runtime
|
||||
return m_Color0;
|
||||
|
||||
var color = m_Color0;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace XCharts.Runtime
|
||||
if (m_Opacity == 1 || color.a == 0)
|
||||
return color;
|
||||
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace XCharts.Runtime
|
||||
if (m_Opacity == 1 || color.a == 0)
|
||||
return color;
|
||||
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace XCharts.Runtime
|
||||
if (m_Opacity == 1 || color.a == 0)
|
||||
return color;
|
||||
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace XCharts.Runtime
|
||||
if (m_Opacity == 1 || color.a == 0)
|
||||
return color;
|
||||
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (m_Opacity != 1)
|
||||
{
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
@@ -347,4 +347,4 @@ namespace XCharts.Runtime
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签的引导线
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class LabelLine : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签视觉引导线类型
|
||||
/// </summary>
|
||||
public enum LineType
|
||||
{
|
||||
/// <summary>
|
||||
/// 折线
|
||||
/// </summary>
|
||||
BrokenLine,
|
||||
/// <summary>
|
||||
/// 曲线
|
||||
/// </summary>
|
||||
Curves,
|
||||
/// <summary>
|
||||
/// 水平线
|
||||
/// </summary>
|
||||
HorizontalLine
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private LineType m_LineType = LineType.BrokenLine;
|
||||
[SerializeField] private Color32 m_LineColor = ChartConst.clearColor32;
|
||||
[SerializeField] private float m_LineAngle = 0;
|
||||
[SerializeField] private float m_LineWidth = 1.0f;
|
||||
[SerializeField] private float m_LineGap = 1.0f;
|
||||
[SerializeField] private float m_LineLength1 = 25f;
|
||||
[SerializeField] private float m_LineLength2 = 15f;
|
||||
[SerializeField] private SymbolStyle m_StartSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 };
|
||||
[SerializeField] private SymbolStyle m_EndSymbol = new SymbolStyle() { type = SymbolType.Circle, size = 3 };
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_LineType = LineType.BrokenLine;
|
||||
m_LineColor = Color.clear;
|
||||
m_LineAngle = 0;
|
||||
m_LineWidth = 1.0f;
|
||||
m_LineGap = 1.0f;
|
||||
m_LineLength1 = 25f;
|
||||
m_LineLength2 = 15f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the label line is showed.
|
||||
/// |是否显示视觉引导线。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the type of visual guide line.
|
||||
/// |视觉引导线类型。
|
||||
/// </summary>
|
||||
public LineType lineType
|
||||
{
|
||||
get { return m_LineType; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineType, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of visual guild line.
|
||||
/// |视觉引导线颜色。默认和serie一致取自调色板。
|
||||
/// </summary>
|
||||
public Color32 lineColor
|
||||
{
|
||||
get { return m_LineColor; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the angle of visual guild line.
|
||||
/// |视觉引导线的固定角度。对折线和曲线有效。
|
||||
/// </summary>
|
||||
public float lineAngle
|
||||
{
|
||||
get { return m_LineAngle; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineAngle, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of visual guild line.
|
||||
/// |视觉引导线的宽度。
|
||||
/// </summary>
|
||||
public float lineWidth
|
||||
{
|
||||
get { return m_LineWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the gap of container and guild line.
|
||||
/// |视觉引导线和容器的间距。
|
||||
/// </summary>
|
||||
public float lineGap
|
||||
{
|
||||
get { return m_LineGap; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineGap, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The length of the first segment of visual guide line.
|
||||
/// |视觉引导线第一段的长度。
|
||||
/// </summary>
|
||||
public float lineLength1
|
||||
{
|
||||
get { return m_LineLength1; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineLength1, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The length of the second segment of visual guide line.
|
||||
/// |视觉引导线第二段的长度。
|
||||
/// </summary>
|
||||
public float lineLength2
|
||||
{
|
||||
get { return m_LineLength2; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LineLength2, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The symbol of the start point of labelline.
|
||||
/// |起始点的图形标记。
|
||||
/// </summary>
|
||||
public SymbolStyle startSymbol
|
||||
{
|
||||
get { return m_StartSymbol; }
|
||||
set { if (PropertyUtil.SetClass(ref m_StartSymbol, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The symbol of the end point of labelline.
|
||||
/// |结束点的图形标记。
|
||||
/// </summary>
|
||||
public SymbolStyle endSymbol
|
||||
{
|
||||
get { return m_EndSymbol; }
|
||||
set { if (PropertyUtil.SetClass(ref m_EndSymbol, value)) SetVerticesDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c3977205b6f14d8a97ae32177691580
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,318 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Text label of chart, to explain some data information about graphic item like value, name and so on.
|
||||
/// |图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class LabelStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The position of label.
|
||||
/// |标签的位置。
|
||||
/// </summary>
|
||||
public enum Position
|
||||
{
|
||||
Default,
|
||||
/// <summary>
|
||||
/// Outside of sectors of pie chart, which relates to corresponding sector through visual guide line.
|
||||
/// |饼图扇区外侧,通过视觉引导线连到相应的扇区。
|
||||
/// </summary>
|
||||
Outside,
|
||||
/// <summary>
|
||||
/// Inside the sectors of pie chart.
|
||||
/// |饼图扇区内部。
|
||||
/// </summary>
|
||||
Inside,
|
||||
/// <summary>
|
||||
/// In the center of pie chart.
|
||||
/// |在饼图中心位置。
|
||||
/// </summary>
|
||||
Center,
|
||||
/// <summary>
|
||||
/// top of symbol.
|
||||
/// |图形标志的顶部。
|
||||
/// </summary>
|
||||
Top,
|
||||
/// <summary>
|
||||
/// the bottom of symbol.
|
||||
/// |图形标志的底部。
|
||||
/// </summary>
|
||||
Bottom,
|
||||
/// <summary>
|
||||
/// the left of symbol.
|
||||
/// |图形标志的左边。
|
||||
/// </summary>
|
||||
Left,
|
||||
/// <summary>
|
||||
/// the right of symbol.
|
||||
/// |图形标志的右边。
|
||||
/// </summary>
|
||||
Right,
|
||||
/// <summary>
|
||||
/// the start of line.
|
||||
/// |线的起始点。
|
||||
/// </summary>
|
||||
Start,
|
||||
/// <summary>
|
||||
/// the middle of line.
|
||||
/// |线的中点。
|
||||
/// </summary>
|
||||
Middle,
|
||||
/// <summary>
|
||||
/// the end of line.
|
||||
/// |线的结束点。
|
||||
/// </summary>
|
||||
End
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Default;
|
||||
[SerializeField] protected bool m_AutoOffset = false;
|
||||
[SerializeField] protected Vector3 m_Offset;
|
||||
[SerializeField] protected float m_Rotate;
|
||||
[SerializeField] protected float m_Distance;
|
||||
[SerializeField] protected string m_Formatter;
|
||||
[SerializeField] protected string m_NumericFormatter = "";
|
||||
[SerializeField] protected float m_Width = 0;
|
||||
[SerializeField] protected float m_Height = 0;
|
||||
|
||||
[SerializeField] protected IconStyle m_Icon = new IconStyle();
|
||||
[SerializeField] protected ImageStyle m_Background = new ImageStyle();
|
||||
[SerializeField] protected TextPadding m_TextPadding = new TextPadding();
|
||||
[SerializeField] protected TextStyle m_TextStyle = new TextStyle();
|
||||
protected LabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Position = Position.Default;
|
||||
m_Offset = Vector3.zero;
|
||||
m_Distance = 0;
|
||||
m_Rotate = 0;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
m_NumericFormatter = "";
|
||||
m_AutoOffset = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the label is showed.
|
||||
/// |是否显示文本标签。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The position of label.
|
||||
/// |标签的位置。
|
||||
/// </summary>
|
||||
public Position position
|
||||
{
|
||||
get { return m_Position; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Position, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 标签内容字符串模版格式器。支持用 \n 换行。
|
||||
/// 模板变量有:
|
||||
/// <list type="bullet">
|
||||
/// <item><description>{a}:系列名。</description></item>
|
||||
/// <item><description>{b}:数据名。</description></item>
|
||||
/// <item><description>{c}:数据值。</description></item>
|
||||
/// <item><description>{d}:百分比。</description></item>
|
||||
/// </list>
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// 示例:“{b}:{c}”
|
||||
/// </example>
|
||||
public string formatter
|
||||
{
|
||||
get { return m_Formatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Formatter, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// offset to the host graphic element.
|
||||
/// |距离图形元素的偏移
|
||||
/// </summary>
|
||||
public Vector3 offset
|
||||
{
|
||||
get { return m_Offset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Rotation of label.
|
||||
/// |文本的旋转。
|
||||
/// </summary>
|
||||
public float rotate
|
||||
{
|
||||
get { return m_Rotate; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 距离轴线的距离。
|
||||
/// </summary>
|
||||
public float distance
|
||||
{
|
||||
get { return m_Distance; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Distance, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the width of label. If set as default value 0, it means than the label width auto set as the text width.
|
||||
/// |标签的宽度。一般不用指定,不指定时则自动是文字的宽度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float width
|
||||
{
|
||||
get { return m_Width; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the height of label. If set as default value 0, it means than the label height auto set as the text height.
|
||||
/// |标签的高度。一般不用指定,不指定时则自动是文字的高度。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float height
|
||||
{
|
||||
get { return m_Height; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the text padding of label.
|
||||
/// |文本的边距。
|
||||
/// </summary>
|
||||
public TextPadding textPadding
|
||||
{
|
||||
get { return m_TextPadding; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextPadding, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Standard numeric format strings.
|
||||
/// |标准数字格式字符串。用于将数值格式化显示为字符串。
|
||||
/// 使用Axx的形式:A是格式说明符的单字符,支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明,从0-99。
|
||||
/// 参考:https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string numericFormatter
|
||||
{
|
||||
get { return m_NumericFormatter; }
|
||||
set { if (PropertyUtil.SetClass(ref m_NumericFormatter, value)) SetComponentDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。
|
||||
/// </summary>
|
||||
public bool autoOffset
|
||||
{
|
||||
get { return m_AutoOffset; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_AutoOffset, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of background.
|
||||
/// |背景图样式。
|
||||
/// </summary>
|
||||
public ImageStyle background
|
||||
{
|
||||
get { return m_Background; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Background, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of icon.
|
||||
/// |图标样式。
|
||||
/// </summary>
|
||||
public IconStyle icon
|
||||
{
|
||||
get { return m_Icon; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Icon, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the sytle of text.
|
||||
/// |文本样式。
|
||||
/// </summary>
|
||||
public TextStyle textStyle
|
||||
{
|
||||
get { return m_TextStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_TextStyle, value)) SetAllDirty(); }
|
||||
}
|
||||
public LabelFormatterFunction formatterFunction
|
||||
{
|
||||
get { return m_FormatterFunction; }
|
||||
set { m_FormatterFunction = value; }
|
||||
}
|
||||
|
||||
public bool IsInside()
|
||||
{
|
||||
return m_Position == Position.Inside || m_Position == Position.Center;
|
||||
}
|
||||
|
||||
public bool IsDefaultPosition(Position position)
|
||||
{
|
||||
return m_Position == Position.Default || m_Position == position;
|
||||
}
|
||||
|
||||
public bool IsAutoSize()
|
||||
{
|
||||
return width == 0 && height == 0;
|
||||
}
|
||||
|
||||
public Vector3 GetOffset(float radius)
|
||||
{
|
||||
var x = ChartHelper.GetActualValue(m_Offset.x, radius);
|
||||
var y = ChartHelper.GetActualValue(m_Offset.y, radius);
|
||||
var z = ChartHelper.GetActualValue(m_Offset.z, radius);
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public Color GetColor(Color defaultColor)
|
||||
{
|
||||
if (ChartHelper.IsClearColor(textStyle.color))
|
||||
{
|
||||
return IsInside() ? Color.black : defaultColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
return textStyle.color;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual LabelStyle Clone()
|
||||
{
|
||||
var label = new LabelStyle();
|
||||
label.m_Show = m_Show;
|
||||
label.m_Position = m_Position;
|
||||
label.m_Offset = m_Offset;
|
||||
label.m_Rotate = m_Rotate;
|
||||
label.m_Distance = m_Distance;
|
||||
label.m_Formatter = m_Formatter;
|
||||
label.m_Width = m_Width;
|
||||
label.m_Height = m_Height;
|
||||
label.m_NumericFormatter = m_NumericFormatter;
|
||||
label.m_AutoOffset = m_AutoOffset;
|
||||
label.m_Icon.Copy(m_Icon);
|
||||
label.m_Background.Copy(m_Background);
|
||||
label.m_TextPadding = m_TextPadding;
|
||||
label.m_TextStyle.Copy(m_TextStyle);
|
||||
return label;
|
||||
}
|
||||
|
||||
public virtual void Copy(LabelStyle label)
|
||||
{
|
||||
m_Show = label.m_Show;
|
||||
m_Position = label.m_Position;
|
||||
m_Offset = label.m_Offset;
|
||||
m_Rotate = label.m_Rotate;
|
||||
m_Distance = label.m_Distance;
|
||||
m_Formatter = label.m_Formatter;
|
||||
m_Width = label.m_Width;
|
||||
m_Height = label.m_Height;
|
||||
m_NumericFormatter = label.m_NumericFormatter;
|
||||
m_AutoOffset = label.m_AutoOffset;
|
||||
m_Icon.Copy(label.m_Icon);
|
||||
m_Background.Copy(label.m_Background);
|
||||
m_TextPadding = label.m_TextPadding;
|
||||
m_TextStyle.Copy(label.m_TextStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b2c690f282f04752898422894f61738
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -20,6 +19,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
Start
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private Position m_Position;
|
||||
[SerializeField]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
@@ -40,6 +38,7 @@ namespace XCharts.Runtime
|
||||
DashDotDot,
|
||||
None,
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Type m_Type = Type.Solid;
|
||||
[SerializeField] private Color32 m_Color;
|
||||
@@ -47,7 +46,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_ToColor2;
|
||||
[SerializeField] private float m_Width = 0;
|
||||
[SerializeField] private float m_Length = 0;
|
||||
[SerializeField] [Range(0, 1)] private float m_Opacity = 1;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Whether show line.
|
||||
@@ -123,8 +122,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public LineStyle()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
public LineStyle(float width)
|
||||
{
|
||||
@@ -172,7 +170,7 @@ namespace XCharts.Runtime
|
||||
return m_Color;
|
||||
|
||||
var color = m_Color;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -203,7 +201,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (m_Opacity != 1)
|
||||
{
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
color.a = (byte) (color.a * m_Opacity);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
@@ -232,7 +230,7 @@ namespace XCharts.Runtime
|
||||
else
|
||||
{
|
||||
var color = themeColor;
|
||||
color.a = (byte)(color.a * opacity);
|
||||
color.a = (byte) (color.a * opacity);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
#if dUI_TextMeshPro
|
||||
@@ -126,10 +125,10 @@ namespace XCharts.Runtime
|
||||
return new Location()
|
||||
{
|
||||
align = Align.CenterLeft,
|
||||
left = 0.03f,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
left = 0.03f,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -141,10 +140,10 @@ namespace XCharts.Runtime
|
||||
return new Location()
|
||||
{
|
||||
align = Align.CenterRight,
|
||||
left = 0,
|
||||
right = 0.03f,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
left = 0,
|
||||
right = 0.03f,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -156,10 +155,10 @@ namespace XCharts.Runtime
|
||||
return new Location()
|
||||
{
|
||||
align = Align.TopCenter,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0.03f,
|
||||
bottom = 0
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0.03f,
|
||||
bottom = 0
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -171,10 +170,10 @@ namespace XCharts.Runtime
|
||||
return new Location()
|
||||
{
|
||||
align = Align.BottomCenter,
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0.03f
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0.03f
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -319,4 +318,4 @@ namespace XCharts.Runtime
|
||||
UpdateAlign();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据项的其他基础数据。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieDataBaseInfo : ChildComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Ignore = false;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private float m_Radius;
|
||||
|
||||
/// <summary>
|
||||
/// 是否忽略数据。当为 true 时,数据不进行绘制。
|
||||
/// </summary>
|
||||
public bool ignore
|
||||
{
|
||||
get { return m_Ignore; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Ignore, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义半径。可用在饼图中自定义某个数据项的半径。
|
||||
/// </summary>
|
||||
public float radius { get { return m_Radius; } set { m_Radius = value; } }
|
||||
/// <summary>
|
||||
/// Whether the data item is selected.
|
||||
/// |该数据项是否被选中。
|
||||
/// </summary>
|
||||
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6d8757fbd847419aaed450e020e827c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -174,7 +173,7 @@ namespace XCharts.Runtime
|
||||
case SymbolSizeType.FromData:
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_DataScale;
|
||||
return (float) data[dataIndex] * m_DataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -183,7 +182,8 @@ namespace XCharts.Runtime
|
||||
case SymbolSizeType.Function:
|
||||
if (data != null && sizeFunction != null) return sizeFunction(data);
|
||||
else return size == 0 ? themeSize : size;
|
||||
default: return size == 0 ? themeSize : size;
|
||||
default:
|
||||
return size == 0 ? themeSize : size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace XCharts.Runtime
|
||||
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float)data[dataIndex] * m_SelectedDataScale;
|
||||
return (float) data[dataIndex] * m_SelectedDataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,7 +218,8 @@ namespace XCharts.Runtime
|
||||
else
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
default: return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
default:
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,4 +240,4 @@ namespace XCharts.Runtime
|
||||
return (dataIndex - startIndex) % (m_Interval + 1) == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -179,11 +178,10 @@ namespace XCharts.Runtime
|
||||
/// |带有涟漪特效动画的散点图的动画参数。
|
||||
/// </summary>
|
||||
public List<float> animationSize { get { return m_AnimationSize; } }
|
||||
|
||||
|
||||
public Color32 GetColor(Color32 defaultColor)
|
||||
{
|
||||
return ChartHelper.IsClearColor(m_Color) ? defaultColor : m_Color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -87,7 +86,6 @@ namespace XCharts.Runtime
|
||||
m_RelatedTextWidth = labelWidth;
|
||||
}
|
||||
|
||||
|
||||
public string GetLimitContent(string content)
|
||||
{
|
||||
float checkWidth = m_MaxWidth > 0 ? m_MaxWidth : m_RelatedTextWidth;
|
||||
@@ -123,9 +121,9 @@ namespace XCharts.Runtime
|
||||
int middle = content.Length / 2;
|
||||
int end = content.Length;
|
||||
float checkWidth = m_MaxWidth > 0 ? m_MaxWidth : m_RelatedTextWidth;
|
||||
|
||||
|
||||
float limit = checkWidth - m_Gap * 2 - suffixLen;
|
||||
if (limit < 0)
|
||||
if (limit < 0)
|
||||
return 0;
|
||||
|
||||
float len = 0;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -26,7 +25,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public void SetPadding(float top, float right, float bottom, float left)
|
||||
{
|
||||
m_Top = top; ;
|
||||
m_Top = top;;
|
||||
m_Right = right;
|
||||
m_Bottom = bottom;
|
||||
m_Left = left;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
#if dUI_TextMeshPro
|
||||
@@ -141,9 +140,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
#endif
|
||||
|
||||
public TextStyle()
|
||||
{
|
||||
}
|
||||
public TextStyle() { }
|
||||
|
||||
public TextStyle(int fontSize)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user