mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 05:10:12 +00:00
整理组件结构
This commit is contained in:
35
Scripts/UI/Component/ChartComponent.cs
Normal file
35
Scripts/UI/Component/ChartComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class ChartComponent
|
||||
{
|
||||
[SerializeField] protected string m_JsonData;
|
||||
[SerializeField] protected bool m_DataFromJson;
|
||||
|
||||
/// <summary>
|
||||
/// json格式的字符串数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
if (m_DataFromJson)
|
||||
{
|
||||
ParseJsonData(m_JsonData);
|
||||
m_DataFromJson = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ParseJsonData(string json)
|
||||
{
|
||||
throw new Exception("no support yet");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Scripts/UI/Component/ChartComponent.cs.meta
Normal file
11
Scripts/UI/Component/ChartComponent.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0af5e768fe0e407cb5b023b37c41597
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,7 +11,7 @@ namespace XCharts
|
||||
/// 直角坐标系的坐标轴组件。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Axis : JsonDataSupport, IEquatable<Axis>
|
||||
public class Axis : MainComponent, IEquatable<Axis>
|
||||
{
|
||||
/// <summary>
|
||||
/// the type of axis.
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace XCharts
|
||||
/// <para>DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。</para>
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class DataZoom
|
||||
public class DataZoom : MainComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Generally dataZoom component zoom or roam coordinate system through data filtering
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace XCharts
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Grid : IEquatable<Grid>
|
||||
public class Grid : MainComponent, IEquatable<Grid>
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Left;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace XCharts
|
||||
/// 图例组件展现了不同系列的标记,颜色和名字。可以通过点击图例控制哪些系列不显示。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Legend : JsonDataSupport, IPropertyChanged, IEquatable<Legend>
|
||||
public class Legend : MainComponent, IPropertyChanged, IEquatable<Legend>
|
||||
{
|
||||
/// <summary>
|
||||
/// Selected mode of legend, which controls whether series can be toggled displaying by clicking legends.
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace XCharts
|
||||
/// 饼图的全局设置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Pie
|
||||
public class Pie : MainComponent
|
||||
{
|
||||
[SerializeField] private float m_TooltipExtraRadius;
|
||||
[SerializeField] private float m_SelectedOffset;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace XCharts
|
||||
/// 雷达图坐标系组件,只适用于雷达图。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Radar : JsonDataSupport, IEquatable<Radar>
|
||||
public class Radar : MainComponent, IEquatable<Radar>
|
||||
{
|
||||
/// <summary>
|
||||
/// Radar render type, in which 'Polygon' and 'Circle' are supported.
|
||||
@@ -168,7 +168,7 @@ namespace XCharts
|
||||
/// 雷达图的所有数据坐标点列表。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int,List<Vector3>> dataPosList = new Dictionary<int,List<Vector3>>();
|
||||
public Dictionary<int, List<Vector3>> dataPosList = new Dictionary<int, List<Vector3>>();
|
||||
|
||||
public static Radar defaultRadar
|
||||
{
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace XCharts
|
||||
/// 系列。每个系列通过 type 决定自己的图表类型。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Serie : JsonDataSupport
|
||||
public class Serie : MainComponent
|
||||
{
|
||||
[SerializeField] [DefaultValue("true")] private bool m_Show = true;
|
||||
[SerializeField] private SerieType m_Type;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts
|
||||
/// 系列列表。每个系列通过 type 决定自己的图表类型。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Series : JsonDataSupport
|
||||
public class Series : MainComponent
|
||||
{
|
||||
|
||||
[SerializeField] protected List<Serie> m_Series;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 全局参数设置组件。一般情况下可使用默认值,当有需要时可进行调整。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Settings
|
||||
public class Settings : MainComponent
|
||||
{
|
||||
[SerializeField] [Range(1, 10)] protected float m_LineSmoothStyle = 3f;
|
||||
[SerializeField] [Range(1f, 20)] protected float m_LineSmoothness = 2f;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace XCharts
|
||||
/// Theme.
|
||||
/// 主题相关配置。
|
||||
/// </summary>
|
||||
public class ThemeInfo : IEquatable<ThemeInfo>
|
||||
public class ThemeInfo : MainComponent, IEquatable<ThemeInfo>
|
||||
{
|
||||
[SerializeField] private Theme m_Theme = Theme.Default;
|
||||
[SerializeField] private Font m_Font;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 标题组件,包含主标题和副标题。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Title : IPropertyChanged, IEquatable<Title>
|
||||
public class Title : MainComponent, IPropertyChanged, IEquatable<Title>
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private string m_Text;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace XCharts
|
||||
/// 提示框组件
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Tooltip
|
||||
public class Tooltip : MainComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicator type.
|
||||
@@ -157,8 +157,8 @@ namespace XCharts
|
||||
var tooltip = new Tooltip
|
||||
{
|
||||
m_Show = true,
|
||||
xValues = new float[2]{-1,-1},
|
||||
yValues = new float[2]{-1,-1},
|
||||
xValues = new float[2] { -1, -1 },
|
||||
yValues = new float[2] { -1, -1 },
|
||||
dataIndex = new List<int>() { -1, -1 },
|
||||
lastDataIndex = new List<int>() { -1, -1 }
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace XCharts
|
||||
/// 视觉映射组件。用于进行『视觉编码』,也就是将数据映射到视觉元素(视觉通道)。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class VisualMap
|
||||
public class VisualMap : MainComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型。分为连续型和分段型。
|
||||
|
||||
6
Scripts/UI/Component/MainComponent.cs
Normal file
6
Scripts/UI/Component/MainComponent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace XCharts
|
||||
{
|
||||
public class MainComponent : ChartComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Scripts/UI/Component/MainComponent.cs.meta
Normal file
11
Scripts/UI/Component/MainComponent.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b05891df2284bc588cf6b668bfeb7b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 动画表现。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Animation
|
||||
public class Animation : SubComponent
|
||||
{
|
||||
public enum Easing
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 区域填充样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AreaStyle
|
||||
public class AreaStyle : SubComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Origin position of area.
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 坐标轴刻度标签的相关设置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisLabel
|
||||
public class AxisLabel : SubComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private string m_Formatter;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace XCharts
|
||||
/// 坐标轴的分隔线。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AxisLine
|
||||
public class AxisLine : SubComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private bool m_OnZero;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 坐标轴名称。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisName
|
||||
public class AxisName : SubComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// the location of axis name.
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts
|
||||
/// 坐标轴在 grid 区域中的分隔区域,默认不显示。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class AxisSplitArea
|
||||
public class AxisSplitArea : SubComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private List<Color> m_Color;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 坐标轴刻度相关设置。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class AxisTick
|
||||
public class AxisTick : SubComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private bool m_AlignWithLabel;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace XCharts
|
||||
/// 高亮的图形样式和文本标签样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Emphasis
|
||||
public class Emphasis : SubComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private SerieLabel m_Label = new SerieLabel();
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace XCharts
|
||||
/// 图形样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ItemStyle
|
||||
public class ItemStyle : SubComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 线的类型。
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class LineArrow
|
||||
public class LineArrow : SubComponent
|
||||
{
|
||||
public enum Position
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace XCharts
|
||||
/// 注: 修改 lineStyle 中的颜色不会影响图例颜色,如果需要图例颜色和折线图颜色一致,需修改 itemStyle.color,线条颜色默认也会取改颜色。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class LineStyle
|
||||
public class LineStyle : SubComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// 线的类型。
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace XCharts
|
||||
/// 位置类型。通过Align快速设置大体位置,再通过left,right,top,bottom微调具体位置。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Location : IPropertyChanged, IEquatable<Location>
|
||||
public class Location : SubComponent, IPropertyChanged, IEquatable<Location>
|
||||
{
|
||||
/// <summary>
|
||||
/// 对齐方式
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace XCharts
|
||||
/// 系列中的一个数据项。可存储数据名和1-n维的数据。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieData
|
||||
public class SerieData : SubComponent
|
||||
{
|
||||
[SerializeField] private string m_Name;
|
||||
[SerializeField] private bool m_Selected;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace XCharts
|
||||
/// 图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieLabel
|
||||
public class SerieLabel : SubComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// The position of label.
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace XCharts
|
||||
/// 系列数据项的标记的图形
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class SerieSymbol
|
||||
public class SerieSymbol : SubComponent
|
||||
{
|
||||
[SerializeField] private SerieSymbolType m_Type = SerieSymbolType.EmptyCircle;
|
||||
[SerializeField] private SerieSymbolSizeType m_SizeType = SerieSymbolSizeType.Custom;
|
||||
|
||||
6
Scripts/UI/Component/SubComponent.cs
Normal file
6
Scripts/UI/Component/SubComponent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace XCharts
|
||||
{
|
||||
public class SubComponent : ChartComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Scripts/UI/Component/SubComponent.cs.meta
Normal file
11
Scripts/UI/Component/SubComponent.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94e905091d07140de987a531a6ff90d9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user