mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 15:30:09 +00:00
Merge branch 'master' into 3.0
This commit is contained in:
@@ -22,6 +22,7 @@ slug: /api
|
||||
- [AreaStyle](#areastyle)
|
||||
- [ArrowStyle](#arrowstyle)
|
||||
- [Axis](#axis)
|
||||
- [Axis3DHelper](#axis3dhelper)
|
||||
- [AxisAnimation](#axisanimation)
|
||||
- [AxisContext](#axiscontext)
|
||||
- [AxisHandler<T>](#axishandlert)
|
||||
@@ -67,6 +68,7 @@ slug: /api
|
||||
- [ComponentTheme](#componenttheme)
|
||||
- [CoordOptionsAttribute](#coordoptionsattribute)
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataHelper](#datahelper)
|
||||
- [DataZoom](#datazoom)
|
||||
- [DataZoomContext](#datazoomcontext)
|
||||
- [DataZoomHelper](#datazoomhelper)
|
||||
@@ -80,10 +82,12 @@ slug: /api
|
||||
- [EmphasisStyle](#emphasisstyle)
|
||||
- [EndLabelStyle](#endlabelstyle)
|
||||
- [FormatterHelper](#formatterhelper)
|
||||
- [Graph](#graph)
|
||||
- [GraphData](#graphdata)
|
||||
- [GraphEdge](#graphedge)
|
||||
- [GraphNode](#graphnode)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridCoord3D](#gridcoord3d)
|
||||
- [GridCoord3DContext](#gridcoord3dcontext)
|
||||
- [GridCoordContext](#gridcoordcontext)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [GridLayoutContext](#gridlayoutcontext)
|
||||
@@ -103,6 +107,7 @@ slug: /api
|
||||
- [ISimplifiedSerie](#isimplifiedserie)
|
||||
- [ItemStyle](#itemstyle)
|
||||
- [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
- [JsonUtil](#jsonutil)
|
||||
- [LabelLine](#labelline)
|
||||
- [LabelStyle](#labelstyle)
|
||||
- [Lang](#lang)
|
||||
@@ -119,6 +124,7 @@ slug: /api
|
||||
- [Line](#line)
|
||||
- [LineArrow](#linearrow)
|
||||
- [LineChart](#linechart)
|
||||
- [LineHelper](#linehelper)
|
||||
- [LineStyle](#linestyle)
|
||||
- [ListFor](#listfor)
|
||||
- [ListForComponent](#listforcomponent)
|
||||
@@ -225,12 +231,15 @@ slug: /api
|
||||
- [UIComponent](#uicomponent)
|
||||
- [UIComponentTheme](#uicomponenttheme)
|
||||
- [UIHelper](#uihelper)
|
||||
- [ViewControl](#viewcontrol)
|
||||
- [VisualMap](#visualmap)
|
||||
- [VisualMapContext](#visualmapcontext)
|
||||
- [VisualMapHelper](#visualmaphelper)
|
||||
- [VisualMapRange](#visualmaprange)
|
||||
- [VisualMapTheme](#visualmaptheme)
|
||||
- [Wrapper<T>](#wrappert)
|
||||
- [XAxis](#xaxis)
|
||||
- [XAxis3D](#xaxis3d)
|
||||
- [XChartsMgr](#xchartsmgr)
|
||||
- [XCResourceImporterWindow](#xcresourceimporterwindow)
|
||||
- [XCResourcesImporter](#xcresourcesimporter)
|
||||
@@ -238,6 +247,8 @@ slug: /api
|
||||
- [XCThemeMgr](#xcthememgr)
|
||||
- [XLog](#xlog)
|
||||
- [YAxis](#yaxis)
|
||||
- [YAxis3D](#yaxis3d)
|
||||
- [ZAxis3D](#zaxis3d)
|
||||
|
||||
|
||||
## AngleAxis
|
||||
@@ -390,7 +401,7 @@ the animation of serie. support animation type: fadeIn, fadeOut, change, additio
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)|
|
||||
|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)|
|
||||
|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)|
|
||||
|
||||
@@ -418,7 +429,7 @@ The style of area.
|
||||
|
||||
## Axis
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [AngleAxis](#angleaxis),[ParallelAxis](#parallelaxis),[RadiusAxis](#radiusaxis),[SingleAxis](#singleaxis),[XAxis](#xaxis),[YAxis](#yaxis)
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [AngleAxis](#angleaxis),[ParallelAxis](#parallelaxis),[RadiusAxis](#radiusaxis),[SingleAxis](#singleaxis),[XAxis](#xaxis),[XAxis3D](#xaxis3d),[YAxis](#yaxis),[YAxis3D](#yaxis3d),[ZAxis3D](#zaxis3d)
|
||||
|
||||
The axis in rectangular coordinate.
|
||||
|
||||
@@ -432,9 +443,10 @@ The axis in rectangular coordinate.
|
||||
|Clone()||public Axis Clone()|
|
||||
|Copy()||public void Copy(Axis axis)|
|
||||
|GetAddedDataCount()||public int GetAddedDataCount()<br/>get the history data count. |
|
||||
|GetCategoryPosition()||public Vector3 GetCategoryPosition(int categoryIndex, int dataCount = 0)|
|
||||
|GetData()||public string GetData(int index)<br/>获得指定索引的类目数据 |
|
||||
|GetData()||public string GetData(int index, DataZoom dataZoom)<br/>获得在dataZoom范围内指定索引的类目数据 |
|
||||
|GetDistance()||public float GetDistance(double value, float axisLength)<br/>获得值在坐标轴上的距离 |
|
||||
|GetDistance()||public float GetDistance(double value, float axisLength = 0)<br/>获得值在坐标轴上的距离 |
|
||||
|GetIcon()||public Sprite GetIcon(int index)|
|
||||
|GetLabelValue()||public double GetLabelValue(int index)|
|
||||
|GetLastLabelValue()||public double GetLastLabelValue()|
|
||||
@@ -452,12 +464,24 @@ The axis in rectangular coordinate.
|
||||
|IsTop()||public bool IsTop()|
|
||||
|IsValue()||public bool IsValue()<br/>是否为数值轴。 |
|
||||
|RemoveData()||public void RemoveData(int dataIndex)|
|
||||
|ResetStatus()||public override void ResetStatus()<br/>重置状态。 |
|
||||
|SetComponentDirty()||public override void SetComponentDirty()|
|
||||
|SetNeedUpdateFilterData()||public void SetNeedUpdateFilterData()|
|
||||
|UpdateData()||public void UpdateData(int index, string category)<br/>更新类目数据 |
|
||||
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)<br/>更新图标 |
|
||||
|UpdateZeroOffset()||public void UpdateZeroOffset(float axisLength)|
|
||||
|
||||
## Axis3DHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)|
|
||||
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)|
|
||||
|GetLabelPosition()||public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)|
|
||||
|
||||
## AxisAnimation
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
|
||||
@@ -710,7 +734,7 @@ Bar chart shows different data through the height of a bar, which is used in rec
|
||||
|AddData()||public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>Add a (x,y) data to serie. |
|
||||
|AddData()||public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
|AddData()||public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>Add an arbitray dimension data to serie,such as (x,y,z,...). |
|
||||
|AddLink()||public SerieDataLink AddLink(int serieIndex, string sourceName, string targetName, double value)<br/>Add a link data to serie. |
|
||||
|AddLink()||public SerieDataLink AddLink(int serieIndex, string sourceId, string targetId, double value = 0)<br/>Add a link data to serie. |
|
||||
|AddSerie<T>()||public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie|
|
||||
|AddXAxisData()||public void AddXAxisData(string category, int xAxisIndex = 0)<br/>Add a category data to xAxis. |
|
||||
|AddXAxisIcon()||public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>Add an icon to xAxis. |
|
||||
@@ -835,6 +859,7 @@ Bar chart shows different data through the height of a bar, which is used in rec
|
||||
|ResetChartStatus()|v3.10.0|public void ResetChartStatus()<br/>reset chart status. When some parameters are set, due to the animation effect, the chart status may not be correct. |
|
||||
|ResetDataIndex()||public bool ResetDataIndex(int serieIndex)<br/>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
|SetBasePainterMaterial()||public void SetBasePainterMaterial(Material material)<br/>设置Base Painter的材质球 |
|
||||
|SetInsertDataToHead()|v3.11.0|public void SetInsertDataToHead(bool insertDataToHead)<br/>set insert data to head. |
|
||||
|SetMaxCache()||public void SetMaxCache(int maxCache)<br/>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
|SetPainterActive()||public void SetPainterActive(int index, bool flag)|
|
||||
|SetSerieActive()||public void SetSerieActive(int serieIndex, bool active)<br/>Whether to show serie. |
|
||||
@@ -1170,7 +1195,7 @@ A candlestick chart is a style of financial chart used to describe price movemen
|
||||
|
||||
## ChildComponent
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle)
|
||||
> class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle)
|
||||
|
||||
|
||||
|public method|since|description|
|
||||
@@ -1268,10 +1293,15 @@ the comment mark style.
|
||||
|
||||
## CoordSystem
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord),[SingleAxisCoord](#singleaxiscoord)
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord),[SingleAxisCoord](#singleaxiscoord)
|
||||
|
||||
Coordinate system component.
|
||||
|
||||
## DataHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
## DataZoom
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent),[IUpdateRuntimeData](#iupdateruntimedata)
|
||||
@@ -1331,6 +1361,7 @@ DataZoom component is used for zooming a specific area, which enables user to in
|
||||
|GetDateTime()||public static DateTime GetDateTime(int timestamp)|
|
||||
|GetTimestamp()||public static int GetTimestamp()|
|
||||
|GetTimestamp()||public static int GetTimestamp(DateTime time)|
|
||||
|GetTimestamp()||public static int GetTimestamp(string dateTime)|
|
||||
|
||||
## DebugInfo
|
||||
|
||||
@@ -1410,7 +1441,7 @@ Configurations of emphasis state.
|
||||
|TrimAndReplaceLine()||public static string TrimAndReplaceLine(string content)|
|
||||
|TrimAndReplaceLine()||public static string TrimAndReplaceLine(StringBuilder sb)|
|
||||
|
||||
## Graph
|
||||
## GraphData
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
@@ -1419,13 +1450,16 @@ the data struct of graph.
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|AddEdge()||public GraphEdge AddEdge(string nodeId1, string nodeId2, double value)|
|
||||
|AddNode()||public GraphNode AddNode(string nodeId, string nodeName, int dataIndex)|
|
||||
|AddNode()||public GraphNode AddNode(string nodeId, string nodeName, int dataIndex, double value)|
|
||||
|BreadthFirstTraverse()||public void BreadthFirstTraverse(GraphNode startNode, System.Action<GraphNode> onTraverse)|
|
||||
|Clear()||public void Clear()|
|
||||
|DeepFirstTraverse()||public void DeepFirstTraverse(GraphNode startNode, System.Action<GraphNode> onTraverse)|
|
||||
|EachNode()||public void EachNode(System.Action<GraphNode> onEach)|
|
||||
|ExpandAllNodes()||public void ExpandAllNodes(bool flag, int level = -1)|
|
||||
|ExpandNode()||public void ExpandNode(string nodeId, bool flag)|
|
||||
|GetDepthNodes()||public List<List<GraphNode>> GetDepthNodes()|
|
||||
|GetEdge()||public GraphEdge GetEdge(string nodeId1, string nodeId2)|
|
||||
|GetExpandedNodesCount()||public static int GetExpandedNodesCount(List<GraphNode> nodes)|
|
||||
|GetMaxDepth()||public int GetMaxDepth()|
|
||||
|GetNode()||public GraphNode GetNode(string nodeId)|
|
||||
|GetNodeDepth()||// public int GetNodeDepth(GraphNode node)|
|
||||
@@ -1433,7 +1467,8 @@ the data struct of graph.
|
||||
|GetNodeDepth()||public int GetNodeDepth(GraphNode node, int recursiveCount = 0)|
|
||||
|GetNodesTotalValue()||public static double GetNodesTotalValue(List<GraphNode> nodes)|
|
||||
|GetRootNodes()||public List<GraphNode> GetRootNodes()|
|
||||
|Graph()||public Graph(bool directed)|
|
||||
|GraphData()||public GraphData(bool directed)|
|
||||
|IsAllNodeInZeroPosition()||public bool IsAllNodeInZeroPosition()|
|
||||
|Refresh()||public void Refresh()|
|
||||
|
||||
## GraphEdge
|
||||
@@ -1445,6 +1480,7 @@ The edge of graph.
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|GraphEdge()||public GraphEdge(GraphNode node1, GraphNode node2, double value)|
|
||||
|IsPointInEdge()||public bool IsPointInEdge(Vector2 point)|
|
||||
|
||||
## GraphNode
|
||||
|
||||
@@ -1454,7 +1490,10 @@ The node of graph.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|Expand()||public void Expand(bool flag)|
|
||||
|GraphNode()||public GraphNode(string id, string name, int dataIndex)|
|
||||
|IsAllInEdgesCollapsed()||public bool IsAllInEdgesCollapsed()|
|
||||
|IsAnyInEdgesExpanded()||public bool IsAnyInEdgesExpanded()|
|
||||
|ToString()||public override string ToString()|
|
||||
|
||||
## GridCoord
|
||||
@@ -1479,6 +1518,28 @@ Grid component.
|
||||
|NotAnyIntersect()|v3.10.0|public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>Determines whether a given line segment will not intersect the Grid boundary at all. |
|
||||
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
|
||||
|
||||
## GridCoord3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [CoordSystem](#coordsystem),[IUpdateRuntimeData](#iupdateruntimedata),[ISerieContainer](#iseriecontainer)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
Grid component.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|Clamp()||public void Clamp(ref Vector3 pos)<br/>Clamp the position of pos to the grid. |
|
||||
|Contains()||public bool Contains(Vector3 pos)<br/>Whether the given position is in the grid. |
|
||||
|IsLeft()||public bool IsLeft()<br/>The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
|
||||
|IsPointerEnter()||public bool IsPointerEnter()<br/>Whether the pointer is in the grid. |
|
||||
|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>Determines whether a given line segment will not intersect the Grid boundary at all. |
|
||||
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
|
||||
|
||||
## GridCoord3DContext
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
|
||||
## GridCoordContext
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponentContext](#maincomponentcontext)
|
||||
@@ -1629,7 +1690,7 @@ The interface for serie component.
|
||||
|
||||
## ISerieContainer
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord)
|
||||
> class in XCharts.Runtime / Subclasses: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord)
|
||||
|
||||
|
||||
## ISerieDataComponent
|
||||
@@ -1665,9 +1726,21 @@ The interface for serie data component.
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[ParallelCoord](#parallelcoord)
|
||||
> class in XCharts.Runtime / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord)
|
||||
|
||||
|
||||
## JsonUtil
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|GetJsonArray<T>()||public static T[] GetJsonArray<T>(string json)|
|
||||
|GetJsonObject<T>()||public static T GetJsonObject<T>(string json)|
|
||||
|GetWebJson<T>()||public static IEnumerator GetWebJson<T>(string url, Action<T[]> callback)|
|
||||
|GetWebJson<T>()||public static IEnumerator GetWebJson<T>(string url, Action<T> callback)|
|
||||
|
||||
## LabelLine
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent)
|
||||
@@ -1864,6 +1937,16 @@ Line chart relates all the data points symbol by broken lines, which is used to
|
||||
|DefaultStepLineChart()||public void DefaultStepLineChart()<br/>default step line chart. |
|
||||
|DefaultTimeLineChart()||public void DefaultTimeLineChart()<br/>default time line chart. |
|
||||
|
||||
## LineHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|GetDataAverageRate()||public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)|
|
||||
|GetLineWidth()||public static float GetLineWidth(ref bool interacting, Serie serie, float defaultWidth)|
|
||||
|
||||
## LineStyle
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent),[ISerieDataComponent](#iseriedatacomponent)
|
||||
@@ -1954,6 +2037,7 @@ Location type. Quick to set the general location.
|
||||
|CompareTo()||public int CompareTo(object obj)|
|
||||
|OnRemove()||public virtual void OnRemove()|
|
||||
|Reset()||public virtual void Reset() { }|
|
||||
|ResetStatus()||public virtual void ResetStatus() { }|
|
||||
|SetAllDirty()||public virtual void SetAllDirty()|
|
||||
|SetComponentDirty()||public virtual void SetComponentDirty()|
|
||||
|SetDefaultValue()||public virtual void SetDefaultValue() { }|
|
||||
@@ -1961,7 +2045,7 @@ Location type. Quick to set the general location.
|
||||
|
||||
## MainComponentContext
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
> class in XCharts.Runtime / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[GridCoord3DContext](#gridcoord3dcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
|
||||
|
||||
## MainComponentHandler
|
||||
@@ -2393,8 +2477,8 @@ Configurations of select state.
|
||||
|AddData()||public SerieData AddData(List<double> valueList, string dataName = null, string dataId = null)<br/>将一组数据添加到系列中。 如果数据只有一个,默认添加到维度Y中。 |
|
||||
|AddData()||public SerieData AddData(params double[] values)<br/>添加任意维数据到系列中。 |
|
||||
|AddExtraComponent<T>()||public T AddExtraComponent<T>() where T : ChildComponent, ISerieComponent|
|
||||
|AddLink()||public SerieDataLink AddLink(string sourceName, string targetName, double value)<br/>Add a link data. |
|
||||
|AddSerieData()||public void AddSerieData(SerieData serieData)|
|
||||
|AddLink()||public virtual SerieDataLink AddLink(string sourceId, string targetId, double value = 0)<br/>Add a link data. |
|
||||
|AddSerieData()||public virtual void AddSerieData(SerieData serieData)|
|
||||
|AddXYData()||public SerieData AddXYData(double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到维度X和维度Y |
|
||||
|AddYData()||public SerieData AddYData(double value, string dataName = null, string dataId = null)<br/>添加一个数据到维度Y(此时维度X对应的数据是索引) |
|
||||
|AnimationEnable()||public void AnimationEnable(bool flag)<br/>启用或取消初始动画 |
|
||||
@@ -3088,6 +3172,7 @@ Tooltip component.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|onClickIndex||public System.Action<int> onClickIndex<br/>the callback of tooltip click index. |
|
||||
|AddSerieDataIndex()||public void AddSerieDataIndex(int serieIndex, int dataIndex)|
|
||||
|ClearComponentDirty()||public override void ClearComponentDirty()|
|
||||
|ClearData()||public override void ClearData()|
|
||||
@@ -3213,6 +3298,7 @@ UGUI Graphics Library.
|
||||
|IsClearColor()||public static bool IsClearColor(Color32 color)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)|
|
||||
|IsPointInTriangle()||public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)|
|
||||
|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)|
|
||||
|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)|
|
||||
@@ -3252,6 +3338,14 @@ UI组件基类。
|
||||
|
||||
UI帮助类。
|
||||
|
||||
## ViewControl
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
View control component in 3D coordinate system.
|
||||
|
||||
## VisualMap
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent)
|
||||
@@ -3265,6 +3359,7 @@ VisualMap component. Mapping data to visual elements such as colors.
|
||||
|ClearComponentDirty()||public override void ClearComponentDirty()|
|
||||
|ClearVerticesDirty()||public override void ClearVerticesDirty()|
|
||||
|GetColor()||public Color32 GetColor(double value)|
|
||||
|GetColor()||public Color32 GetColor(double xValue, double yValue, double zValue, byte alpha = 255)|
|
||||
|GetIndex()||public int GetIndex(double value)|
|
||||
|GetValue()||public double GetValue(Vector3 pos, Rect chartRect)|
|
||||
|IsInRangeMaxRect()||public bool IsInRangeMaxRect(Vector3 local, Rect chartRect, float triangleLen)|
|
||||
@@ -3312,6 +3407,11 @@ VisualMap component. Mapping data to visual elements such as colors.
|
||||
|Copy()||public void Copy(VisualMapTheme theme)|
|
||||
|VisualMapTheme()||public VisualMapTheme(ThemeType theme) : base(theme)|
|
||||
|
||||
## Wrapper<T>
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
## XAxis
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
@@ -3322,6 +3422,18 @@ The x axis in cartesian(rectangular) coordinate.
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
|
||||
|
||||
## XAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
|
||||
|
||||
## XChartsMgr
|
||||
|
||||
> class in XCharts.Runtime
|
||||
@@ -3427,3 +3539,27 @@ The x axis in cartesian(rectangular) coordinate.
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
|
||||
|
||||
## YAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
|
||||
|
||||
## ZAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.11.0](#v3110)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
@@ -68,6 +69,42 @@
|
||||
|
||||
## master
|
||||
|
||||
## v3.11.0
|
||||
|
||||
Release Highlights:
|
||||
|
||||
* Added `Line3DChart` for 3D line charts
|
||||
* Added `GraphChart` for relationship graphs
|
||||
* Added support for 3D coordinate systems
|
||||
* Added `triggerOn` setting for `Tooltip` to define trigger conditions
|
||||
* Various bug fixes and optimizations
|
||||
|
||||
Changelog Details:
|
||||
|
||||
* (2024.06.16) Released version `v3.11.0`
|
||||
* (2024.06.15) Added buttons for adding, deleting, and moving data up and down under `Editor`
|
||||
* (2024.06.11) Fixed issue where `Axis`'s `IndicatorLabel` might overlap with `Tooltip`
|
||||
* (2024.06.11) Fixed issue where `Tooltip`'s `Axis` `IndicatorLabel` might not display when in `Cross` mode (#315)
|
||||
* (2024.06.10) Renamed `Tooltip`'s `Corss` to `Cross`
|
||||
* (2024.06.09) Added `minCategorySpacing` setting for `Axis` to define the default minimum category spacing
|
||||
* (2024.06.09) Fixed inaccurate indicator position of `Tooltip`'s `Cross` when `Axis` is a category axis and `DataZoom` is enabled
|
||||
* (2024.06.06) Fixed animation issue when `Serie` is cloned (#320)
|
||||
* (2024.06.04) Fixed issue where `Serie`'s `state` does not refresh when set dynamically via code
|
||||
* (2024.05.29) Adjusted the right-click menu of `XCharts` in the `Hierarchy` view to `UI/XCharts`
|
||||
* (2024.05.29) Added support for 3D coordinate systems to category axes
|
||||
* (2024.05.19) Optimized editing performance in `Editor`
|
||||
* (2024.05.09) Added utility class `JsonUtil`
|
||||
* (2024.05.01) Fixed the issue where `Tooltip` caused garbage collection (GC) on every frame (#311) (by @stefanbursuc)
|
||||
* (2024.04.23) Fixed chart exception issue after multiple calls to `ConvertXYAxis()`
|
||||
* (2024.04.22) Fixed potential incorrect retrieval of `GridCoord` when `DataZoom` controls multiple axes (#317)
|
||||
* (2024.04.22) Added 3D coordinate system
|
||||
* (2024.04.15) Optimized `DateTimeUtil` for timezone issues when converting timestamps to `DateTime`
|
||||
* (2024.04.15) Optimized `GridCoord` to display `Left` `Right` `Top` `Bottom` parameters even when `GridLayout` is enabled (#316)
|
||||
* (2024.04.14) Fixed incorrect label position of `Tooltip`'s `Cross` when `DataZoom` is enabled (#315)
|
||||
* (2024.04.12) Fixed incorrect effect of `Candlesticks` (#313)
|
||||
* (2024.03.20) Added `triggerOn` setting for `Tooltip` to define trigger conditions
|
||||
* (2024.03.19) Fixed color issue when setting `opacity` in `Pie`'s `ItemStyle` (#309)
|
||||
|
||||
## v3.10.2
|
||||
|
||||
* (2024.03.11) Release `v3.10.2`
|
||||
@@ -200,7 +237,7 @@ Log details:
|
||||
* (2023.08.22) Fixed `Bar` display hidden drawing performance exception
|
||||
* (2023.08.22) Improved Zebra histogram rendering performance (#276)
|
||||
* (2023.08.16) Added Daemon daemon to resolve an error after TMP is enabled locally
|
||||
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (by **Ambitroc**)
|
||||
* (2023.08.15) Fixed `Data` displaying axes incorrectly when data is between -1 and 1 (#273) (b y@Ambitroc)
|
||||
* (2023.08.14) Fixed `XCharts` updating error after` TextMeshPro `and` NewInputSystem `are enabled locally (#272)
|
||||
* (2023.08.12) Fixed `Chart` error when deleted at runtime (#269)
|
||||
* (2023.08.11) Fixed an issue where data could not be added when DataZoom was enabled
|
||||
@@ -241,7 +278,7 @@ Log details:
|
||||
|
||||
* (2022.06.08) Release v3.7.0
|
||||
* (2023.06.04) Added `HelpDoc` help document skip
|
||||
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by **svr2kos2**)
|
||||
* (2023.05.30) Fixed Serie name with `_` line causing `Legend` to not fire (#252) (by @svr2kos2)
|
||||
* (2023.05.10) Added `MinMaxAuto` range type for `Axis`
|
||||
* (2023.05.10) Added support for `Clip` for `Line`
|
||||
* (2023.05.04) Fixed `Axis` setting` CeilRate `not taking effect in range -1 to 1
|
||||
@@ -260,9 +297,9 @@ Log details:
|
||||
|
||||
* (2023.04.01) Release `v3.6.0` version
|
||||
* (2023.03.14) Fix for Tooltip's `titleFormater` setting `{b}` may not take effect
|
||||
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by **Ambitroc**)
|
||||
* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by @Ambitroc)
|
||||
* (2023.03.12) Added `LabelStyle` `autoRotate` to set automatic rotation of angled vertical text
|
||||
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by **Ambitroc**)
|
||||
* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by @Ambitroc)
|
||||
* (2023.03.09) Adds callbacks to Chart's `onSerieClick`, `onSerieDown`, `onSerieEnter` and `onSerieExit`
|
||||
* (2023.03.09) Fixed click-check offset for `Pie` not taking effect
|
||||
* (2023.03.04) Added Positions for Legend to customize legend positions
|
||||
@@ -276,7 +313,7 @@ Log details:
|
||||
* (2023.02.02) Fixed bug where datazoom xaxis label could be displayed off-chart when datazoom is turned on
|
||||
* (2023.02.02) Optimizes the `ignore` setting of `SerieData` to ignore data
|
||||
* (2023.02.01) Fix `XChartsMgr.ContainsChart()` interface exception
|
||||
* (2023.01.31) Added support for `InputSystem` (#242) (by **Bian-Sh**)
|
||||
* (2023.01.31) Added support for `InputSystem` (#242) (by @Bian-Sh)
|
||||
* (2023.01.11) Fixed chart not refreshing after removing Component from Inspector (#241)
|
||||
* (2023.01.06) Fixed bug with `Pie` displaying abnormal Label when the last few values are 0 (#240)
|
||||
* (2023.01.03) deletes serie `MarkColor` and adds ItemStyle `MarkColor`
|
||||
|
||||
@@ -56,6 +56,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataZoom](#datazoom)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridCoord3D](#gridcoord3d)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [Legend](#legend)
|
||||
- [MarkArea](#markarea)
|
||||
@@ -72,7 +73,10 @@ import APITable from '@site/src/components/APITable';
|
||||
- [Tooltip](#tooltip)
|
||||
- [VisualMap](#visualmap)
|
||||
- [XAxis](#xaxis)
|
||||
- [XAxis3D](#xaxis3d)
|
||||
- [YAxis](#yaxis)
|
||||
- [YAxis3D](#yaxis3d)
|
||||
- [ZAxis3D](#zaxis3d)
|
||||
|
||||
|
||||
## ChildComponent
|
||||
@@ -137,6 +141,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [TitleTheme](#titletheme)
|
||||
- [TooltipTheme](#tooltiptheme)
|
||||
- [UIComponentTheme](#uicomponenttheme)
|
||||
- [ViewControl](#viewcontrol)
|
||||
- [VisualMapRange](#visualmaprange)
|
||||
- [VisualMapTheme](#visualmaptheme)
|
||||
|
||||
@@ -194,6 +199,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [LangCandlestick](#langcandlestick)
|
||||
- [LangTime](#langtime)
|
||||
- [MainComponent](#maincomponent)
|
||||
- [Wrapper<T>](#wrappert)
|
||||
- [XCResourcesImporter](#xcresourcesimporter)
|
||||
- [XCSettings](#xcsettings)
|
||||
|
||||
@@ -385,7 +391,7 @@ The style of area.
|
||||
|
||||
## Axis
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [AngleAxis](#angleaxis), [ParallelAxis](#parallelaxis), [RadiusAxis](#radiusaxis), [SingleAxis](#singleaxis), [XAxis](#xaxis), [YAxis](#yaxis)
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [AngleAxis](#angleaxis), [ParallelAxis](#parallelaxis), [RadiusAxis](#radiusaxis), [SingleAxis](#singleaxis), [XAxis](#xaxis), [XAxis3D](#xaxis3d), [YAxis](#yaxis), [YAxis3D](#yaxis3d), [ZAxis3D](#zaxis3d)
|
||||
|
||||
The axis in rectangular coordinate.
|
||||
|
||||
@@ -402,7 +408,7 @@ The axis in rectangular coordinate.
|
||||
|gridIndex|||The index of the grid on which the axis are located, by default, is in the first grid.
|
||||
|polarIndex|||The index of the polar on which the axis are located, by default, is in the first polar.
|
||||
|parallelIndex|||The index of the parallel on which the axis are located, by default, is in the first parallel.
|
||||
|position|||the position of axis in grid.<br/>`Axis.AxisPosition`:<br/>- `Left`: the position of axis in grid.<br/>- `Right`: the position of axis in grid.<br/>- `Bottom`: the position of axis in grid.<br/>- `Top`: the position of axis in grid.<br/>|
|
||||
|position|||the position of axis in grid.<br/>`Axis.AxisPosition`:<br/>- `Left`: the position of axis in grid.<br/>- `Right`: the position of axis in grid.<br/>- `Bottom`: the position of axis in grid.<br/>- `Top`: the position of axis in grid.<br/>- `Center`: the position of axis in grid.<br/>|
|
||||
|offset|||the offset of axis from the default position. Useful when the same position has multiple axes.
|
||||
|min|||The minimun value of axis.Valid when `minMaxType` is `Custom`
|
||||
|max|||The maximum value of axis.Valid when `minMaxType` is `Custom`
|
||||
@@ -416,6 +422,7 @@ The axis in rectangular coordinate.
|
||||
|inverse|false||Whether the axis are reversed or not. Invalid in `Category` axis.
|
||||
|clockwise|true||Whether the positive position of axis is in clockwise. True for clockwise by default.
|
||||
|insertDataToHead|||Whether to add new data at the head or at the end of the list.
|
||||
|minCategorySpacing|0|v3.11.0|The minimum spacing between categories.
|
||||
|icons|||类目数据对应的图标。
|
||||
|data|||Category data, available in type: 'Category' axis.
|
||||
|axisLine|||axis Line. [AxisLine](#axisline)|
|
||||
@@ -606,6 +613,7 @@ Split line of axis in grid area.
|
||||
|autoColor|||auto color.
|
||||
|showStartLine|true|v3.3.0|Whether to show the first split line.
|
||||
|showEndLine|true|v3.3.0|Whether to show the last split line.
|
||||
|showZLine|true|v3.11.0|Whether to show the Z axis part of the split line. Generally used for 3D coordinate systems.
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
@@ -774,7 +782,7 @@ The style of border.
|
||||
|
||||
## ChildComponent
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle)
|
||||
> class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle)
|
||||
|
||||
## Comment
|
||||
|
||||
@@ -865,7 +873,7 @@ the comment mark style.
|
||||
|
||||
## CoordSystem
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord), [SingleAxisCoord](#singleaxiscoord)
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent) / Subclasses: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord), [SingleAxisCoord](#singleaxiscoord)
|
||||
|
||||
Coordinate system component.
|
||||
|
||||
@@ -1022,6 +1030,37 @@ Grid component.
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridCoord3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [CoordSystem](#coordsystem), [IUpdateRuntimeData](#iupdateruntimedata), [ISerieContainer](#iseriecontainer)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
Grid component.
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="GridCoord3D">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||Whether to show the grid in rectangular coordinate.
|
||||
|left|0.15f||Distance between grid component and the left side of the container.
|
||||
|right|0.2f||Distance between grid component and the right side of the container.
|
||||
|top|0.3f||Distance between grid component and the top side of the container.
|
||||
|bottom|0.15f||Distance between grid component and the bottom side of the container.
|
||||
|showBorder|false||Whether to show the grid border.
|
||||
|boxWidth|0.55f||The width of the box in the coordinate system.
|
||||
|boxHeight|0.4f||The height of the box in the coordinate system.
|
||||
|boxDepth|0.2f||The depth of the box in the coordinate system.
|
||||
|xYExchanged|false||
|
||||
|viewControl|||View control component in 3D coordinate system. [ViewControl](#viewcontrol)|
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridLayout
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
@@ -1177,7 +1216,7 @@ The interface for serie component.
|
||||
|
||||
## ISerieContainer
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord)
|
||||
> class in XCharts.Runtime / Subclasses: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord)
|
||||
|
||||
## ISerieDataComponent
|
||||
|
||||
@@ -1229,7 +1268,7 @@ The interface for serie data component.
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> class in XCharts.Runtime / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [ParallelCoord](#parallelcoord)
|
||||
> class in XCharts.Runtime / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord)
|
||||
|
||||
## LabelLine
|
||||
|
||||
@@ -2300,8 +2339,9 @@ Tooltip component.
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||Whether to show the tooltip component.
|
||||
|type|||Indicator type.<br/>`Tooltip.Type`:<br/>- `Line`: line indicator.<br/>- `Shadow`: shadow crosshair indicator.<br/>- `None`: no indicator displayed.<br/>- `Corss`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.<br/>- `Auto`: Auto select indicator according to serie type.<br/>|
|
||||
|type|||Indicator type.<br/>`Tooltip.Type`:<br/>- `Line`: line indicator.<br/>- `Shadow`: shadow crosshair indicator.<br/>- `None`: no indicator displayed.<br/>- `Cross`: crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.<br/>- `Auto`: Auto select indicator according to serie type.<br/>|
|
||||
|trigger|||Type of triggering.<br/>`Tooltip.Trigger`:<br/>- `Item`: Triggered by data item, which is mainly used for charts that don't have a category axis like scatter charts or pie charts.<br/>- `Axis`: Triggered by axes, which is mainly used for charts that have category axes, like bar charts or line charts.<br/>- `None`: Trigger nothing.<br/>- `Auto`: Auto select trigger according to serie type.<br/>|
|
||||
|triggerOn||v3.11.0|Condition of trigger tooltip.<br/>`Tooltip.TriggerOn`:<br/>- `MouseMove`: Trigger when mouse move.<br/>- `Click`: Trigger when mouse click.<br/>|
|
||||
|position||v3.3.0|Type of position.<br/>`Tooltip.Position`:<br/>- `Auto`: Auto. The mobile platform is displayed at the top, and the non-mobile platform follows the mouse position.<br/>- `Custom`: Custom. Fully customize display position (x,y).<br/>- `FixedX`: Just fix the coordinate X. Y follows the mouse position.<br/>- `FixedY`: <br/>|
|
||||
|itemFormatter|||a string template formatter for a single Serie or data item content. Support for wrapping lines with \n. Template variables are {.}, {a}, {b}, {c}, {d}.<br/> {.} is the dot of the corresponding color of a Serie that is currently indicated or whose index is 0.<br/> {a} is the series name of the serie that is currently indicated or whose index is 0.<br/> {b} is the name of the data item serieData that is currently indicated or whose index is 0, or a category value (such as the X-axis of a line chart).<br/> {c} is the value of a Y-dimension (dimesion is 1) from a Serie that is currently indicated or whose index is 0.<br/> {d} is the percentage value of Y-dimensions (dimesion is 1) from serie that is currently indicated or whose index is 0, with no % sign.<br/> {e} is the name of the data item serieData that is currently indicated or whose index is 0.<br/> {f} is sum of data.<br/> {y} is category value of y axis.<br/> {.1} represents a dot from serie corresponding color that specifies index as 1.<br/> 1 in {a1}, {b1}, {c1} represents a serie that specifies an index of 1.<br/> {c1:2} represents the third data from serie's current indication data item indexed to 1 (a data item has multiple data, index 2 represents the third data).<br/> {c1:2-2} represents the third data item from serie's third data item indexed to 1 (i.e., which data item must be specified to specify).<br/> {d1:2: F2} indicates that a formatted string with a value specified separately is F2 (numericFormatter is used when numericFormatter is not specified).<br/> {d:0.##} indicates that a formatted string with a value specified separately is 0.## (used for percentage, reserved 2 valid digits while avoiding the situation similar to "100.00%" when using f2 ).<br/> Example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1} : {c1:1-1: f1}"<br/>
|
||||
|titleFormatter|||String template formatter for tooltip title content. \n line wrapping is supported. The placeholder {i} can be set separately to indicate that title is ignored and not displayed. Template variables are {.}, {a}, {b}, {c}, {d}, {e}, {f}, and {g}. <br /> {.} is the dot of the corresponding color of serie currently indicated or index 0. <br /> {a} is the series name name of serie currently indicated or index 0. <br /> {b} is the name of the serie data item serieData currently indicated or index 0, or the category value (such as the X-axis of a line chart). <br /> {c} is the value of the serie y-dimension (dimesion is 1) currently indicated or index is 0. <br /> {d} is the serie y-dimensional (dimesion 1) percentage value of the currently indicated or index 0, note without the % sign. <br /> {e} is the name of the serie data item serieData currently indicated or whose index is 0. <br /> {h} is the hexadecimal color value of serieData for the serie data item currently indicated or index 0. <br /> {f} is the sum of data. <br /> {g} indicates the total number of data. <br /> {y} is category value of y axis. <br /> {.1} represents a dot of the corresponding color with serie specified as index 1. <br /> The 1 in {a1}, {b1}, {c1} represents serie where index is specified as 1. <br /> {c1:2} represents the third data of the current indicator data item in serie with index 1 (one data item has multiple data, index 2 represents the third data). <br /> {c1:2-2} represents the third data of serie third data item with index 1 (that is, the number of data items must be specified when specifying the number of data items). <br /> {d1:2:f2} indicates that a format string with a single value is f2 (numericFormatter is used if no value is specified). <br /> {d:0.##} indicates that the format string with a value specified alone is 0.## # (for percentages, preserving a 2-digit significant number while avoiding the "100.00%" situation with f2). <br /> example: "{a}, {c}", "{a1}, {c1: f1}", "{a1}, {c1:0: f1}", "{a1}, {c1:1-1: f1}"
|
||||
@@ -2376,6 +2416,28 @@ Tooltip component.
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## ViewControl
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
View control component in 3D coordinate system.
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="ViewControl">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|alpha|90f||The angle of the view in the x-z plane.
|
||||
|beta|55f||The angle of the view in the y-z plane.
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## VisualMap
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent)
|
||||
@@ -2460,12 +2522,24 @@ VisualMap component. Mapping data to visual elements such as colors.
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## Wrapper<T>
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
## XAxis
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
## XAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
## XCResourcesImporter
|
||||
|
||||
> class in XCharts.Runtime
|
||||
@@ -2527,3 +2601,19 @@ The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
## YAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
## ZAxis3D
|
||||
|
||||
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
|
||||
|
||||
> Since `v3.11.0`
|
||||
|
||||
The x axis in cartesian(rectangular) coordinate.
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ slug: /api
|
||||
- [AreaStyle](#areastyle)
|
||||
- [ArrowStyle](#arrowstyle)
|
||||
- [Axis](#axis)
|
||||
- [Axis3DHelper](#axis3dhelper)
|
||||
- [AxisAnimation](#axisanimation)
|
||||
- [AxisContext](#axiscontext)
|
||||
- [AxisHandler<T>](#axishandlert)
|
||||
@@ -67,6 +68,7 @@ slug: /api
|
||||
- [ComponentTheme](#componenttheme)
|
||||
- [CoordOptionsAttribute](#coordoptionsattribute)
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataHelper](#datahelper)
|
||||
- [DataZoom](#datazoom)
|
||||
- [DataZoomContext](#datazoomcontext)
|
||||
- [DataZoomHelper](#datazoomhelper)
|
||||
@@ -80,10 +82,12 @@ slug: /api
|
||||
- [EmphasisStyle](#emphasisstyle)
|
||||
- [EndLabelStyle](#endlabelstyle)
|
||||
- [FormatterHelper](#formatterhelper)
|
||||
- [Graph](#graph)
|
||||
- [GraphData](#graphdata)
|
||||
- [GraphEdge](#graphedge)
|
||||
- [GraphNode](#graphnode)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridCoord3D](#gridcoord3d)
|
||||
- [GridCoord3DContext](#gridcoord3dcontext)
|
||||
- [GridCoordContext](#gridcoordcontext)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [GridLayoutContext](#gridlayoutcontext)
|
||||
@@ -103,6 +107,7 @@ slug: /api
|
||||
- [ISimplifiedSerie](#isimplifiedserie)
|
||||
- [ItemStyle](#itemstyle)
|
||||
- [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
- [JsonUtil](#jsonutil)
|
||||
- [LabelLine](#labelline)
|
||||
- [LabelStyle](#labelstyle)
|
||||
- [Lang](#lang)
|
||||
@@ -119,6 +124,7 @@ slug: /api
|
||||
- [Line](#line)
|
||||
- [LineArrow](#linearrow)
|
||||
- [LineChart](#linechart)
|
||||
- [LineHelper](#linehelper)
|
||||
- [LineStyle](#linestyle)
|
||||
- [ListFor](#listfor)
|
||||
- [ListForComponent](#listforcomponent)
|
||||
@@ -225,12 +231,15 @@ slug: /api
|
||||
- [UIComponent](#uicomponent)
|
||||
- [UIComponentTheme](#uicomponenttheme)
|
||||
- [UIHelper](#uihelper)
|
||||
- [ViewControl](#viewcontrol)
|
||||
- [VisualMap](#visualmap)
|
||||
- [VisualMapContext](#visualmapcontext)
|
||||
- [VisualMapHelper](#visualmaphelper)
|
||||
- [VisualMapRange](#visualmaprange)
|
||||
- [VisualMapTheme](#visualmaptheme)
|
||||
- [Wrapper<T>](#wrappert)
|
||||
- [XAxis](#xaxis)
|
||||
- [XAxis3D](#xaxis3d)
|
||||
- [XChartsMgr](#xchartsmgr)
|
||||
- [XCResourceImporterWindow](#xcresourceimporterwindow)
|
||||
- [XCResourcesImporter](#xcresourcesimporter)
|
||||
@@ -238,6 +247,8 @@ slug: /api
|
||||
- [XCThemeMgr](#xcthememgr)
|
||||
- [XLog](#xlog)
|
||||
- [YAxis](#yaxis)
|
||||
- [YAxis3D](#yaxis3d)
|
||||
- [ZAxis3D](#zaxis3d)
|
||||
|
||||
|
||||
## AngleAxis
|
||||
@@ -390,7 +401,7 @@ slug: /api
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)|
|
||||
|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)|
|
||||
|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)|
|
||||
|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)|
|
||||
|
||||
@@ -418,7 +429,7 @@ slug: /api
|
||||
|
||||
## Axis
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [AngleAxis](#angleaxis),[ParallelAxis](#parallelaxis),[RadiusAxis](#radiusaxis),[SingleAxis](#singleaxis),[XAxis](#xaxis),[YAxis](#yaxis)
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [AngleAxis](#angleaxis),[ParallelAxis](#parallelaxis),[RadiusAxis](#radiusaxis),[SingleAxis](#singleaxis),[XAxis](#xaxis),[XAxis3D](#xaxis3d),[YAxis](#yaxis),[YAxis3D](#yaxis3d),[ZAxis3D](#zaxis3d)
|
||||
|
||||
直角坐标系的坐标轴组件。
|
||||
|
||||
@@ -432,9 +443,10 @@ slug: /api
|
||||
|Clone()||public Axis Clone()|
|
||||
|Copy()||public void Copy(Axis axis)|
|
||||
|GetAddedDataCount()||public int GetAddedDataCount()<br/>获得添加过的历史数据总数 |
|
||||
|GetCategoryPosition()||public Vector3 GetCategoryPosition(int categoryIndex, int dataCount = 0)|
|
||||
|GetData()||public string GetData(int index)<br/>获得指定索引的类目数据 |
|
||||
|GetData()||public string GetData(int index, DataZoom dataZoom)<br/>获得在dataZoom范围内指定索引的类目数据 |
|
||||
|GetDistance()||public float GetDistance(double value, float axisLength)<br/>获得值在坐标轴上的距离 |
|
||||
|GetDistance()||public float GetDistance(double value, float axisLength = 0)<br/>获得值在坐标轴上的距离 |
|
||||
|GetIcon()||public Sprite GetIcon(int index)|
|
||||
|GetLabelValue()||public double GetLabelValue(int index)|
|
||||
|GetLastLabelValue()||public double GetLastLabelValue()|
|
||||
@@ -452,12 +464,24 @@ slug: /api
|
||||
|IsTop()||public bool IsTop()|
|
||||
|IsValue()||public bool IsValue()<br/>是否为数值轴。 |
|
||||
|RemoveData()||public void RemoveData(int dataIndex)|
|
||||
|ResetStatus()||public override void ResetStatus()<br/>重置状态。 |
|
||||
|SetComponentDirty()||public override void SetComponentDirty()|
|
||||
|SetNeedUpdateFilterData()||public void SetNeedUpdateFilterData()|
|
||||
|UpdateData()||public void UpdateData(int index, string category)<br/>更新类目数据 |
|
||||
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)<br/>更新图标 |
|
||||
|UpdateZeroOffset()||public void UpdateZeroOffset(float axisLength)|
|
||||
|
||||
## Axis3DHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)|
|
||||
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)|
|
||||
|GetLabelPosition()||public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)|
|
||||
|
||||
## AxisAnimation
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
|
||||
@@ -710,7 +734,7 @@ slug: /api
|
||||
|AddData()||public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 |
|
||||
|AddData()||public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
|AddData()||public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 |
|
||||
|AddLink()||public SerieDataLink AddLink(int serieIndex, string sourceName, string targetName, double value)<br/>添加一个关系图的关系数据。 |
|
||||
|AddLink()||public SerieDataLink AddLink(int serieIndex, string sourceId, string targetId, double value = 0)<br/>添加一个关系图的关系数据。 |
|
||||
|AddSerie<T>()||public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie|
|
||||
|AddXAxisData()||public void AddXAxisData(string category, int xAxisIndex = 0)<br/>添加一个类目数据到指定的x轴。 |
|
||||
|AddXAxisIcon()||public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>添加一个图标到指定的x轴。 |
|
||||
@@ -835,6 +859,7 @@ slug: /api
|
||||
|ResetChartStatus()|v3.10.0|public void ResetChartStatus()<br/>重置图表状态。当设置某些参数后,由于动画影响,可能导致图表状态不正确,此时可以调用该接口重置图表状态。 |
|
||||
|ResetDataIndex()||public bool ResetDataIndex(int serieIndex)<br/>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
|SetBasePainterMaterial()||public void SetBasePainterMaterial(Material material)<br/>设置Base Painter的材质球 |
|
||||
|SetInsertDataToHead()|v3.11.0|public void SetInsertDataToHead(bool insertDataToHead)<br/>设置数据插入到头部。 |
|
||||
|SetMaxCache()||public void SetMaxCache(int maxCache)<br/>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
|SetPainterActive()||public void SetPainterActive(int index, bool flag)|
|
||||
|SetSerieActive()||public void SetSerieActive(int serieIndex, bool active)<br/>设置指定系列是否显示。 |
|
||||
@@ -1170,7 +1195,7 @@ slug: /api
|
||||
|
||||
## ChildComponent
|
||||
|
||||
> class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle)
|
||||
> class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle),[AxisAnimation](#axisanimation),[AxisName](#axisname),[AxisSplitArea](#axissplitarea),[AreaStyle](#areastyle),[ArrowStyle](#arrowstyle),[BaseLine](#baseline),[BorderStyle](#borderstyle),[IconStyle](#iconstyle),[ImageStyle](#imagestyle),[ItemStyle](#itemstyle),[Level](#level),[LevelStyle](#levelstyle),[LineArrow](#linearrow),[LineStyle](#linestyle),[Location](#location),[MLValue](#mlvalue),[MarqueeStyle](#marqueestyle),[Padding](#padding),[StageColor](#stagecolor),[SymbolStyle](#symbolstyle),[TextLimit](#textlimit),[TextStyle](#textstyle),[CommentItem](#commentitem),[CommentMarkStyle](#commentmarkstyle),[LabelLine](#labelline),[LabelStyle](#labelstyle),[MarkAreaData](#markareadata),[MarkLineData](#marklinedata),[StateStyle](#statestyle),[VisualMapRange](#visualmaprange),[ViewControl](#viewcontrol),[UIComponentTheme](#uicomponenttheme),[SerieData](#seriedata),[SerieDataLink](#seriedatalink),[ComponentTheme](#componenttheme),[SerieTheme](#serietheme),[ThemeStyle](#themestyle)
|
||||
|
||||
|
||||
|API|版本|描述|
|
||||
@@ -1268,10 +1293,15 @@ slug: /api
|
||||
|
||||
## CoordSystem
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord),[SingleAxisCoord](#singleaxiscoord)
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord),[SingleAxisCoord](#singleaxiscoord)
|
||||
|
||||
坐标系系统。
|
||||
|
||||
## DataHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
## DataZoom
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent),[IUpdateRuntimeData](#iupdateruntimedata)
|
||||
@@ -1331,6 +1361,7 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|GetDateTime()||public static DateTime GetDateTime(int timestamp)|
|
||||
|GetTimestamp()||public static int GetTimestamp()|
|
||||
|GetTimestamp()||public static int GetTimestamp(DateTime time)|
|
||||
|GetTimestamp()||public static int GetTimestamp(string dateTime)|
|
||||
|
||||
## DebugInfo
|
||||
|
||||
@@ -1410,7 +1441,7 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|TrimAndReplaceLine()||public static string TrimAndReplaceLine(string content)|
|
||||
|TrimAndReplaceLine()||public static string TrimAndReplaceLine(StringBuilder sb)|
|
||||
|
||||
## Graph
|
||||
## GraphData
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
@@ -1419,13 +1450,16 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|AddEdge()||public GraphEdge AddEdge(string nodeId1, string nodeId2, double value)|
|
||||
|AddNode()||public GraphNode AddNode(string nodeId, string nodeName, int dataIndex)|
|
||||
|AddNode()||public GraphNode AddNode(string nodeId, string nodeName, int dataIndex, double value)|
|
||||
|BreadthFirstTraverse()||public void BreadthFirstTraverse(GraphNode startNode, System.Action<GraphNode> onTraverse)|
|
||||
|Clear()||public void Clear()|
|
||||
|DeepFirstTraverse()||public void DeepFirstTraverse(GraphNode startNode, System.Action<GraphNode> onTraverse)|
|
||||
|EachNode()||public void EachNode(System.Action<GraphNode> onEach)|
|
||||
|ExpandAllNodes()||public void ExpandAllNodes(bool flag, int level = -1)|
|
||||
|ExpandNode()||public void ExpandNode(string nodeId, bool flag)|
|
||||
|GetDepthNodes()||public List<List<GraphNode>> GetDepthNodes()|
|
||||
|GetEdge()||public GraphEdge GetEdge(string nodeId1, string nodeId2)|
|
||||
|GetExpandedNodesCount()||public static int GetExpandedNodesCount(List<GraphNode> nodes)|
|
||||
|GetMaxDepth()||public int GetMaxDepth()|
|
||||
|GetNode()||public GraphNode GetNode(string nodeId)|
|
||||
|GetNodeDepth()||// public int GetNodeDepth(GraphNode node)|
|
||||
@@ -1433,7 +1467,8 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|GetNodeDepth()||public int GetNodeDepth(GraphNode node, int recursiveCount = 0)|
|
||||
|GetNodesTotalValue()||public static double GetNodesTotalValue(List<GraphNode> nodes)|
|
||||
|GetRootNodes()||public List<GraphNode> GetRootNodes()|
|
||||
|Graph()||public Graph(bool directed)|
|
||||
|GraphData()||public GraphData(bool directed)|
|
||||
|IsAllNodeInZeroPosition()||public bool IsAllNodeInZeroPosition()|
|
||||
|Refresh()||public void Refresh()|
|
||||
|
||||
## GraphEdge
|
||||
@@ -1445,6 +1480,7 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|GraphEdge()||public GraphEdge(GraphNode node1, GraphNode node2, double value)|
|
||||
|IsPointInEdge()||public bool IsPointInEdge(Vector2 point)|
|
||||
|
||||
## GraphNode
|
||||
|
||||
@@ -1454,7 +1490,10 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|Expand()||public void Expand(bool flag)|
|
||||
|GraphNode()||public GraphNode(string id, string name, int dataIndex)|
|
||||
|IsAllInEdgesCollapsed()||public bool IsAllInEdgesCollapsed()|
|
||||
|IsAnyInEdgesExpanded()||public bool IsAnyInEdgesExpanded()|
|
||||
|ToString()||public override string ToString()|
|
||||
|
||||
## GridCoord
|
||||
@@ -1479,6 +1518,28 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|NotAnyIntersect()|v3.10.0|public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>判断给定的线段是否与Grid边界是否完全不会相交。 |
|
||||
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
|
||||
|
||||
## GridCoord3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [CoordSystem](#coordsystem),[IUpdateRuntimeData](#iupdateruntimedata),[ISerieContainer](#iseriecontainer)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|Clamp()||public void Clamp(ref Vector3 pos)<br/>将位置限制在网格内。 |
|
||||
|Contains()||public bool Contains(Vector3 pos)<br/>给定的位置是否在网格内。 |
|
||||
|IsLeft()||public bool IsLeft()<br/>The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
|
||||
|IsPointerEnter()||public bool IsPointerEnter()<br/>指针是否在网格内。 |
|
||||
|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>判断给定的线段是否与Grid边界是否完全不会相交。 |
|
||||
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
|
||||
|
||||
## GridCoord3DContext
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
|
||||
## GridCoordContext
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
|
||||
@@ -1629,7 +1690,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## ISerieContainer
|
||||
|
||||
> class in XCharts.Runtime / 子类: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord)
|
||||
> class in XCharts.Runtime / 子类: [RadarCoord](#radarcoord),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord),[PolarCoord](#polarcoord)
|
||||
|
||||
|
||||
## ISerieDataComponent
|
||||
@@ -1665,9 +1726,21 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> class in XCharts.Runtime / 子类: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[ParallelCoord](#parallelcoord)
|
||||
> class in XCharts.Runtime / 子类: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[GridCoord3D](#gridcoord3d),[ParallelCoord](#parallelcoord)
|
||||
|
||||
|
||||
## JsonUtil
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|GetJsonArray<T>()||public static T[] GetJsonArray<T>(string json)|
|
||||
|GetJsonObject<T>()||public static T GetJsonObject<T>(string json)|
|
||||
|GetWebJson<T>()||public static IEnumerator GetWebJson<T>(string url, Action<T[]> callback)|
|
||||
|GetWebJson<T>()||public static IEnumerator GetWebJson<T>(string url, Action<T> callback)|
|
||||
|
||||
## LabelLine
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent)
|
||||
@@ -1864,6 +1937,16 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|DefaultStepLineChart()||public void DefaultStepLineChart()<br/>默认阶梯折线图。 |
|
||||
|DefaultTimeLineChart()||public void DefaultTimeLineChart()<br/>默认时间折线图。 |
|
||||
|
||||
## LineHelper
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|GetDataAverageRate()||public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)|
|
||||
|GetLineWidth()||public static float GetLineWidth(ref bool interacting, Serie serie, float defaultWidth)|
|
||||
|
||||
## LineStyle
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent),[ISerieDataComponent](#iseriedatacomponent)
|
||||
@@ -1954,6 +2037,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|CompareTo()||public int CompareTo(object obj)|
|
||||
|OnRemove()||public virtual void OnRemove()|
|
||||
|Reset()||public virtual void Reset() { }|
|
||||
|ResetStatus()||public virtual void ResetStatus() { }|
|
||||
|SetAllDirty()||public virtual void SetAllDirty()|
|
||||
|SetComponentDirty()||public virtual void SetComponentDirty()|
|
||||
|SetDefaultValue()||public virtual void SetDefaultValue() { }|
|
||||
@@ -1961,7 +2045,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## MainComponentContext
|
||||
|
||||
> class in XCharts.Runtime / 子类: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
> class in XCharts.Runtime / 子类: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[GridCoord3DContext](#gridcoord3dcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
|
||||
|
||||
## MainComponentHandler
|
||||
@@ -2393,8 +2477,8 @@ Radar coordinate conponnet for radar charts. 雷达图坐标系组件,只适
|
||||
|AddData()||public SerieData AddData(List<double> valueList, string dataName = null, string dataId = null)<br/>将一组数据添加到系列中。 如果数据只有一个,默认添加到维度Y中。 |
|
||||
|AddData()||public SerieData AddData(params double[] values)<br/>添加任意维数据到系列中。 |
|
||||
|AddExtraComponent<T>()||public T AddExtraComponent<T>() where T : ChildComponent, ISerieComponent|
|
||||
|AddLink()||public SerieDataLink AddLink(string sourceName, string targetName, double value)<br/>添加一个关系图的关系数据。 |
|
||||
|AddSerieData()||public void AddSerieData(SerieData serieData)|
|
||||
|AddLink()||public virtual SerieDataLink AddLink(string sourceId, string targetId, double value = 0)<br/>添加一个关系图的关系数据。 |
|
||||
|AddSerieData()||public virtual void AddSerieData(SerieData serieData)|
|
||||
|AddXYData()||public SerieData AddXYData(double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到维度X和维度Y |
|
||||
|AddYData()||public SerieData AddYData(double value, string dataName = null, string dataId = null)<br/>添加一个数据到维度Y(此时维度X对应的数据是索引) |
|
||||
|AnimationEnable()||public void AnimationEnable(bool flag)<br/>启用或取消初始动画 |
|
||||
@@ -3088,6 +3172,7 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|onClickIndex||public System.Action<int> onClickIndex<br/>Tooltip为Click触发时,点击的X轴索引的回调。 |
|
||||
|AddSerieDataIndex()||public void AddSerieDataIndex(int serieIndex, int dataIndex)|
|
||||
|ClearComponentDirty()||public override void ClearComponentDirty()|
|
||||
|ClearData()||public override void ClearData()|
|
||||
@@ -3213,6 +3298,7 @@ UGUI 图形库
|
||||
|IsClearColor()||public static bool IsClearColor(Color32 color)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)|
|
||||
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)|
|
||||
|IsPointInTriangle()||public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)|
|
||||
|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)|
|
||||
|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)|
|
||||
@@ -3252,6 +3338,14 @@ UI组件基类。
|
||||
|
||||
UI帮助类。
|
||||
|
||||
## ViewControl
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
3D视角控制组件。
|
||||
|
||||
## VisualMap
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
|
||||
@@ -3265,6 +3359,7 @@ UI帮助类。
|
||||
|ClearComponentDirty()||public override void ClearComponentDirty()|
|
||||
|ClearVerticesDirty()||public override void ClearVerticesDirty()|
|
||||
|GetColor()||public Color32 GetColor(double value)|
|
||||
|GetColor()||public Color32 GetColor(double xValue, double yValue, double zValue, byte alpha = 255)|
|
||||
|GetIndex()||public int GetIndex(double value)|
|
||||
|GetValue()||public double GetValue(Vector3 pos, Rect chartRect)|
|
||||
|IsInRangeMaxRect()||public bool IsInRangeMaxRect(Vector3 local, Rect chartRect, float triangleLen)|
|
||||
@@ -3312,6 +3407,11 @@ UI帮助类。
|
||||
|Copy()||public void Copy(VisualMapTheme theme)|
|
||||
|VisualMapTheme()||public VisualMapTheme(ThemeType theme) : base(theme)|
|
||||
|
||||
## Wrapper<T>
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
|
||||
## XAxis
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
@@ -3322,6 +3422,18 @@ UI帮助类。
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 x 轴。 |
|
||||
|
||||
## XAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 x 轴。
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 x 轴。 |
|
||||
|
||||
## XChartsMgr
|
||||
|
||||
> class in XCharts.Runtime
|
||||
@@ -3427,3 +3539,27 @@ UI帮助类。
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |
|
||||
|
||||
## YAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 y 轴。
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |
|
||||
|
||||
## ZAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 y 轴。
|
||||
|
||||
|API|版本|描述|
|
||||
|--|--|--|
|
||||
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ slug: /changelog
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.11.0](#v3110)
|
||||
[v3.10.2](#v3102)
|
||||
[v3.10.1](#v3101)
|
||||
[v3.10.0](#v3100)
|
||||
@@ -73,6 +74,40 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
## v3.11.0
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`Line3DChart`3D折线图
|
||||
* 增加`GraphChart`关系图
|
||||
* 增加`3D`坐标系支持
|
||||
* 增加`Tooltip`的`triggerOn`设置触发条件
|
||||
* 其他问题修复和优化
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2024.06.16) 发布`v3.11.0`版本
|
||||
* (2024.06.15) 增加`Editor`下`Data`的添加、删除、上下移动操作按钮
|
||||
* (2024.06.11) 修复`Axis`的`IndicatorLabel`可能会遮挡住`Tooltip`的问题
|
||||
* (2024.06.11) 修复`Tooltip`在`Cross`时`Axis`的`IndicatorLabel`可能不显示的问题 (#315)
|
||||
* (2024.06.10) 调整`Tooltip`的`Corss`重命名为`Cross`
|
||||
* (2024.06.09) 增加`Axis`的`minCategorySpacing`设置类目轴默认的最小类目间距
|
||||
* (2024.06.09) 修复`Tooltip`的`Cross`在`Axis`是类目轴并且开启`DataZoom`的情况下指示位置不准确的问题
|
||||
* (2024.06.06) 修复`Serie`在`Clone`时动画异常问题 (#320)
|
||||
* (2024.06.04) 修复`Serie`的`state`在代码动态设置时不刷新的问题
|
||||
* (2024.05.29) 调整`XCharts`在`Hierarchy`视图下的右键菜单到`UI/XCharts`下
|
||||
* (2024.05.29) 增加`3D`坐标系对类目轴的支持
|
||||
* (2024.05.19) 优化`Editor`下的编辑性能
|
||||
* (2024.05.09) 增加`JsonUtil`工具类
|
||||
* (2024.05.01) 修复`Tooltip`每帧产生GC的问题 (#311) (by @stefanbursuc)
|
||||
* (2024.04.23) 修复`ConvertXYAxis()`多次调用后图表异常的问题
|
||||
* (2024.04.22) 修复`DataZoom`控制多个轴时的`GridCoord`获取可能不正确的问题 (#317)
|
||||
* (2024.04.22) 增加`3D`坐标系
|
||||
* (2024.04.15) 优化`DateTimeUtil`时间戳转`DateTime`接口时区的问题
|
||||
* (2024.04.15) 优化`GridCoord`在开启`GridLayout`时也显示`Left` `Right` `Top` `Bottom`参数 (#316)
|
||||
* (2024.04.14) 修复`Tooltip`的`Cross`在开启`DataZoom`的情况下`label`位置不正确的问题 (#315)
|
||||
* (2024.04.12) 修复`Candlesticks`效果不对的问题 (#313)
|
||||
* (2024.03.20) 增加`Tooltip`的`triggerOn`设置触发条件
|
||||
* (2024.03.19) 修复`Pie`在设置`ItemStyle`的`opacity`时颜色不对的问题 (#309)
|
||||
|
||||
## v3.10.2
|
||||
@@ -207,7 +242,7 @@ slug: /changelog
|
||||
* (2023.08.22) 修复`Bar`显示隐藏时绘制表现异常的问题
|
||||
* (2023.08.22) 优化`Zebra`斑马柱图的绘制表现 (#276)
|
||||
* (2023.08.16) 增加`Daemon`守护程序,解决本地开启TMP后更新版本报错问题
|
||||
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by **Ambitroc**)
|
||||
* (2023.08.15) 修复`Data`数据在-1到1之间时坐标轴显示错误的问题 (#273) (by @Ambitroc)
|
||||
* (2023.08.14) 修复`XCharts`本地开启`TextMeshPro`和 `NewInputSystem`后更新版本会报错的问题 (#272)
|
||||
* (2023.08.12) 修复`Chart`在运行时被删除时会异常报错的问题 (#269)
|
||||
* (2023.08.11) 修复`DataZoom`开启时可能会导致无法添加数据的问题
|
||||
@@ -248,7 +283,7 @@ slug: /changelog
|
||||
|
||||
* (2023.06.08) 发布`v3.7.0`版本
|
||||
* (2023.06.04) 增加`HelpDoc`帮助文档跳转
|
||||
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by **svr2kos2**)
|
||||
* (2023.05.30) 修复`Serie`的名字带`_`线导致`Legend`无法触发的问题 (#259) (by @svr2kos2)
|
||||
* (2023.05.10) 增加`Axis`的`MinMaxAuto`范围类型
|
||||
* (2023.05.10) 增加`Line`对`Clip`的支持
|
||||
* (2023.05.04) 优化`Axis`在-1到1范围时设置`CeilRate`不生效的问题
|
||||
@@ -267,9 +302,9 @@ slug: /changelog
|
||||
|
||||
版本要点:
|
||||
|
||||
* 增加`InputSystem`支持 (by **Bian-Sh**)
|
||||
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by **SHL-COOL**)
|
||||
* 完善对`VR`的支持 (by **Ambitroc**)
|
||||
* 增加`InputSystem`支持 (by @Bian-Sh)
|
||||
* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by @SHL-COOL)
|
||||
* 完善对`VR`的支持 (by @Ambitroc)
|
||||
* 增加`UITable`,`UIStatistic`等[扩展UI组件](https://xcharts-team.github.io/docs/ui)
|
||||
* 增加`ItemStyle`的`MarkColor`
|
||||
* 增加通配符`{h}`的支持
|
||||
@@ -285,9 +320,9 @@ slug: /changelog
|
||||
|
||||
* (2023.04.01) 发布`v3.6.0`版本
|
||||
* (2023.03.14) 修复`Tooltip`的`titleFormater`设置`{b}`可能不生效的问题
|
||||
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by **Ambitroc**)
|
||||
* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by @Ambitroc)
|
||||
* (2023.03.12) 增加`LabelStyle`的`autoRotate`可设置有角度的竖版文本的自动旋转
|
||||
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by **Ambitroc**)
|
||||
* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by @Ambitroc)
|
||||
* (2023.03.09) 增加`Chart`的`onSerieClick`,`onSerieDown`,`onSerieEnter`和`onSerieExit`回调
|
||||
* (2023.03.09) 修复`Pie`的点击选中偏移不生效的问题
|
||||
* (2023.03.04) 增加`Legend`的`Positions`可自定义图例的位置
|
||||
@@ -301,7 +336,7 @@ slug: /changelog
|
||||
* (2023.02.02) 修复`DataZoom`开启时`X轴`的`Label`可能会显示在图表外的问题
|
||||
* (2023.02.02) 优化`SerieData`的`ignore`设置时的忽略数据判断
|
||||
* (2023.02.01) 修复`XChartsMgr.ContainsChart()`接口异常
|
||||
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by **Bian-Sh**)
|
||||
* (2023.01.31) 增加`InputSystem`的支持 (#242) (by @Bian-Sh)
|
||||
* (2023.01.11) 修复`Inspector`上移除`Component`后图表没有及时刷新的问题 (#241)
|
||||
* (2023.01.06) 修复`Pie`在最后的几个数据都为0时`Label`显示不正常的问题 (#240)
|
||||
* (2023.01.03) 删除`Serie`的`MarkColor`,增加`ItemStyle`的`MarkColor`
|
||||
|
||||
@@ -56,6 +56,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataZoom](#datazoom)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridCoord3D](#gridcoord3d)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [Legend](#legend)
|
||||
- [MarkArea](#markarea)
|
||||
@@ -72,7 +73,10 @@ import APITable from '@site/src/components/APITable';
|
||||
- [Tooltip](#tooltip)
|
||||
- [VisualMap](#visualmap)
|
||||
- [XAxis](#xaxis)
|
||||
- [XAxis3D](#xaxis3d)
|
||||
- [YAxis](#yaxis)
|
||||
- [YAxis3D](#yaxis3d)
|
||||
- [ZAxis3D](#zaxis3d)
|
||||
|
||||
|
||||
## ChildComponent 子组件
|
||||
@@ -137,6 +141,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [TitleTheme](#titletheme)
|
||||
- [TooltipTheme](#tooltiptheme)
|
||||
- [UIComponentTheme](#uicomponenttheme)
|
||||
- [ViewControl](#viewcontrol)
|
||||
- [VisualMapRange](#visualmaprange)
|
||||
- [VisualMapTheme](#visualmaptheme)
|
||||
|
||||
@@ -194,6 +199,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [LangCandlestick](#langcandlestick)
|
||||
- [LangTime](#langtime)
|
||||
- [MainComponent](#maincomponent)
|
||||
- [Wrapper<T>](#wrappert)
|
||||
- [XCResourcesImporter](#xcresourcesimporter)
|
||||
- [XCSettings](#xcsettings)
|
||||
|
||||
@@ -379,7 +385,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|
||||
## Axis
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [AngleAxis](#angleaxis), [ParallelAxis](#parallelaxis), [RadiusAxis](#radiusaxis), [SingleAxis](#singleaxis), [XAxis](#xaxis), [YAxis](#yaxis)
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [AngleAxis](#angleaxis), [ParallelAxis](#parallelaxis), [RadiusAxis](#radiusaxis), [SingleAxis](#singleaxis), [XAxis](#xaxis), [XAxis3D](#xaxis3d), [YAxis](#yaxis), [YAxis3D](#yaxis3d), [ZAxis3D](#zaxis3d)
|
||||
|
||||
直角坐标系的坐标轴组件。
|
||||
|
||||
@@ -395,7 +401,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|gridIndex|||坐标轴所在的 grid 的索引,默认位于第一个 grid。
|
||||
|polarIndex|||坐标轴所在的 ploar 的索引,默认位于第一个 polar。
|
||||
|parallelIndex|||坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
|
||||
|position|||坐标轴在Grid中的位置。<br/>`Axis.AxisPosition`:<br/>- `Left`: 坐标轴在Grid中的位置<br/>- `Right`: 坐标轴在Grid中的位置<br/>- `Bottom`: 坐标轴在Grid中的位置<br/>- `Top`: 坐标轴在Grid中的位置<br/>|
|
||||
|position|||坐标轴在Grid中的位置。<br/>`Axis.AxisPosition`:<br/>- `Left`: 坐标轴在Grid中的位置<br/>- `Right`: 坐标轴在Grid中的位置<br/>- `Bottom`: 坐标轴在Grid中的位置<br/>- `Top`: 坐标轴在Grid中的位置<br/>- `Center`: 坐标轴在Grid中的位置<br/>|
|
||||
|offset|||坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
|
||||
|min|||设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|
||||
|max|||设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
|
||||
@@ -409,6 +415,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|inverse|false||是否反向坐标轴。在类目轴中无效。
|
||||
|clockwise|true||刻度增长是否按顺时针,默认顺时针。
|
||||
|insertDataToHead|||添加新数据时是在列表的头部还是尾部加入。
|
||||
|minCategorySpacing|0|v3.11.0|类目之间的最小间距。
|
||||
|icons|||类目数据对应的图标。
|
||||
|data|||类目数据,在类目轴(type: 'category')中有效。
|
||||
|axisLine|||坐标轴轴线。 [AxisLine](#axisline)|
|
||||
@@ -591,6 +598,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|autoColor|||自动设置颜色。
|
||||
|showStartLine|true|v3.3.0|是否显示第一条分割线。
|
||||
|showEndLine|true|v3.3.0|是否显示最后一条分割线。
|
||||
|showZLine|true|v3.11.0|是否显示Z轴部分分割线。一般用于3D坐标系。
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
@@ -754,7 +762,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|
||||
## ChildComponent
|
||||
|
||||
> class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle)
|
||||
> class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle), [AxisAnimation](#axisanimation), [AxisName](#axisname), [AxisSplitArea](#axissplitarea), [AreaStyle](#areastyle), [ArrowStyle](#arrowstyle), [BaseLine](#baseline), [BorderStyle](#borderstyle), [IconStyle](#iconstyle), [ImageStyle](#imagestyle), [ItemStyle](#itemstyle), [Level](#level), [LevelStyle](#levelstyle), [LineArrow](#linearrow), [LineStyle](#linestyle), [Location](#location), [MLValue](#mlvalue), [MarqueeStyle](#marqueestyle), [Padding](#padding), [StageColor](#stagecolor), [SymbolStyle](#symbolstyle), [TextLimit](#textlimit), [TextStyle](#textstyle), [CommentItem](#commentitem), [CommentMarkStyle](#commentmarkstyle), [LabelLine](#labelline), [LabelStyle](#labelstyle), [MarkAreaData](#markareadata), [MarkLineData](#marklinedata), [StateStyle](#statestyle), [VisualMapRange](#visualmaprange), [ViewControl](#viewcontrol), [UIComponentTheme](#uicomponenttheme), [SerieData](#seriedata), [SerieDataLink](#seriedatalink), [ComponentTheme](#componenttheme), [SerieTheme](#serietheme), [ThemeStyle](#themestyle)
|
||||
|
||||
## Comment
|
||||
|
||||
@@ -841,7 +849,7 @@ import APITable from '@site/src/components/APITable';
|
||||
|
||||
## CoordSystem
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord), [SingleAxisCoord](#singleaxiscoord)
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent) / 子类: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord), [SingleAxisCoord](#singleaxiscoord)
|
||||
|
||||
坐标系系统。
|
||||
|
||||
@@ -993,6 +1001,36 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridCoord3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [CoordSystem](#coordsystem), [IUpdateRuntimeData](#iupdateruntimedata), [ISerieContainer](#iseriecontainer)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="GridCoord3D">
|
||||
```
|
||||
|
||||
|参数|默认|版本|描述|
|
||||
|--|--|--|--|
|
||||
|show|true||是否显示直角坐标系网格。
|
||||
|left|0.15f||grid 组件离容器左侧的距离。
|
||||
|right|0.2f||grid 组件离容器右侧的距离。
|
||||
|top|0.3f||grid 组件离容器上侧的距离。
|
||||
|bottom|0.15f||grid 组件离容器下侧的距离。
|
||||
|showBorder|false||是否显示网格边框。
|
||||
|boxWidth|0.55f||坐标系的宽度。
|
||||
|boxHeight|0.4f||坐标系的高度。
|
||||
|boxDepth|0.2f||坐标系的深度。
|
||||
|xYExchanged|false||
|
||||
|viewControl|||3D视角控制组件。 [ViewControl](#viewcontrol)|
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridLayout
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
@@ -1143,7 +1181,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## ISerieContainer
|
||||
|
||||
> class in XCharts.Runtime / 子类: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord)
|
||||
> class in XCharts.Runtime / 子类: [RadarCoord](#radarcoord), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord), [PolarCoord](#polarcoord)
|
||||
|
||||
## ISerieDataComponent
|
||||
|
||||
@@ -1194,7 +1232,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> class in XCharts.Runtime / 子类: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [ParallelCoord](#parallelcoord)
|
||||
> class in XCharts.Runtime / 子类: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [GridCoord3D](#gridcoord3d), [ParallelCoord](#parallelcoord)
|
||||
|
||||
## LabelLine
|
||||
|
||||
@@ -2229,11 +2267,12 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
||||
|参数|默认|版本|描述|
|
||||
|--|--|--|--|
|
||||
|show|true||是否显示提示框组件。
|
||||
|type|||提示框指示器类型。<br/>`Tooltip.Type`:<br/>- `Line`: 直线指示器<br/>- `Shadow`: 阴影指示器<br/>- `None`: 无指示器<br/>- `Corss`: 十字准星指示器。坐标轴显示Label和交叉线。<br/>- `Auto`: 根据serie的类型自动选择显示指示器。<br/>|
|
||||
|type|||提示框指示器类型。<br/>`Tooltip.Type`:<br/>- `Line`: 直线指示器<br/>- `Shadow`: 阴影指示器<br/>- `None`: 无指示器<br/>- `Cross`: 十字准星指示器。坐标轴显示Label和交叉线。<br/>- `Auto`: 根据serie的类型自动选择显示指示器。<br/>|
|
||||
|trigger|||触发类型。<br/>`Tooltip.Trigger`:<br/>- `Item`: 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。<br/>- `Axis`: 坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。<br/>- `None`: 什么都不触发。<br/>- `Auto`: 根据serie的类型自动选择触发类型。<br/>|
|
||||
|triggerOn||v3.11.0|触发条件。<br/>`Tooltip.TriggerOn`:<br/>- `MouseMove`: 鼠标移动时触发。<br/>- `Click`: 鼠标点击时触发。<br/>|
|
||||
|position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>|
|
||||
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {i}或-表示忽略当前项。 {.}为当前所指示的serie或数据项的对应颜色的圆点。<br/> {a}为当前所指示的serie或数据项的系列名name。<br/> {b}为当前所指示的serie或数据项的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示的serie或数据项的y维(dimesion为1)的数值。<br/> {d}为当前所指示的serie或数据项的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示的serie或数据项的数据项serieData的name。<br/> {f}为当前所指示的serie的默认维度的数据总和。<br/> {g}为当前所指示的serie的数据总个数。<br/> {h}为当前所指示的serie的十六进制颜色值。<br/> {y}为当前所指示的serie的y轴的类目值。<br/> {c0}表示当前数据项维度为0的数据。<br/> {c1}表示当前数据项维度为1的数据。<br/> {d3}表示维度3的数据的百分比。它的分母是默认维度(一般是1维度)数据。<br/> |表示多个列的分隔。<br/> 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}", "{.}|{b}|{y}"
|
||||
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {f}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {y}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|
||||
|marker|||serie的符号标志。
|
||||
|fixedWidth|0||固定宽度。比 minWidth 优先。
|
||||
|fixedHeight|0||固定高度。比 minHeight 优先。
|
||||
@@ -2303,6 +2342,27 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## ViewControl
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
3D视角控制组件。
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="ViewControl">
|
||||
```
|
||||
|
||||
|参数|默认|版本|描述|
|
||||
|--|--|--|--|
|
||||
|alpha|90f||视角在x-z平面的角度。
|
||||
|beta|55f||视角在y-z平面的角度。
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## VisualMap
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
|
||||
@@ -2384,12 +2444,24 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## Wrapper<T>
|
||||
|
||||
> class in XCharts.Runtime
|
||||
|
||||
## XAxis
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
直角坐标系 grid 中的 x 轴。
|
||||
|
||||
## XAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 x 轴。
|
||||
|
||||
## XCResourcesImporter
|
||||
|
||||
> class in XCharts.Runtime
|
||||
@@ -2450,3 +2522,19 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|
||||
|
||||
直角坐标系 grid 中的 y 轴。
|
||||
|
||||
## YAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 y 轴。
|
||||
|
||||
## ZAxis3D
|
||||
|
||||
> class in XCharts.Runtime / 继承自: [Axis](#axis)
|
||||
|
||||
> 从 `v3.11.0` 开始支持
|
||||
|
||||
直角坐标系 grid 中的 y 轴。
|
||||
|
||||
|
||||
@@ -79,11 +79,14 @@ slug: /support
|
||||
| 102 | [漏斗图](https://xcharts-team.github.io/docs/funnel) |FunnelChart | 98¥ |
|
||||
| 103 | [3D金字塔](https://xcharts-team.github.io/docs/pyramid) |PyramidChart | 98¥ |
|
||||
| 104 | [树形矩图](https://xcharts-team.github.io/docs/treemap) |TreemapChart | 98¥ |
|
||||
| 105 | [桑基图](https://xcharts-team.github.io/docs/sankey) |SankeyChart | 98¥ |
|
||||
| 201 | [3D柱图](https://xcharts-team.github.io/docs/bar3d) |Bar3DChart | 198¥ |
|
||||
| 202 | [3D饼图](https://xcharts-team.github.io/docs/pie3d) |Pie3DChart | 198¥ |
|
||||
| 203 | [甘特图](https://xcharts-team.github.io/docs/gantt) |GanttChart | 198¥ |
|
||||
| 204 | [仪表盘](https://xcharts-team.github.io/docs/gauge) |GaugeChart | 198¥ |
|
||||
| 205 | [水位图](https://xcharts-team.github.io/docs/liquid) |LiquidChart | 198¥ |
|
||||
| 206 | [3D折线图](https://xcharts-team.github.io/docs/line3d) |Line3DChart | 198¥ |
|
||||
| 207 | [关系图](https://xcharts-team.github.io/docs/graph) |GraphChart | 198¥ |
|
||||
|
||||
扩展图表的在线效果图也可以查看[WebGL在线Demo](https://xcharts-team.github.io/examples/)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ XCharts可通过以下任意一种方式导入到项目:
|
||||
|
||||
## 添加一个简单图表
|
||||
|
||||
在`Hierarchy`视图下右键或菜单栏`GameObject`下拉选择`XCharts->LineChart`,即可快速创建一个默认的折线图出来:
|
||||
在`Hierarchy`视图下右键`UI->XCharts->LineChart`或菜单栏`GameObject`下拉选择`XCharts->LineChart`,即可快速创建一个默认的折线图出来:
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_ShowStartLine");
|
||||
PropertyField(prop, "m_ShowEndLine");
|
||||
PropertyField(prop, "m_ShowZLine");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
23
Editor/ChildComponents/ViewControlDrawer.cs
Normal file
23
Editor/ChildComponents/ViewControlDrawer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ViewControl), true)]
|
||||
public class ViewControlDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "ViewControl"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Alpha");
|
||||
PropertyField(prop, "m_Beta");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1d778205a63524227a09c7e5b0e8736f
|
||||
guid: faeb8611591ee4c038e88fdb5a67b5ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -64,6 +64,7 @@ namespace XCharts.Editor
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
PropertyField("m_MaxCache");
|
||||
PropertyField("m_MinCategorySpacing");
|
||||
PropertyField("m_BoundaryGap");
|
||||
}
|
||||
else
|
||||
@@ -106,6 +107,15 @@ namespace XCharts.Editor
|
||||
[ComponentEditor(typeof(YAxis))]
|
||||
public class YAxisEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(XAxis3D))]
|
||||
public class XAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(YAxis3D))]
|
||||
public class YAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(ZAxis3D))]
|
||||
public class ZAxis3DEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(SingleAxis))]
|
||||
public class SingleAxisEditor : AxisEditor
|
||||
{
|
||||
|
||||
23
Editor/MainComponents/GridCoord3DEditor.cs
Normal file
23
Editor/MainComponents/GridCoord3DEditor.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(GridCoord3D))]
|
||||
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_BoxWidth");
|
||||
PropertyField("m_BoxHeight");
|
||||
PropertyField("m_BoxDepth");
|
||||
PropertyField("m_XYExchanged");
|
||||
PropertyField("m_ShowBorder");
|
||||
PropertyField("m_ViewControl");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/GridCoord3DEditor.cs.meta
Normal file
11
Editor/MainComponents/GridCoord3DEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9a4a8a30b1124c4e996e234d5717a07
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,13 +11,10 @@ namespace XCharts.Editor
|
||||
++EditorGUI.indentLevel;
|
||||
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
|
||||
PropertyField("m_LayoutIndex");
|
||||
if (layoutIndex < 0)
|
||||
{
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
PropertyField("m_Bottom");
|
||||
}
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_BackgroundColor");
|
||||
PropertyField("m_ShowBorder");
|
||||
PropertyField("m_BorderWidth");
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace XCharts.Editor
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Type");
|
||||
PropertyField("m_Trigger");
|
||||
PropertyField("m_TriggerOn");
|
||||
PropertyField("m_Position");
|
||||
PropertyField("m_FixedX");
|
||||
PropertyField("m_FixedY");
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
public class SerieBaseEditor
|
||||
{
|
||||
internal BaseChart chart { get; private set; }
|
||||
internal Serie serie { get; private set; }
|
||||
public BaseChart chart { get; private set; }
|
||||
public Serie serie { get; private set; }
|
||||
|
||||
//Editor m_Inspector;
|
||||
internal SerializedProperty baseProperty;
|
||||
|
||||
@@ -53,14 +53,18 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private HeaderMenuInfo headMenuInfo = new HeaderMenuInfo("Import ECharts Data", null);
|
||||
|
||||
private void HeadMenuInfoCallback()
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}
|
||||
|
||||
private void PropertyFieldData()
|
||||
{
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Data", () =>
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
headMenuInfo.action = HeadMenuInfoCallback;
|
||||
m_DataFoldout = ChartEditorHelper.DrawHeader("Data", m_DataFoldout, false, null, null, headMenuInfo);
|
||||
if (!m_DataFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Datas = FindProperty("m_Data");
|
||||
@@ -103,14 +107,18 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
private HeaderMenuInfo linkHeadMenuInfo = new HeaderMenuInfo("Import ECharts Link", null);
|
||||
|
||||
private void LinkHeadMenuInfoCallback()
|
||||
{
|
||||
PraseExternalDataEditor.UpdateData(chart, serie, null, false);
|
||||
PraseExternalDataEditor.ShowWindow();
|
||||
}
|
||||
|
||||
protected void PropertyFieldLinks()
|
||||
{
|
||||
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null,
|
||||
new HeaderMenuInfo("Import ECharts Link", () =>
|
||||
{
|
||||
//PraseExternalDataEditor.UpdateData(chart, serie, null, true);
|
||||
//PraseExternalDataEditor.ShowWindow();
|
||||
}));
|
||||
linkHeadMenuInfo.action = LinkHeadMenuInfoCallback;
|
||||
m_LinksFoldout = ChartEditorHelper.DrawHeader("Links", m_LinksFoldout, false, null, null, linkHeadMenuInfo);
|
||||
if (!m_LinksFoldout) return;
|
||||
EditorGUI.indentLevel++;
|
||||
var m_Links = FindProperty("m_Links");
|
||||
@@ -154,6 +162,84 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieDataHeader(Rect drawRect, HeaderCallbackContext context)
|
||||
{
|
||||
var serieData = context.serieData;
|
||||
var fieldCount = context.fieldCount;
|
||||
var showName = context.showName;
|
||||
var index = context.index;
|
||||
var dimension = context.dimension;
|
||||
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
var buttomLength = 30;
|
||||
#else
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
var buttomLength = 30;
|
||||
#endif
|
||||
if (showName)
|
||||
{
|
||||
buttomLength += 12;
|
||||
}
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX - buttomLength;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
else
|
||||
{
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = currentWidth - (startX + 20.5f + 1) - buttomLength;
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 0;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
drawRect.x = lastX;
|
||||
drawRect.width = lastWid;
|
||||
ChartEditorHelper.UpDownAddDeleteButton(drawRect, context.listProp, index);
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSerieData(int dimension, SerializedProperty m_Datas, int index, bool showName)
|
||||
{
|
||||
bool flag;
|
||||
@@ -165,70 +251,16 @@ namespace XCharts.Editor
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
|
||||
delegate (Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
var maxX = drawRect.xMax;
|
||||
var currentWidth = drawRect.width;
|
||||
var lastX = drawRect.x;
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
//var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
var gap = 2;
|
||||
var namegap = 3;
|
||||
#else
|
||||
var gap = 0;
|
||||
var namegap = 0;
|
||||
#endif
|
||||
if (fieldCount <= 1)
|
||||
{
|
||||
while (2 > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(1);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
drawRect.x = startX;
|
||||
drawRect.xMax = maxX;
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
else
|
||||
{
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 0;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
while (dataCount > data.arraySize)
|
||||
{
|
||||
var value = data.arraySize == 0 ? index : 0;
|
||||
data.arraySize++;
|
||||
data.GetArrayElementAtIndex(data.arraySize - 1).floatValue = value;
|
||||
}
|
||||
drawRect.x = startX + i * xWid;
|
||||
drawRect.width = dataWid + 25;
|
||||
SerializedProperty element = data.GetArrayElementAtIndex(dimension <= 1 ? 1 : i);
|
||||
EditorGUI.PropertyField(drawRect, element, GUIContent.none);
|
||||
}
|
||||
if (showName)
|
||||
{
|
||||
drawRect.x = startX + (fieldCount - 1) * xWid;
|
||||
drawRect.width = dataWid + 40 + dimension * namegap - 2.5f;
|
||||
EditorGUI.PropertyField(drawRect, sereName, GUIContent.none);
|
||||
}
|
||||
EditorGUIUtility.fieldWidth = lastFieldWid;
|
||||
EditorGUIUtility.labelWidth = lastLabelWid;
|
||||
}
|
||||
});
|
||||
var callbackContext = new HeaderCallbackContext()
|
||||
{
|
||||
serieData = serieData,
|
||||
fieldCount = fieldCount,
|
||||
showName = showName,
|
||||
index = index,
|
||||
dimension = dimension,
|
||||
listProp = m_Datas
|
||||
};
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawSerieDataHeader("SerieData " + dataIndex, flag, false, null, callbackContext, DrawSerieDataHeader);
|
||||
if (m_DataElementFoldout[index])
|
||||
{
|
||||
if (!(serie is ISimplifiedSerie))
|
||||
@@ -306,7 +338,10 @@ namespace XCharts.Editor
|
||||
var sourceIndex = dataLink.FindPropertyRelative("m_Source");
|
||||
var targetIndex = dataLink.FindPropertyRelative("m_Target");
|
||||
var value = dataLink.FindPropertyRelative("m_Value");
|
||||
ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
|
||||
var hig = ChartEditorHelper.MakeThreeField(ref drawRect, drawRect.width, sourceIndex, targetIndex, value, "");
|
||||
var btnRect = drawRect;
|
||||
btnRect.y -= hig;
|
||||
ChartEditorHelper.UpDownAddDeleteButton(btnRect, m_Datas, index);
|
||||
});
|
||||
if (m_LinksElementFoldout[index])
|
||||
{
|
||||
|
||||
@@ -6,6 +6,16 @@ using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
public class HeaderCallbackContext
|
||||
{
|
||||
public int fieldCount = 0;
|
||||
public SerializedProperty serieData;
|
||||
public bool showName;
|
||||
public int index;
|
||||
public int dimension;
|
||||
public SerializedProperty listProp;
|
||||
}
|
||||
|
||||
public class HeaderMenuInfo
|
||||
{
|
||||
public string name;
|
||||
@@ -43,6 +53,8 @@ namespace XCharts.Editor
|
||||
public const float GAP_WIDTH = 0;
|
||||
public const float DIFF_WIDTH = 1;
|
||||
#endif
|
||||
public const float ICON_WIDHT = 10;
|
||||
public const float ICON_GAP = 0;
|
||||
static Dictionary<string, GUIContent> s_GUIContentCache;
|
||||
|
||||
static ChartEditorHelper()
|
||||
@@ -106,21 +118,23 @@ namespace XCharts.Editor
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
|
||||
public static void MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
|
||||
SerializedProperty prop2, SerializedProperty prop3, string name)
|
||||
public static float MakeThreeField(ref Rect drawRect, float rectWidth, SerializedProperty prop1,
|
||||
SerializedProperty prop2, SerializedProperty prop3, string name, bool btnSpacing = true)
|
||||
{
|
||||
EditorGUI.LabelField(drawRect, name);
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * INDENT_WIDTH + GAP_WIDTH;
|
||||
var diff = 13 + EditorGUI.indentLevel * 14;
|
||||
var diff = 13f + EditorGUI.indentLevel * 14;
|
||||
var offset = diff - INDENT_WIDTH;
|
||||
var tempWidth = (rectWidth - startX + diff) / 3;
|
||||
var tempWidth = (rectWidth - startX + diff - (btnSpacing ? (ICON_WIDHT + ICON_GAP) * 4 : 0)) / 3 + 8.5f;
|
||||
var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height - 1);
|
||||
var centerYRect = new Rect(centerXRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
var centerZRect = new Rect(centerYRect.x + tempWidth - offset, drawRect.y, tempWidth - 1, drawRect.height - 1);
|
||||
EditorGUI.PropertyField(centerXRect, prop1, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerYRect, prop2, GUIContent.none);
|
||||
EditorGUI.PropertyField(centerZRect, prop3, GUIContent.none);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
var hig = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
drawRect.y += hig;
|
||||
return hig;
|
||||
}
|
||||
|
||||
public static void MakeVector2(ref Rect drawRect, float rectWidth, SerializedProperty prop, string name)
|
||||
@@ -335,15 +349,12 @@ namespace XCharts.Editor
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var listSize = listProp.arraySize;
|
||||
var iconWidth = 10;
|
||||
var iconGap = 0f;
|
||||
|
||||
if (showSize)
|
||||
{
|
||||
var headerHeight = DrawSplitterAndBackground(drawRect);
|
||||
if (showOrder)
|
||||
{
|
||||
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - iconWidth + 2, drawRect.height);
|
||||
var elementRect = new Rect(drawRect.x, drawRect.y, drawRect.width - ICON_WIDHT + 2, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
GUI.contentColor = oldColor;
|
||||
@@ -396,40 +407,14 @@ namespace XCharts.Editor
|
||||
DrawSplitterAndBackground(drawRect);
|
||||
if (showOrder)
|
||||
{
|
||||
var temp = INDENT_WIDTH + GAP_WIDTH + iconGap;
|
||||
var isSerie = "Serie".Equals(element.type);
|
||||
var elementRect = isSerie ?
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) :
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * iconWidth, drawRect.height);
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * ICON_GAP, drawRect.height) :
|
||||
new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * ICON_WIDHT, drawRect.height);
|
||||
EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i));
|
||||
var iconRect = new Rect(drawRect.width - 4 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i > 0) listProp.MoveArrayElement(i, i - 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element);
|
||||
height += EditorGUI.GetPropertyHeight(element);
|
||||
}
|
||||
GUI.contentColor = oldColor;
|
||||
UpDownAddDeleteButton(drawRect, listProp, i);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(element);
|
||||
height += EditorGUI.GetPropertyHeight(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -442,6 +427,34 @@ namespace XCharts.Editor
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
public static void UpDownAddDeleteButton(Rect drawRect, SerializedProperty listProp, int i)
|
||||
{
|
||||
var temp = INDENT_WIDTH + GAP_WIDTH + ICON_GAP;
|
||||
var iconRect = new Rect(drawRect.width - 4 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
var oldColor = GUI.contentColor;
|
||||
GUI.contentColor = Color.black;
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i > 0) listProp.MoveArrayElement(i, i - 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 3 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - 2 * ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i);
|
||||
}
|
||||
iconRect = new Rect(drawRect.width - ICON_WIDHT + temp, drawRect.y, ICON_WIDHT, drawRect.height);
|
||||
if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton))
|
||||
{
|
||||
if (i < listProp.arraySize && i >= 0) listProp.DeleteArrayElementAtIndex(i);
|
||||
}
|
||||
GUI.contentColor = oldColor;
|
||||
}
|
||||
|
||||
public static bool PropertyField(ref Rect drawRect, Dictionary<string, float> heights, string key,
|
||||
SerializedProperty prop)
|
||||
{
|
||||
@@ -586,6 +599,31 @@ namespace XCharts.Editor
|
||||
return state;
|
||||
}
|
||||
|
||||
public static bool DrawSerieDataHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
HeaderCallbackContext context, Action<Rect, HeaderCallbackContext> drawCallback, params HeaderMenuInfo[] menus)
|
||||
{
|
||||
var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT);
|
||||
var labelRect = DrawHeaderInternal(rect, title, ref state, drawBackground, activeField);
|
||||
DrawMenu(rect, menus);
|
||||
if (drawCallback != null)
|
||||
{
|
||||
drawCallback(rect, context);
|
||||
}
|
||||
var e = Event.current;
|
||||
if (e.type == EventType.MouseDown)
|
||||
{
|
||||
if (labelRect.Contains(e.mousePosition))
|
||||
{
|
||||
if (e.button == 0)
|
||||
{
|
||||
state = !state;
|
||||
e.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField,
|
||||
Action<Rect> drawCallback, List<HeaderMenuInfo> menus)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
public class PraseExternalDataEditor : UnityEditor.EditorWindow
|
||||
{
|
||||
[SerializeField] private int m_DataDimension = 1;
|
||||
[SerializeField] private double m_DefaultYValue = 0;
|
||||
private static BaseChart s_Chart;
|
||||
private static Serie s_Serie;
|
||||
private static Axis s_Axis;
|
||||
@@ -46,8 +48,13 @@ namespace XCharts.Editor
|
||||
return;
|
||||
}
|
||||
EditorGUILayout.LabelField("Input external data (echarts data):");
|
||||
m_DataDimension = EditorGUILayout.IntField("Data Dimension", m_DataDimension);
|
||||
if (m_DataDimension < 1)
|
||||
m_DataDimension = 1;
|
||||
else if (m_DataDimension == 2)
|
||||
m_DefaultYValue = EditorGUILayout.DoubleField("Default Y Value", m_DefaultYValue);
|
||||
inputJsonText = EditorGUILayout.TextArea(inputJsonText, GUILayout.Height(400));
|
||||
if (GUILayout.Button("Add"))
|
||||
if (GUILayout.Button("Try Add"))
|
||||
{
|
||||
if (s_Serie != null)
|
||||
{
|
||||
@@ -76,7 +83,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ParseArrayData(Axis axis, string arrayData)
|
||||
private bool ParseArrayData(Axis axis, string arrayData)
|
||||
{
|
||||
arrayData = arrayData.Trim();
|
||||
if (!arrayData.StartsWith("data: Array")) return false;
|
||||
@@ -95,7 +102,7 @@ namespace XCharts.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ParseArrayData(Serie serie, string arrayData)
|
||||
private bool ParseArrayData(Serie serie, string arrayData)
|
||||
{
|
||||
arrayData = arrayData.Trim();
|
||||
if (!arrayData.StartsWith("data: Array")) return false;
|
||||
@@ -120,7 +127,7 @@ namespace XCharts.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ParseJsonData(Axis axis, string jsonData)
|
||||
private bool ParseJsonData(Axis axis, string jsonData)
|
||||
{
|
||||
if (!CheckJsonData(ref jsonData)) return false;
|
||||
axis.data.Clear();
|
||||
@@ -140,7 +147,7 @@ namespace XCharts.Editor
|
||||
/// 从json中导入数据
|
||||
/// </summary>
|
||||
/// <param name="jsonData"></param>
|
||||
private static bool ParseJsonData(Serie serie, string jsonData)
|
||||
private bool ParseJsonData(Serie serie, string jsonData)
|
||||
{
|
||||
if (!CheckJsonData(ref jsonData)) return false;
|
||||
if (s_LinksData) serie.ClearLinks();
|
||||
@@ -156,7 +163,10 @@ namespace XCharts.Editor
|
||||
if (data.Length == 2 && !double.TryParse(data[0], out value))
|
||||
{
|
||||
double.TryParse(data[1], out value);
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
serieData.name = data[0].Replace("\"", "").Trim();
|
||||
}
|
||||
else
|
||||
@@ -187,7 +197,10 @@ namespace XCharts.Editor
|
||||
if (a.StartsWith("value:"))
|
||||
{
|
||||
double value = double.Parse(a.Substring(6, a.Length - 6));
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
}
|
||||
else if (a.StartsWith("name:"))
|
||||
{
|
||||
@@ -213,7 +226,10 @@ namespace XCharts.Editor
|
||||
if (flag)
|
||||
{
|
||||
var serieData = new SerieData();
|
||||
serieData.data = new List<double>() { i, value };
|
||||
if (m_DataDimension == 2)
|
||||
serieData.data = new List<double>() { i, m_DefaultYValue, value };
|
||||
else
|
||||
serieData.data = new List<double>() { i, value };
|
||||
serie.AddSerieData(serieData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace XCharts.Editor
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Column", priority = 45)]
|
||||
public static void AddBarChart()
|
||||
{
|
||||
AddChart<BarChart>("BarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Column", priority = 45)]
|
||||
public static void AddBarChart_ZebraColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Column");
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Column", priority = 45)]
|
||||
public static void AddBarChart_CapsuleColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Column");
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Column", priority = 45)]
|
||||
public static void AddBarChart_GroupedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Column");
|
||||
@@ -45,7 +45,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Column", priority = 45)]
|
||||
public static void AddBarChart_StackedColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Column");
|
||||
@@ -53,7 +53,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Column", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Percent Column", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Column", priority = 45)]
|
||||
public static void AddBarChart_PercentColumn()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Column");
|
||||
@@ -61,7 +61,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Baisc Bar", priority = 45)]
|
||||
public static void AddBarChart_BasicBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart");
|
||||
@@ -69,7 +69,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Zebra Bar", priority = 45)]
|
||||
public static void AddBarChart_ZebraBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Zebra Bar");
|
||||
@@ -77,7 +77,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Capsule Bar", priority = 45)]
|
||||
public static void AddBarChart_CapsuleBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Capsule Bar");
|
||||
@@ -85,7 +85,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Grouped Bar", priority = 45)]
|
||||
public static void AddBarChart_GroupedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Grouped Bar");
|
||||
@@ -93,7 +93,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Stacked Bar", priority = 45)]
|
||||
public static void AddBarChart_StackedBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Stacked Bar");
|
||||
@@ -101,7 +101,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
[MenuItem("GameObject/XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
[MenuItem("GameObject/UI/XCharts/BarChart/Percent Bar", priority = 45)]
|
||||
public static void AddBarChart_PercentBar()
|
||||
{
|
||||
var chart = AddChart<BarChart>("BarChart", "Percent Bar");
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace XCharts.Editor
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/LineChart/Basic Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Basic Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Basic Line", priority = 44)]
|
||||
public static void AddLineChart()
|
||||
{
|
||||
AddChart<LineChart>("LineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Area Line", priority = 44)]
|
||||
public static void AddLineChart_Area()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Area", "Area Line");
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Line", priority = 44)]
|
||||
public static void AddLineChart_Smooth()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Smooth", "Smooth Line");
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Smooth Area", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Smooth Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Smooth Area Line", priority = 44)]
|
||||
public static void AddLineChart_SmoothArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_SmoothArea", "Smooth Area Line");
|
||||
@@ -45,7 +45,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Stack Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Line", priority = 44)]
|
||||
public static void AddLineChart_Stack()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Stack", "Stack Line");
|
||||
@@ -53,7 +53,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Stack Area Line", priority = 44)]
|
||||
public static void AddLineChart_StackArea()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_StackArea", "Stack Area Line");
|
||||
@@ -61,7 +61,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Step Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Step Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Step Line", priority = 44)]
|
||||
public static void AddLineChart_Step()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Step", "Step Line");
|
||||
@@ -69,7 +69,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Dashed Line", priority = 44)]
|
||||
public static void AddLineChart_Dash()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Dashed", "Dashed Line");
|
||||
@@ -77,7 +77,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Time Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Time Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Time Line", priority = 44)]
|
||||
public static void AddLineChart_Time()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Time", "Time Line");
|
||||
@@ -85,7 +85,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LineChart/Log Line", priority = 44)]
|
||||
[MenuItem("GameObject/XCharts/LineChart/Log Line", priority = 44)]
|
||||
[MenuItem("GameObject/UI/XCharts/LineChart/Log Line", priority = 44)]
|
||||
public static void AddLineChart_Log()
|
||||
{
|
||||
var chart = AddChart<LineChart>("LineChart_Log", "Log Line");
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace XCharts.Editor
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PieChart/Pie", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Pie", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Pie", priority = 46)]
|
||||
public static void AddPieChart()
|
||||
{
|
||||
AddChart<PieChart>("PieChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Pie With Label", priority = 46)]
|
||||
public static void AddPieChart_WithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Donut", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Donut", priority = 46)]
|
||||
public static void AddPieChart_Donut()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Donut With Label", priority = 46)]
|
||||
public static void AddPieChart_DonutWithLabel()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
@@ -45,7 +45,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Radius Rose", priority = 46)]
|
||||
public static void AddPieChart_RadiusRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
@@ -53,7 +53,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PieChart/Area Rose", priority = 46)]
|
||||
[MenuItem("GameObject/XCharts/PieChart/Area Rose", priority = 46)]
|
||||
[MenuItem("GameObject/UI/XCharts/PieChart/Area Rose", priority = 46)]
|
||||
public static void AddPieChart_AreaRose()
|
||||
{
|
||||
var chart = AddChart<PieChart>("PieChart");
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace XCharts.Editor
|
||||
public partial class XChartsEditor
|
||||
{
|
||||
[MenuItem("XCharts/PolarChart/Line", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Line", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Line", priority = 54)]
|
||||
public static void PolarChart()
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Radial Bar", priority = 54)]
|
||||
public static void PolarChart_RadialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Tangential Bar", priority = 54)]
|
||||
public static void PolarChart_TangentialBar()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/PolarChart/Heatmap", priority = 54)]
|
||||
public static void PolarChart_Heatmap()
|
||||
{
|
||||
var chart = AddChart<PolarChart>("PolarChart");
|
||||
|
||||
@@ -96,21 +96,21 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/EmptyChart", priority = 43)]
|
||||
[MenuItem("GameObject/XCharts/EmptyChart", priority = 43)]
|
||||
[MenuItem("GameObject/UI/XCharts/EmptyChart", priority = 43)]
|
||||
public static void AddBaseChart()
|
||||
{
|
||||
AddChart<BaseChart>("EmptyChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
[MenuItem("GameObject/UI/XCharts/RadarChart/Polygon Radar", priority = 47)]
|
||||
public static void AddRadarChart()
|
||||
{
|
||||
AddChart<RadarChart>("RadarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
[MenuItem("GameObject/XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
[MenuItem("GameObject/UI/XCharts/RadarChart/Cirle Radar", priority = 47)]
|
||||
public static void AddRadarChart_CirleRadar()
|
||||
{
|
||||
var chart = AddChart<RadarChart>("RadarChart");
|
||||
@@ -118,14 +118,14 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
[MenuItem("GameObject/UI/XCharts/ScatterChart/Scatter", priority = 48)]
|
||||
public static void AddScatterChart()
|
||||
{
|
||||
AddChart<ScatterChart>("ScatterChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
[MenuItem("GameObject/XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
[MenuItem("GameObject/UI/XCharts/ScatterChart/Bubble", priority = 48)]
|
||||
public static void AddScatterChart_Bubble()
|
||||
{
|
||||
var chart = AddChart<ScatterChart>("ScatterChart");
|
||||
@@ -133,14 +133,14 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart()
|
||||
{
|
||||
AddChart<HeatmapChart>("HeatmapChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
[MenuItem("GameObject/UI/XCharts/HeatmapChart/Count Heatmap", priority = 49)]
|
||||
public static void AddHeatmapChart_Count()
|
||||
{
|
||||
var chart = AddChart<HeatmapChart>("HeatmapChart");
|
||||
@@ -148,14 +148,14 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart/Ring", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart/Ring", priority = 51)]
|
||||
[MenuItem("GameObject/UI/XCharts/RingChart/Ring", priority = 51)]
|
||||
public static void AddRingChart()
|
||||
{
|
||||
AddChart<RingChart>("RingChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
[MenuItem("GameObject/XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
[MenuItem("GameObject/UI/XCharts/RingChart/Multiple Ring", priority = 51)]
|
||||
public static void AddRingChart_MultiRing()
|
||||
{
|
||||
var chart = AddChart<RingChart>("RingChart");
|
||||
@@ -163,35 +163,35 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
[MenuItem("GameObject/XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
[MenuItem("GameObject/UI/XCharts/CandlestickChart/Candlestick", priority = 54)]
|
||||
public static void CandlestickChart()
|
||||
{
|
||||
AddChart<CandlestickChart>("CandlestickChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
[MenuItem("GameObject/XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
[MenuItem("GameObject/UI/XCharts/ParallelChart/Parallel", priority = 55)]
|
||||
public static void ParallelChart()
|
||||
{
|
||||
AddChart<ParallelChart>("ParallelChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Line", priority = 56)]
|
||||
public static void SimplifiedLineChart()
|
||||
{
|
||||
AddChart<SimplifiedLineChart>("SimplifiedLineChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Bar", priority = 57)]
|
||||
public static void SimplifiedBarChart()
|
||||
{
|
||||
AddChart<SimplifiedBarChart>("SimplifiedBarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
[MenuItem("GameObject/XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
[MenuItem("GameObject/UI/XCharts/SimplifiedChart/Candlestick", priority = 58)]
|
||||
public static void SimplifiedCandlestickChart()
|
||||
{
|
||||
AddChart<SimplifiedCandlestickChart>("SimplifiedCandlestickChart");
|
||||
|
||||
@@ -17,24 +17,52 @@ namespace XCharts.Example
|
||||
public bool loopUpdate = false;
|
||||
public float loopUpadteTime = 1f;
|
||||
public int maxCache = 0;
|
||||
public bool insertDataToHead = false;
|
||||
|
||||
BaseChart chart;
|
||||
float lastAddTime;
|
||||
float lastUpdateTime;
|
||||
int dataCount;
|
||||
|
||||
int lastMaxCache = 0;
|
||||
bool lastInsertDataToHead = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
chart = gameObject.GetComponent<BaseChart>();
|
||||
chart.onInit = () =>
|
||||
{
|
||||
dataCount = chart.GetSerie(0).dataCount;
|
||||
SetMaxCache(maxCache);
|
||||
SetInsertDataToHead(insertDataToHead);
|
||||
lastMaxCache = maxCache;
|
||||
lastInsertDataToHead = insertDataToHead;
|
||||
};
|
||||
}
|
||||
|
||||
void Start()
|
||||
void SetMaxCache(int maxCache)
|
||||
{
|
||||
if (maxCache > 0)
|
||||
chart.SetMaxCache(maxCache);
|
||||
}
|
||||
|
||||
void SetInsertDataToHead(bool insertDataToHead)
|
||||
{
|
||||
foreach (var serie in chart.series)
|
||||
serie.insertDataToHead = insertDataToHead;
|
||||
|
||||
var coms = chart.GetChartComponents<XAxis>();
|
||||
if (coms != null)
|
||||
{
|
||||
chart.SetMaxCache(maxCache);
|
||||
foreach (var com in coms)
|
||||
{
|
||||
var axis = com as XAxis;
|
||||
if (axis.type == Axis.AxisType.Category)
|
||||
{
|
||||
axis.insertDataToHead = insertDataToHead;
|
||||
Debug.LogError("axis:" + axis + "," + insertDataToHead);
|
||||
}
|
||||
}
|
||||
}
|
||||
dataCount = chart.GetSerie(0).dataCount;
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -51,6 +79,16 @@ namespace XCharts.Example
|
||||
{
|
||||
chart.ClearData();
|
||||
}
|
||||
if (lastMaxCache != maxCache)
|
||||
{
|
||||
lastMaxCache = maxCache;
|
||||
SetMaxCache(maxCache);
|
||||
}
|
||||
if (lastInsertDataToHead != insertDataToHead)
|
||||
{
|
||||
lastInsertDataToHead = insertDataToHead;
|
||||
SetInsertDataToHead(insertDataToHead);
|
||||
}
|
||||
lastAddTime += Time.deltaTime;
|
||||
if (loopAdd && lastAddTime >= loopAddTime)
|
||||
{
|
||||
@@ -84,14 +122,8 @@ namespace XCharts.Example
|
||||
}
|
||||
else
|
||||
{
|
||||
AddXAxisData();
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
if (xAxis != null)
|
||||
{
|
||||
if (xAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1));
|
||||
}
|
||||
}
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
AddSerieRandomData(serie, xAxis);
|
||||
@@ -99,6 +131,19 @@ namespace XCharts.Example
|
||||
}
|
||||
}
|
||||
|
||||
void AddXAxisData()
|
||||
{
|
||||
var xAxes = chart.GetChartComponents<XAxis>();
|
||||
foreach (var com in xAxes)
|
||||
{
|
||||
var xAxis = com as XAxis;
|
||||
if (xAxis.type == Axis.AxisType.Category)
|
||||
{
|
||||
chart.AddXAxisData("x" + (xAxis.GetAddedDataCount() + 1), xAxis.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateData()
|
||||
{
|
||||
foreach (var serie in chart.series)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XCharts.Example
|
||||
void AddData()
|
||||
{
|
||||
chart.RemoveData();
|
||||
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Corss;
|
||||
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.Cross;
|
||||
var angleAxis = chart.GetChartComponent<AngleAxis>();
|
||||
angleAxis.type = Axis.AxisType.Value;
|
||||
angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;
|
||||
|
||||
113
README-en.md
113
README-en.md
@@ -45,38 +45,35 @@
|
||||
|
||||

|
||||
|
||||
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, and treemap.
|
||||
## Overview
|
||||
|
||||
[XCharts3.0 Homepage](https://xcharts-team.github.io)
|
||||
A powerful and easy-to-use data visualization library for Unity. It supports more than ten built-in charts, including line, bar, pie, radar, scatter, heatmap, ring, candlestick, polar, parallel coordinates, as well as extended charts such as 3d pie, 3d bar, 3d pyramid, funnel, gauge, liquid, pictorialbar, gantt, treemap, sankey, line3d and graph chart.
|
||||
|
||||
[XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
|
||||
[XCharts3.0 API](Documentation~/en/api.md)
|
||||
[XCharts3.0 FAQ](Documentation~/en/faq.md)
|
||||
[XCharts3.0 Configurate](Documentation~/en/configuration.md)
|
||||
[XCharts3.0 Changelog](Documentation~/en/changelog.md)
|
||||
[XCharts3.0 Support](Documentation~/en/support.md)
|
||||
## Key Features
|
||||
|
||||
## Features
|
||||
- __Pure Code Rendering__: Charts are rendered with pure code, eliminating the need for extra texture or shader resources.
|
||||
- __Visual Configuration__: Configure parameters visually with real-time preview and support for dynamic configuration and data adjustments at runtime.
|
||||
- __High Customizability__: Themes and configuration parameters can be adjusted as needed, with support for custom drawing and callbacks.
|
||||
- __Built-in and Extended Charts__: Supports a variety of chart types, including 3D charts and special chart types like gauges and treemaps.
|
||||
- __Multiple Chart Combinations__: Combine multiple charts of the same or different types within a single instance.
|
||||
- __Various Coordinate Systems__: Supports different coordinate systems such as Cartesian, polar, and single axes.
|
||||
- __Rich Components__: Includes titles, legends, tooltips, and more.
|
||||
- __Custom Drawing__: Utilize a powerful API for custom drawing of points, lines, and other graphics.
|
||||
- __Large Data Rendering__: Capable of rendering tens of thousands of data points with support for sampling rendering.
|
||||
- __Custom Themes__: Customize themes and use the included light and dark default themes.
|
||||
- __Animations and Interactions__: Supports various animations and interactions for a dynamic user experience.
|
||||
- __Third-Party Extensions__: Integrates with TextMeshPro and the New Input System.
|
||||
- __Version and Compatibility__: Compatible with all Unity versions above 5.6 and runs on all platforms.
|
||||
|
||||
* __Pure code rendering__: The chart is completely rendered with pure code, without the need for additional texture or shader resources.
|
||||
* __Visual configuration__: Visual configuration of parameters with real-time preview of the effect, and support for dynamic modification of configuration and data during runtime.
|
||||
* __High customizability__: Supports arbitrary adjustments from theme and configuration parameters; supports custom drawing, callback functions, and custom implementations of charts.
|
||||
* __Multiple built-in charts__: Supports various built-in charts such as line charts, bar charts, pie charts, radar charts, scatter plots, heat maps, polar charts, K-line charts, parallel coordinates, etc.
|
||||
* __Multiple extended charts__: Supports extended charts such as 3D column charts, 3D pie charts, funnel charts, pyramids, dashboards, water level charts, iconic bar charts, Gantt charts, and tree maps.
|
||||
* __Multiple extended features__: Supports extended UI components such as tables and statistical values.
|
||||
* __Multiple chart combinations__: Supports arbitrary combinations of built-in charts, with multiple same or different types of charts displayed simultaneously in the same chart.
|
||||
* __Various coordinate systems__: Supports coordinate systems such as Cartesian coordinates, polar coordinates, and single axes.
|
||||
* __Rich components__: Supports common components such as titles, legends, tooltips, markings, marking areas, data area zooming, and visual mapping.
|
||||
* __Rich line charts__: Supports various line charts such as straight line charts, curved line charts, dashed line charts, area charts, step line charts, etc.
|
||||
* __Rich bar charts__: Supports various bar charts such as stacked bar charts, stacked percentage bar charts, zebra bar charts, and capsule bar charts.
|
||||
* __Rich pie charts__: Supports various pie charts such as ring charts, rose charts, ring rose charts, etc.
|
||||
* __Rich lines__: Supports various lines such as solid lines, curves, step lines, dashed lines, dot lines, dotted lines, and double dot-dashed lines.
|
||||
* __Custom drawing__: Supports custom chart content drawing with powerful drawing APIs for drawing points, lines, and other graphics.
|
||||
* __Large data rendering__: Supports rendering of tens of thousands of data points; supports sampling rendering; special simplified charts support better performance.
|
||||
* __Custom themes__: Supports theme customization and import/export; includes both light and dark default themes.
|
||||
* __Animations and interactions__: Supports various animations such as fade-in animation, fade-out animation, change animation, addition animation, and * interactive animation; supports interactive operations such as data filtering, view zooming, and detailed display on multiple platforms.
|
||||
* __Third-party extensions__: Supports integration with TexMeshPro and New Input System.
|
||||
* __Version and compatibility__: Supports all Unity versions above 5.6 and runs on all platforms.
|
||||
## Documentation
|
||||
|
||||
- [XCharts3.0 Homepage](https://xcharts-team.github.io)
|
||||
- [XCharts3.0 Tutorial](Documentation~/en/tutorial01.md)
|
||||
- [XCharts3.0 API](Documentation~/en/api.md)
|
||||
- [XCharts3.0 FAQ](Documentation~/en/faq.md)
|
||||
- [XCharts3.0 Configurate](Documentation~/en/configuration.md)
|
||||
- [XCharts3.0 Changelog](Documentation~/en/changelog.md)
|
||||
- [XCharts3.0 Support](Documentation~/en/support.md)
|
||||
|
||||
## Screenshots
|
||||
|
||||
@@ -84,55 +81,43 @@ A powerful and easy-to-use data visualization library for Unity. It supports mo
|
||||
|
||||

|
||||
|
||||
## Attention
|
||||
## Important Notes
|
||||
|
||||
* `XCharts3.0` is not fully compatible with `XCharts2.0` version, upgrading `3.0` may require some code adjustments, and some chart configurations need to be readjusting. It is recommended that old projects can continue to use `XCharts2.0`, and new projects are recommended to use `XCharts3.0`.
|
||||
* `XCharts2.0` enters the maintenance phase, and only serious `bugs` will be fixed later, in principle, no more new features will be added.
|
||||
* `XCharts` theoretically supports `Unity 5.6` and above, but due to limited version testing, it is inevitable to slip up, and version compatibility issues can be raised.
|
||||
* This repository only contains `XCharts` source code, does not contain `Demo` sample section. Need to look at ` Demo ` please go to the sample source code [XCharts - Demo](https://github.com/XCharts-Team/XCharts-Demo) repo. You can also view the running effect of `WebGL` in your browser [Online Demo](https://xcharts-team.github.io/examples/).
|
||||
- `XCharts3.0` is not fully compatible with `XCharts2.0`. Upgrading to 3.0 may require code adjustments and reconfiguration of some charts.
|
||||
- `XCharts2.0` is in the maintenance phase with only critical bug fixes applied.
|
||||
- While XCharts supports Unity 5.6 and above, compatibility issues may arise due to limited testing.
|
||||
- This repository contains only the `XCharts` source code. For demos, visit the [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) repo or the [Online Demo](https://xcharts-team.github.io/examples/).
|
||||
|
||||
## Use
|
||||
## Getting Started
|
||||
|
||||
* Import `XCharts` unitypackage or source code into the project.
|
||||
* Right-click `Hierarchy` view and choose `XCharts->LineChart` to create a default LineChart.
|
||||
* You can adjust the parameters of each component in `Inspector` and see the real-time effects in `Game` view.
|
||||
* For more details, see [[XCharts Tutorial: 5-minute tutorial]](Documentation~/en/tutorial01.md)
|
||||
* For the first time, it is recommended to read the tutorial carefully.
|
||||
1. Import the `XCharts` unitypackage or source code into your Unity project.
|
||||
2. Create a chart by right-clicking in the `Hierarchy` view and selecting `UI->XCharts->LineChart`.
|
||||
3. Adjust component parameters in the `Inspector` to see real-time effects in the `Game` view.
|
||||
4. For more details, refer to the [5-minute tutorial](Documentation~/en/tutorial01.md).
|
||||
|
||||
## Branch
|
||||
## Branch Information
|
||||
|
||||
* `master` : indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
|
||||
* `3.0` : Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
|
||||
* `2.0` : A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
|
||||
* `2.0-upm` : Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
|
||||
* `1.0` : Stable branch of XCharts 1.0. With Demo, no maintenance.
|
||||
* `1.0-upm` : stable UMP branch of XCharts 1.0. No Demo, no maintenance.
|
||||
- __master__ indicates the development branch. The latest changes and new features are first committed to the `master` branch, and after some time from the `master` branch `merge` to the `3.0` branch, and the `release` version.
|
||||
- __3.0__ Stable branch of XCharts 3.0. It is generally updated once a month, with the latest changes from the `master` branch `merge`, and the `release` version is released.
|
||||
- __2.0__ A stable branch of XCharts 2.0. With Demo, currently no longer maintenance, only to modify serious bugs.
|
||||
- __2.0-upm__ Stable UMP branch of XCharts 2.0. Only the Package part is included without Demo. It is dedicated to the UMP and is not maintained.
|
||||
- __1.0__ Stable branch of XCharts 1.0. With Demo, no maintenance.
|
||||
- __1.0-upm__ stable UMP branch of XCharts 1.0. No Demo, no maintenance.
|
||||
|
||||
## FAQ
|
||||
|
||||
* Is `XCharts` free to use?
|
||||
A: `XCharts` uses the `MIT` licence and is free to use. You can also subscribe to `VIP` to enjoy more value-added services.
|
||||
|
||||
* Does `XCharts` support code to dynamically add and modify data? Does it support getting data from `Excel` or a database?
|
||||
A: Support code to dynamically add and modify data, but data needs to be parsed or retrieved by itself, and then added to `XCharts` by calling the public interface of `XCharts`.
|
||||
|
||||
* Does this plugin work on other platforms (e.g. Winform or WPF) besides Unity?
|
||||
A: It is currently only supported on Unity. Theoretically any version of Unity that supports `UGUI` can run `XCharts`.
|
||||
|
||||
* What about the jags? What magnitude of data is supported?
|
||||
A: XCharts is based on UGUI implementation, so the problems encountered in UGUI will also exist in XCharts. For example, the sawtooth problem, such as the number of vertices in `Mesh` exceeds `65535`. Solutions to these two problems can be found in [Q&A 16](Documentation~/en/faq.md) and [Q&A 27](Documentation~/en/faq.md).
|
||||
Due to the `Mesh` of the `65535` vertex limit, the current `XCharts` single `Line` supports about `20,000` of data, of course, open sampling can support more data to draw, but at the same time it will consume more CPU.
|
||||
- __Is XCharts free to use?__ Yes, XCharts is free under the MIT license and includes value-added VIP services.
|
||||
- __Does XCharts support dynamic data addition and modification?__ Yes, but data must be parsed or retrieved by the user.
|
||||
- __Does this plugin work on platforms other than Unity?__ No, it is designed for Unity only.
|
||||
|
||||
## Changelog
|
||||
|
||||
* [Changelog](Documentation~/en/changelog.md)
|
||||
- [Changelog](Documentation~/en/changelog.md)
|
||||
|
||||
## Licenses
|
||||
|
||||
* [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md)
|
||||
* Free commercial, secondary development
|
||||
* The extended charts and advanced features sections require a separate purchase license
|
||||
- XCharts is released under the [MIT License](https://github.com/XCharts-Team/XCharts/blob/master/LICENSE.md).
|
||||
|
||||
## Other
|
||||
## Contact
|
||||
|
||||
email: `monitor1394@gmail.com`
|
||||
- For more information or support, contact us at `monitor1394@gmail.com`.
|
||||
|
||||
88
README.md
88
README.md
@@ -45,7 +45,7 @@
|
||||
|
||||

|
||||
|
||||
一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十多种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`、`桑基图`等多种扩展图表。
|
||||
一款基于`UGUI`的功能强大的简单易用的`Unity`数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十几种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`、`桑基图`、`3D折线图`、`关系图`等十几种扩展图表。
|
||||
|
||||
[XCharts 官方主页](https://xcharts-team.github.io)
|
||||
[XCharts 在线示例](https://xcharts-team.github.io/examples)
|
||||
@@ -63,7 +63,7 @@
|
||||
- __可视化配置__:参数可视化配置,效果实时预览,支持运行时代码动态修改配置和数据。
|
||||
- __高自由定制__:支持从主题和配置参数上任意调整;支持代码自定义绘制,自定义回调以及自定义实现图表。
|
||||
- __多内置图表__:支持线图、柱状图、饼图、雷达图、散点图、热力图、环形图、K线图、极坐标、平行坐标等多种内置图表。
|
||||
- __多扩展图表__:支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图等多种扩展图表。
|
||||
- __多扩展图表__:支持3D柱图、3D饼图、漏斗图、金字塔、仪表盘、水位图、象形柱图、甘特图、矩形树图、桑基图、3D折线图、关系图等多种扩展图表。
|
||||
- __多扩展组件__:支持表格、统计数值等多种扩展UI组件。
|
||||
- __多图表组合__:支持内置图表的任意组合,同一图中可同时显示多个相同或不同类型的图表。
|
||||
- __多种坐标系__:支持直角坐标系、极坐标系、单轴等多种坐标系。
|
||||
@@ -87,42 +87,33 @@
|
||||
|
||||
## 仓库
|
||||
|
||||
| 相关仓库 | 仓库介绍 |
|
||||
| -- | --|
|
||||
| [XCharts](https://github.com/XCharts-Team/XCharts) | XCharts核心功能,完全免费。 |
|
||||
| [XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon) | XCharts的守护程序,用于确保XCharts更新时的编译正常。非必须,但建议使用。 |
|
||||
| [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo) | XCharts的官方示例,不包含扩展图表部分。订阅VIP的用户购买扩展图表后,可加入对应图表的示例。 |
|
||||
| [XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro) | XCharts完全版,包含所有扩展图表和扩展组件。订阅SVIP后可访问使用。 |
|
||||
| [XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo) | XCharts完全版官方示例,包含所有扩展图表和扩展组件的示例。订阅SVIP后可访问使用。 |
|
||||
| [XCharts-UI](https://github.com/XCharts-Team/XCharts-UI) | XCharts的扩展UI组件。订阅VIP后可访问使用。 |
|
||||
| [XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart) | XCharts扩展图表:3D柱图。订阅购买后可访问使用。 |
|
||||
| [XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart) | XCharts扩展图表:漏斗图。订阅购买后可访问使用。 |
|
||||
| [XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart) | XCharts扩展图表:甘特图。订阅购买后可访问使用。 |
|
||||
| [XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart) | XCharts扩展图表:仪表盘。订阅购买后可访问使用。 |
|
||||
| [XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart) | XCharts扩展图表:水位图。订阅购买后可访问使用。 |
|
||||
| [XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart) | XCharts扩展图表:象形住图。订阅购买后可访问使用。 |
|
||||
| [XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart) | XCharts扩展图表:3D饼图。订阅购买后可访问使用。 |
|
||||
| [XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart) | XCharts扩展图表:3D金字塔。订阅购买后可访问使用。 |
|
||||
| [XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart) | XCharts扩展图表:矩形树图。订阅购买后可访问使用。 |
|
||||
| [XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart) | XCharts扩展图表:桑基图。订阅购买后可访问使用。 |
|
||||
- __[XCharts](https://github.com/XCharts-Team/XCharts)__ XCharts核心功能,完全免费。
|
||||
- __[XCharts-Daemon](https://github.com/XCharts-Team/XCharts-Daemon)__ XCharts守护程序,用于确保XCharts更新时的编译正常。非必须,但建议使用。
|
||||
- __[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)__ XCharts官方示例,不包含扩展图表部分。订阅购买扩展图表后可导入示例。
|
||||
- __[XCharts-Pro](https://github.com/XCharts-Team/XCharts-Pro)__ XCharts专业版,包含所有扩展图表和扩展组件。订阅SVIP后可访问使用。
|
||||
- __[XCharts-Pro-Demo](https://github.com/XCharts-Team/XCharts-Pro-Demo)__ XCharts专业版官方示例,包含所有扩展图表和扩展组件的示例。订阅SVIP后可访问使用。
|
||||
- __[XCharts-UI](https://github.com/XCharts-Team/XCharts-UI)__ XCharts的扩展UI组件。订阅VIP后可访问使用。
|
||||
- __[XCharts-Bar3DChart](https://github.com/XCharts-Team/XCharts-Bar3DChart)__ XCharts扩展图表:3D柱图。订阅购买后可访问使用。
|
||||
- __[XCharts-FunnelChart](https://github.com/XCharts-Team/XCharts-FunnelChart)__ XCharts扩展图表:漏斗图。订阅购买后可访问使用。
|
||||
- __[XCharts-GanttChart](https://github.com/XCharts-Team/XCharts-GanttChart)__ XCharts扩展图表:甘特图。订阅购买后可访问使用。
|
||||
- __[XCharts-GaugeChart](https://github.com/XCharts-Team/XCharts-GaugeChart)__ XCharts扩展图表:仪表盘。订阅购买后可访问使用。
|
||||
- __[XCharts-LiquidChart](https://github.com/XCharts-Team/XCharts-LiquidChart)__ XCharts扩展图表:水位图。订阅购买后可访问使用。
|
||||
- __[XCharts-PictorialBarChart](https://github.com/XCharts-Team/XCharts-PictorialBarChart)__ XCharts扩展图表:象形住图。订阅购买后可访问使用。
|
||||
- __[XCharts-Pie3DChart](https://github.com/XCharts-Team/XCharts-Pie3DChart)__ XCharts扩展图表:3D饼图。订阅购买后可访问使用。
|
||||
- __[XCharts-PyramidChart](https://github.com/XCharts-Team/XCharts-PyramidChart)__ XCharts扩展图表:3D金字塔。订阅购买后可访问使用。
|
||||
- __[XCharts-TreemapChart](https://github.com/XCharts-Team/XCharts-TreemapChart)__ XCharts扩展图表:矩形树图。订阅购买后可访问使用。
|
||||
- __[XCharts-SankeyChart](https://github.com/XCharts-Team/XCharts-SankeyChart)__ XCharts扩展图表:桑基图。订阅购买后可访问使用。
|
||||
- __[XCharts-Line3DChart](https://github.com/XCharts-Team/XCharts-Line3DChart)__ XCharts扩展图表:3D折线图。订阅购买后可访问使用。
|
||||
- __[XCharts-GraphChart](https://github.com/XCharts-Team/XCharts-GraphChart)__ XCharts扩展图表:关系图。订阅购买后可访问使用。
|
||||
|
||||
## 分支
|
||||
|
||||
| 分支 | 分支介绍 |
|
||||
|--|--|
|
||||
| [master](https://github.com/XCharts-Team/XCharts/tree/master) | XCharts3.0的开发分支。最新的修改和功能都先提交到`master`分支,稳定后后再从`master`分支`merge`到`3.0`分支,并发布`release`版本。|
|
||||
| [3.0](https://github.com/XCharts-Team/XCharts/tree/3.0) | XCharts3.0的稳定分支。一般一个月一发布,`master`分支稳定后,`merge`到`3.0`分支,并发布`release`版本。|
|
||||
| [2.0](https://github.com/XCharts-Team/XCharts/tree/2.0) | XCharts2.0的稳定分支。带Demo,目前基本不再维护,仅修改严重bug。|
|
||||
| [2.0-upm](https://github.com/XCharts-Team/XCharts/tree/2.0-upm) | XCharts2.0的稳定UMP分支。不带Demo,只包含Package部分,不再维护。|
|
||||
| [1.0](https://github.com/XCharts-Team/XCharts/tree/1.0) | XCharts1.0的稳定分支。带Demo,不再维护。|
|
||||
| [1.0-upm](https://github.com/XCharts-Team/XCharts/tree/1.0-upm) | XCharts1.0的稳定UMP分支。不带Demo,不再维护。|
|
||||
|
||||
## 注意
|
||||
|
||||
- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`时,部分代码和配置可能需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
|
||||
- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,原则上不再加新功能。
|
||||
- `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现问题可提`Issue`。
|
||||
- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
|
||||
- __[master](https://github.com/XCharts-Team/XCharts/tree/master)__ XCharts3.0的开发分支。最新的修改和功能都先提交到`master`分支,稳定后再发布`release`版本。
|
||||
- __[3.0](https://github.com/XCharts-Team/XCharts/tree/3.0)__ XCharts3.0的稳定分支。一般一个月一发布,`master`分支稳定后,`merge`到`3.0`分支,并发布`release`版本。
|
||||
- __[2.0](https://github.com/XCharts-Team/XCharts/tree/2.0)__ XCharts2.0的稳定分支。带Demo,目前基本不再维护,仅修改严重bug。
|
||||
- __[2.0-upm](https://github.com/XCharts-Team/XCharts/tree/2.0-upm)__ XCharts2.0的稳定UMP分支。不带Demo,只包含Package部分,不再维护。
|
||||
- __[1.0](https://github.com/XCharts-Team/XCharts/tree/1.0)__ XCharts1.0的稳定分支。带Demo,不再维护。
|
||||
- __[1.0-upm](https://github.com/XCharts-Team/XCharts/tree/1.0-upm)__ XCharts1.0的稳定UMP分支。不带Demo,不再维护。
|
||||
|
||||
## 使用
|
||||
|
||||
@@ -133,24 +124,31 @@
|
||||
- 更多细节,请看[【XCharts教程:5分钟上手教程】](Documentation~/zh/tutorial01.md)。
|
||||
- 首次使用,建议先认真看一遍教程。
|
||||
|
||||
## 注意
|
||||
|
||||
- __XCharts3.0不完全兼容XCharts2.0版本。__ 升级`3.0`时,部分代码和配置可能需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。
|
||||
- __XCharts2.0只维护不加新功能。__ `2.0`只修复严重`bug`,原则上不再加新功能。
|
||||
- __XCharts支持Unity 5.6及以上版本。__ 但由于版本测试有限难免疏漏,发现问题可提`Issue`。
|
||||
- __本仓库只包含XCharts源码,不包含Demo示例部分。__ 需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。
|
||||
|
||||
## FAQ
|
||||
|
||||
- `XCharts`可以免费使用吗?
|
||||
答:`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。
|
||||
- __XCharts可以免费使用吗?__
|
||||
`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。
|
||||
|
||||
- `XCharts`支持代码动态添加和修改数据吗?支持从`Excel`或数据库中获取数据吗?
|
||||
答:`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
|
||||
- __XCharts支持代码动态添加和修改数据吗?支持从`Excel`或数据库中获取数据吗?__
|
||||
`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。
|
||||
|
||||
- `XCharts`除了用在`Unity`平台,还能用在`Winform`或`WPF`等平台吗?
|
||||
答:`XCharts`只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。
|
||||
- __XCharts除了用在Unity平台,还能用在Winform或WPF等平台吗?__
|
||||
`XCharts`只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。
|
||||
|
||||
- 锯齿怎么解决?支持多大量级的数据?
|
||||
答:`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
|
||||
由于`Mesh`的`65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量,当然开启采样可以支持更多数据的绘制,但同时也会更消耗CPU。
|
||||
- __锯齿怎么解决?支持多大量级的数据?__
|
||||
`XCharts`是基于`UGUI`实现的,所以`UGUI`中碰到的问题,在`XCharts`中也会存在。比如锯齿问题,比如`Mesh`顶点数超`65535`的问题。这两个问题的解决可参考[问答16](Documentation~/zh/faq.md)和[问答27](Documentation~/zh/faq.md)。
|
||||
由于`Mesh`的`65535`顶点数的限制,目前`XCharts`的单条`Line`支持约`2万`的数据量,当然开启采样可以支持更多数据的绘制,但同时也会更消耗CPU。
|
||||
|
||||
## 日志
|
||||
|
||||
- [更新日志](Documentation~/zh/changelog.md)
|
||||
- 各版本的详细更新日志请查看 [更新日志](Documentation~/zh/changelog.md)
|
||||
|
||||
## Licenses
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace XCharts.Runtime
|
||||
radiusAxis.axisLabel.show = false;
|
||||
|
||||
var tooltip = EnsureChartComponent<Tooltip>();
|
||||
tooltip.type = Tooltip.Type.Corss;
|
||||
tooltip.type = Tooltip.Type.Cross;
|
||||
tooltip.trigger = Tooltip.Trigger.Axis;
|
||||
|
||||
RemoveData();
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Runtime
|
||||
animationType = attribute.type;
|
||||
enableSerieDataAnimation = attribute.enableSerieDataAddedAnimation;
|
||||
}
|
||||
UpdateAnimationType(serie.animation, animationType,enableSerieDataAnimation);
|
||||
UpdateAnimationType(serie.animation, animationType, enableSerieDataAnimation);
|
||||
}
|
||||
|
||||
public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType, bool enableSerieDataAnimation)
|
||||
@@ -48,12 +48,12 @@ namespace XCharts.Runtime
|
||||
animation.context.enableSerieDataAddedAnimation = enableSerieDataAnimation;
|
||||
}
|
||||
|
||||
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)
|
||||
public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip, ref float rate)
|
||||
{
|
||||
if (animation.context.type == AnimationType.AlongPath)
|
||||
{
|
||||
var dist = Vector3.Distance(lp, cp);
|
||||
var rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
|
||||
rate = (dist - animation.context.currentPathDistance + animation.GetCurrDetail()) / dist;
|
||||
ip = Vector3.Lerp(lp, cp, rate);
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +62,15 @@ namespace XCharts.Runtime
|
||||
var startPos = isY ? new Vector3(-10000, progress) : new Vector3(progress, -10000);
|
||||
var endPos = isY ? new Vector3(10000, progress) : new Vector3(progress, 10000);
|
||||
|
||||
return UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip);
|
||||
if (UGLHelper.GetIntersection(lp, cp, startPos, endPos, ref ip))
|
||||
{
|
||||
rate = Vector3.Distance(lp, ip) / Vector3.Distance(lp, cp);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ namespace XCharts.Runtime
|
||||
Left,
|
||||
Right,
|
||||
Bottom,
|
||||
Top
|
||||
Top,
|
||||
Center
|
||||
}
|
||||
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
@@ -98,6 +99,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected bool m_Inverse = false;
|
||||
[SerializeField] private bool m_Clockwise = true;
|
||||
[SerializeField] private bool m_InsertDataToHead;
|
||||
[SerializeField][Since("v3.11.0")] private float m_MinCategorySpacing = 0;
|
||||
[SerializeField] protected List<Sprite> m_Icons = new List<Sprite>();
|
||||
[SerializeField] protected List<string> m_Data = new List<string>();
|
||||
[SerializeField] protected AxisLine m_AxisLine = AxisLine.defaultAxisLine;
|
||||
@@ -405,6 +407,15 @@ namespace XCharts.Runtime
|
||||
get { return m_InsertDataToHead; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The minimum spacing between categories.
|
||||
/// ||类目之间的最小间距。
|
||||
/// </summary>
|
||||
public float minCategorySpacing
|
||||
{
|
||||
get { return m_MinCategorySpacing; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_MinCategorySpacing, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty
|
||||
{
|
||||
@@ -458,6 +469,17 @@ namespace XCharts.Runtime
|
||||
base.SetComponentDirty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置状态。
|
||||
/// </summary>
|
||||
public override void ResetStatus()
|
||||
{
|
||||
context.minValue = 0;
|
||||
context.maxValue = 0;
|
||||
context.destMinValue = 0;
|
||||
context.destMaxValue = 0;
|
||||
}
|
||||
|
||||
public Axis Clone()
|
||||
{
|
||||
var axis = new Axis();
|
||||
@@ -729,10 +751,14 @@ namespace XCharts.Runtime
|
||||
/// <param name="value"></param>
|
||||
/// <param name="axisLength"></param>
|
||||
/// <returns></returns>
|
||||
public float GetDistance(double value, float axisLength)
|
||||
public float GetDistance(double value, float axisLength = 0)
|
||||
{
|
||||
if (context.minMaxRange == 0)
|
||||
return 0;
|
||||
if (axisLength == 0)
|
||||
{
|
||||
axisLength = context.length;
|
||||
}
|
||||
|
||||
if (IsCategory() && boundaryGap)
|
||||
{
|
||||
@@ -919,5 +945,43 @@ namespace XCharts.Runtime
|
||||
(float)(Math.Abs(context.minValue) * (axisLength / (Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
|
||||
);
|
||||
}
|
||||
|
||||
public Vector3 GetCategoryPosition(int categoryIndex, int dataCount = 0)
|
||||
{
|
||||
if (dataCount <= 0)
|
||||
{
|
||||
dataCount = data.Count;
|
||||
}
|
||||
if (IsCategory() && dataCount > 0)
|
||||
{
|
||||
Vector3 pos;
|
||||
if (boundaryGap)
|
||||
{
|
||||
var each = context.length / dataCount;
|
||||
pos = context.start + context.dire * (each * (categoryIndex + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
var each = context.length / (dataCount - 1);
|
||||
pos = context.start + context.dire * (each * categoryIndex);
|
||||
}
|
||||
if (axisLabel.distance != 0)
|
||||
{
|
||||
if (this is YAxis)
|
||||
{
|
||||
pos.x = GetLabelObjectPosition(0).x;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y = GetLabelObjectPosition(0).y;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
160
Runtime/Component/Axis/Axis3DHelper.cs
Normal file
160
Runtime/Component/Axis/Axis3DHelper.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XUGL;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
public static class Axis3DHelper
|
||||
{
|
||||
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)
|
||||
{
|
||||
var x = xAxis.GetDistance(xValue);
|
||||
var y = yAxis.GetDistance(yValue);
|
||||
var z = zAxis.GetDistance(zValue);
|
||||
|
||||
var dest = grid.context.pointA;
|
||||
dest += xAxis.context.dire * x;
|
||||
dest += yAxis.context.dire * y;
|
||||
dest += zAxis.context.dire * z;
|
||||
return dest;
|
||||
}
|
||||
|
||||
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)
|
||||
{
|
||||
var x = xAxis.GetDistance(xValue);
|
||||
var y = yAxis.GetDistance(yValue);
|
||||
|
||||
var dest = grid.context.pointA;
|
||||
dest += xAxis.context.dire * x;
|
||||
dest += yAxis.context.dire * y;
|
||||
return dest;
|
||||
}
|
||||
|
||||
internal static void DrawAxisTick(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
|
||||
Vector3 start, Vector3 end, Vector3 relativedDire)
|
||||
{
|
||||
var tickLength = axis.axisTick.GetLength(theme.tickLength);
|
||||
var axisLength = Vector3.Distance(start, end);
|
||||
var axisDire = (end - start).normalized;
|
||||
|
||||
if (axis.position == Axis.AxisPosition.Right)
|
||||
{
|
||||
relativedDire = -relativedDire;
|
||||
}
|
||||
|
||||
if (AxisHelper.NeedShowSplit(axis))
|
||||
{
|
||||
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
|
||||
if (axis.IsTime())
|
||||
{
|
||||
size += 1;
|
||||
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
|
||||
size += 1;
|
||||
}
|
||||
var tickWidth = axis.axisTick.GetWidth(theme.tickWidth);
|
||||
var tickColor = axis.axisTick.GetColor(theme.tickColor);
|
||||
var current = start;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
var hideTick = (i == 0 && (!axis.axisTick.showStartTick || axis.axisTick.alignWithLabel)) ||
|
||||
(i == size - 1 && !axis.axisTick.showEndTick);
|
||||
if (axis.axisTick.show && !hideTick)
|
||||
{
|
||||
UGL.DrawLine(vh, current, current + relativedDire * tickLength, tickWidth, tickColor);
|
||||
}
|
||||
current += axisDire * scaleWidth;
|
||||
}
|
||||
}
|
||||
if (axis.show && axis.axisLine.show && axis.axisLine.showArrow)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawAxisSplit(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
|
||||
Vector3 start, Vector3 end, Axis relativedAxis)
|
||||
{
|
||||
if (relativedAxis == null) return;
|
||||
var axisLength = Vector3.Distance(start, end);
|
||||
var axisDire = (end - start).normalized;
|
||||
var splitLength = relativedAxis.context.length;
|
||||
var relativeDire = relativedAxis.context.dire;
|
||||
var axisLineWidth = axis.axisLine.GetWidth(theme.lineWidth);
|
||||
splitLength -= axisLineWidth;
|
||||
var lineColor = axis.splitLine.GetColor(theme.splitLineColor);
|
||||
var lineWidth = axis.splitLine.GetWidth(theme.lineWidth);
|
||||
var lineType = axis.splitLine.GetType(theme.splitLineType);
|
||||
|
||||
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
|
||||
if (axis.IsTime())
|
||||
{
|
||||
size += 1;
|
||||
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
|
||||
size += 1;
|
||||
}
|
||||
|
||||
var current = start;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
|
||||
if (axis.boundaryGap && axis.axisTick.alignWithLabel)
|
||||
current -= axisDire * scaleWidth / 2;
|
||||
|
||||
if (axis.splitArea.show && i <= size - 1)
|
||||
{
|
||||
var p1 = current;
|
||||
var p2 = current + relativeDire * splitLength;
|
||||
var p3 = p2 + axisDire * scaleWidth;
|
||||
var p4 = p1 + axisDire * scaleWidth;
|
||||
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, axis.splitArea.GetColor(i, theme));
|
||||
}
|
||||
if (axis.splitLine.show)
|
||||
{
|
||||
if (axis.splitLine.NeedShow(i, size))
|
||||
{
|
||||
if (relativedAxis == null || !relativedAxis.axisLine.show
|
||||
|| (Vector3.Distance(current, relativedAxis.context.start) > 0.5f && Vector3.Distance(current, relativedAxis.context.end) > 0.5f))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
lineType,
|
||||
lineWidth,
|
||||
current,
|
||||
current + relativeDire * splitLength,
|
||||
lineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
current += axisDire * scaleWidth;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)
|
||||
{
|
||||
var axisStart = axis.context.start;
|
||||
var axisEnd = axis.context.end;
|
||||
var axisDire = axis.context.dire;
|
||||
var relativedDire = relativedAxis != null ? relativedAxis.context.dire : Vector3.zero;
|
||||
var axisLength = Vector3.Distance(axisStart, axisEnd);
|
||||
var inside = axis.axisLabel.inside;
|
||||
var fontSize = axis.axisLabel.textStyle.GetFontSize(theme);
|
||||
var current = axis.offset;
|
||||
|
||||
if (axis.position == Axis.AxisPosition.Right)
|
||||
{
|
||||
relativedDire = -relativedDire;
|
||||
}
|
||||
|
||||
if (axis.IsTime() || axis.IsValue())
|
||||
{
|
||||
scaleWid = axis.context.minMaxRange != 0 ?
|
||||
axis.GetDistance(axis.GetLabelValue(i), axisLength) :
|
||||
0;
|
||||
}
|
||||
|
||||
return axisStart + axisDire * scaleWid + axis.axisLabel.offset - relativedDire * (axis.axisLabel.distance + fontSize / 2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/Axis3DHelper.cs.meta
Normal file
11
Runtime/Component/Axis/Axis3DHelper.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52469636872044a81a291bb00b71a140
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,6 +15,9 @@ namespace XCharts.Runtime
|
||||
/// 坐标轴的起点Y
|
||||
/// </summary>
|
||||
public float y;
|
||||
public Vector3 start;
|
||||
public Vector3 end;
|
||||
public Vector3 dire;
|
||||
/// <summary>
|
||||
/// 坐标轴原点X
|
||||
/// </summary>
|
||||
@@ -25,6 +28,7 @@ namespace XCharts.Runtime
|
||||
public float zeroY;
|
||||
public float width;
|
||||
public float height;
|
||||
public float length;
|
||||
public Vector3 position;
|
||||
public float left;
|
||||
public float right;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace XCharts
|
||||
(!axis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
|
||||
{
|
||||
axis.context.pointerValue = j;
|
||||
axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
|
||||
axis.context.pointerLabelPosition = axis.GetCategoryPosition(j, dataCount);
|
||||
if (j != lastPointerValue)
|
||||
{
|
||||
if (chart.onAxisPointerValueChanged != null)
|
||||
@@ -78,7 +78,7 @@ namespace XCharts
|
||||
(!axis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
|
||||
{
|
||||
axis.context.pointerValue = j;
|
||||
axis.context.pointerLabelPosition = axis.GetLabelObjectPosition(j);
|
||||
axis.context.pointerLabelPosition = axis.GetCategoryPosition(j, dataCount);
|
||||
if (j != lastPointerValue)
|
||||
{
|
||||
if (chart.onAxisPointerValueChanged != null)
|
||||
@@ -147,7 +147,7 @@ namespace XCharts
|
||||
if (axis.IsCategory())
|
||||
{
|
||||
axis.context.minValue = 0;
|
||||
axis.context.maxValue = SeriesHelper.GetMaxSerieDataCount(chart.series) - 1;
|
||||
axis.context.maxValue = axis.data.Count > 0 ? axis.data.Count - 1 : SeriesHelper.GetMaxSerieDataCount(chart.series) - 1;
|
||||
axis.context.minMaxRange = axis.context.maxValue;
|
||||
return;
|
||||
}
|
||||
@@ -369,6 +369,115 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitAxis3D(Axis relativedAxis, Orient orient)
|
||||
{
|
||||
Axis axis = component;
|
||||
var axisLength = (axis.context.end - axis.context.start).magnitude;
|
||||
if (axisLength == 0) return;
|
||||
chart.InitAxisRuntimeData(axis);
|
||||
|
||||
var objName = ChartCached.GetComponentObjectName(axis);
|
||||
var axisObj = ChartHelper.AddObject(objName,
|
||||
chart.transform,
|
||||
chart.chartMinAnchor,
|
||||
chart.chartMaxAnchor,
|
||||
chart.chartPivot,
|
||||
chart.chartSizeDelta);
|
||||
|
||||
axisObj.SetActive(axis.show);
|
||||
axisObj.hideFlags = chart.chartHideFlags;
|
||||
ChartHelper.HideAllObject(axisObj);
|
||||
|
||||
axis.gameObject = axisObj;
|
||||
axis.context.labelObjectList.Clear();
|
||||
|
||||
if (!axis.show)
|
||||
return;
|
||||
|
||||
var axisLabelTextStyle = axis.axisLabel.textStyle;
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
var splitNumber = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
|
||||
var totalWidth = 0f;
|
||||
var eachWidth = AxisHelper.GetEachWidth(axis, axisLength, dataZoom);
|
||||
var gapWidth = axis.boundaryGap ? eachWidth / 2 : 0;
|
||||
|
||||
var textWidth = axis.axisLabel.width > 0 ?
|
||||
axis.axisLabel.width :
|
||||
AxisHelper.GetScaleWidth(axis, axisLength, 0, dataZoom);
|
||||
|
||||
var textHeight = axis.axisLabel.height > 0 ?
|
||||
axis.axisLabel.height :
|
||||
20f;
|
||||
|
||||
var isPercentStack = SeriesHelper.IsPercentStack<Bar>(chart.series);
|
||||
var inside = axis.axisLabel.inside;
|
||||
var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
|
||||
((inside && axis.IsLeft()) || (!inside && axis.IsRight()) ?
|
||||
TextAnchor.MiddleLeft :
|
||||
TextAnchor.MiddleRight);
|
||||
if (axis.IsCategory() && axis.boundaryGap)
|
||||
splitNumber -= 1;
|
||||
axis.context.aligment = defaultAlignment;
|
||||
for (int i = 0; i < splitNumber; i++)
|
||||
{
|
||||
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
|
||||
axis.context.destMinValue,
|
||||
axis.context.destMaxValue,
|
||||
dataZoom, isPercentStack);
|
||||
|
||||
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
|
||||
ChartCached.GetAxisLabelName(i),
|
||||
axisObj.transform,
|
||||
new Vector2(textWidth, textHeight),
|
||||
axis, chart.theme.axis, labelName,
|
||||
Color.clear,
|
||||
defaultAlignment,
|
||||
chart.theme.GetColor(i));
|
||||
|
||||
if (i == 0)
|
||||
axis.axisLabel.SetRelatedText(label.text, labelWidth);
|
||||
|
||||
var pos = GetLabelPosition(totalWidth + gapWidth, i);
|
||||
label.SetPosition(pos);
|
||||
axis.context.labelObjectList.Add(label);
|
||||
|
||||
totalWidth += labelWidth;
|
||||
}
|
||||
if (axis.axisName.show)
|
||||
{
|
||||
ChartLabel label = null;
|
||||
var offset = axis.axisName.labelStyle.offset;
|
||||
var autoColor = axis.axisLine.GetColor(chart.theme.axis.lineColor);
|
||||
switch (axis.axisName.labelStyle.position)
|
||||
{
|
||||
case LabelStyle.Position.Start:
|
||||
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.context.start + offset);
|
||||
break;
|
||||
|
||||
case LabelStyle.Position.Middle:
|
||||
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition((axis.context.start + axis.context.end) / 2 + offset);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
label = ChartHelper.AddChartLabel(s_DefaultAxisName, axisObj.transform, axis.axisName.labelStyle,
|
||||
chart.theme.axis, axis.axisName.name, autoColor, TextAnchor.MiddleCenter);
|
||||
label.SetActive(axis.axisName.labelStyle.show);
|
||||
label.SetPosition(axis.context.end + offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitAxis(Axis relativedAxis, Orient orient,
|
||||
float axisStartX, float axisStartY, float axisLength, float relativedLength)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,10 @@ namespace XCharts.Runtime
|
||||
if (axis.splitNumber <= 0)
|
||||
{
|
||||
var eachWid = coordinateWid / dataCount;
|
||||
var min = axis is YAxis ? 20 : 80;
|
||||
|
||||
var min = axis.minCategorySpacing > 0
|
||||
? axis.minCategorySpacing
|
||||
: (Mathf.Abs(axis.context.dire.y) < 0.01 ? 80 : 20);
|
||||
if (eachWid > min) return dataCount;
|
||||
var tick = Mathf.CeilToInt(min / eachWid);
|
||||
return tick <= 1 ? dataCount : (int)(dataCount / tick);
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
[SerializeField][Since("v3.3.0")] private bool m_ShowStartLine = true;
|
||||
[SerializeField][Since("v3.3.0")] private bool m_ShowEndLine = true;
|
||||
[SerializeField][Since("v3.11.0")] private bool m_ShowZLine = true;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the split line and axis line.
|
||||
@@ -53,6 +54,15 @@ namespace XCharts.Runtime
|
||||
get { return m_ShowEndLine; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowEndLine, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the Z axis part of the split line. Generally used for 3D coordinate systems.
|
||||
/// ||是否显示Z轴部分分割线。一般用于3D坐标系。
|
||||
/// </summary>
|
||||
public bool showZLine
|
||||
{
|
||||
get { return m_ShowZLine; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowZLine, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
|
||||
public override void ClearVerticesDirty()
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace XCharts.Runtime
|
||||
axis.context.x = parallel.context.x;
|
||||
axis.context.y = parallel.context.y + (axis.index) * each;
|
||||
axis.context.width = parallel.context.width;
|
||||
axis.context.length = parallel.context.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -52,6 +53,7 @@ namespace XCharts.Runtime
|
||||
axis.context.x = parallel.context.x + (axis.index) * each;
|
||||
axis.context.y = parallel.context.y;
|
||||
axis.context.width = parallel.context.height;
|
||||
axis.context.length = parallel.context.height;
|
||||
}
|
||||
axis.context.orient = m_Orient;
|
||||
axis.context.height = 0;
|
||||
|
||||
@@ -123,6 +123,12 @@ namespace XCharts.Runtime
|
||||
else
|
||||
context.y = chartY + context.bottom;
|
||||
|
||||
context.start = new Vector3(context.x, context.y);
|
||||
if (m_Orient == Orient.Horizonal)
|
||||
context.end = new Vector3(context.x + context.width, context.y);
|
||||
else
|
||||
context.end = new Vector3(context.x, context.y + context.height);
|
||||
context.length = (context.end - context.start).magnitude;
|
||||
context.position = new Vector3(context.x, context.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
@@ -16,7 +17,28 @@ namespace XCharts.Runtime
|
||||
public override void Update()
|
||||
{
|
||||
UpdateAxisMinMaxValue(component.index, component);
|
||||
UpdatePointerValue(component);
|
||||
if (!chart.isTriggerOnClick)
|
||||
{
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
base.OnPointerClick(eventData);
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
base.OnPointerExit(eventData);
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
component.context.pointerValue = double.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
@@ -35,6 +57,11 @@ namespace XCharts.Runtime
|
||||
var relativedAxis = chart.GetChartComponent<YAxis>(axis.gridIndex);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = AxisHelper.GetXAxisXOrY(grid, axis, relativedAxis);
|
||||
axis.context.start = new Vector3(grid.context.x, axis.context.y);
|
||||
axis.context.end = new Vector3(grid.context.x + grid.context.width, axis.context.y);
|
||||
var vec = axis.context.end - axis.context.start;
|
||||
axis.context.dire = vec.normalized;
|
||||
axis.context.length = vec.magnitude;
|
||||
axis.context.zeroY = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x + axis.context.offset;
|
||||
}
|
||||
|
||||
8
Runtime/Component/Axis/XAxis3D.meta
Normal file
8
Runtime/Component/Axis/XAxis3D.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6350e9983955e49c5b48704d3866cbfe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
Runtime/Component/Axis/XAxis3D/XAxis3D.cs
Normal file
36
Runtime/Component/Axis/XAxis3D/XAxis3D.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate.
|
||||
/// ||直角坐标系 grid 中的 x 轴。
|
||||
/// </summary>
|
||||
[Since("v3.11.0")]
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(GridCoord3D))]
|
||||
[ComponentHandler(typeof(XAxis3DHander), true)]
|
||||
public class XAxis3D : Axis
|
||||
{
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = true;
|
||||
m_Type = AxisType.Category;
|
||||
m_Min = 0;
|
||||
m_Max = 0;
|
||||
m_SplitNumber = 0;
|
||||
m_BoundaryGap = true;
|
||||
m_Position = AxisPosition.Bottom;
|
||||
m_Offset = 0;
|
||||
m_Data = new List<string>() { "x1", "x2", "x3", "x4", "x5" };
|
||||
m_Icons = new List<Sprite>(5);
|
||||
splitLine.show = false;
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = true;
|
||||
axisName.name = "X";
|
||||
axisName.labelStyle.position = LabelStyle.Position.Middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/XAxis3D/XAxis3D.cs.meta
Normal file
11
Runtime/Component/Axis/XAxis3D/XAxis3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9129bca9c2a864e1ea337d7eb74d1024
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
190
Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs
Normal file
190
Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
internal sealed class XAxis3DHander : AxisHandler<XAxis3D>
|
||||
{
|
||||
protected override Orient orient { get { return Orient.Horizonal; } }
|
||||
|
||||
public override void InitComponent()
|
||||
{
|
||||
InitXAxis(component);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
UpdateAxisMinMaxValue(component.index, component);
|
||||
if (!chart.isTriggerOnClick)
|
||||
{
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
base.OnPointerClick(eventData);
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
base.OnPointerExit(eventData);
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
component.context.pointerValue = double.PositiveInfinity;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdatePosition(component);
|
||||
DrawXAxisSplit(vh, component);
|
||||
DrawXAxisLine(vh, component);
|
||||
DrawXAxisTick(vh, component);
|
||||
}
|
||||
|
||||
private void UpdatePosition(XAxis3D axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
if (axis.position == Axis.AxisPosition.Right || axis.position == Axis.AxisPosition.Top)
|
||||
{
|
||||
axis.context.start = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
|
||||
axis.context.end = grid.context.pointC;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.context.start = grid.context.pointA;
|
||||
axis.context.end = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
|
||||
}
|
||||
var vect = axis.context.end - axis.context.start;
|
||||
axis.context.x = axis.context.start.x;
|
||||
axis.context.y = axis.context.start.y;
|
||||
axis.context.dire = vect.normalized;
|
||||
axis.context.length = vect.magnitude;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitXAxis(XAxis3D xAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
var xAxisIndex = xAxis.index;
|
||||
xAxis.painter = chart.painter;
|
||||
xAxis.refreshComponent = delegate ()
|
||||
{
|
||||
var yAxis = chart.GetChartComponent<YAxis3D>(xAxis.index);
|
||||
InitAxis3D(yAxis, orient);
|
||||
};
|
||||
xAxis.refreshComponent();
|
||||
}
|
||||
|
||||
internal override void UpdateAxisLabelText(Axis axis)
|
||||
{
|
||||
base.UpdateAxisLabelText(axis);
|
||||
if (axis.IsTime() || axis.IsValue())
|
||||
{
|
||||
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
|
||||
{
|
||||
var label = axis.context.labelObjectList[i];
|
||||
if (label != null)
|
||||
{
|
||||
var pos = GetLabelPosition(0, i);
|
||||
label.SetPosition(pos);
|
||||
CheckValueLabelActive(component, i, label, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Vector3 GetLabelPosition(float scaleWid, int i)
|
||||
{
|
||||
var yAxis = chart.GetChartComponent<YAxis3D>(component.index);
|
||||
return Axis3DHelper.GetLabelPosition(i, component, yAxis, chart.theme.axis, scaleWid);
|
||||
}
|
||||
|
||||
private void DrawXAxisSplit(VertexHelper vh, XAxis3D xAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(xAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
|
||||
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
|
||||
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
|
||||
var isLeft = grid.IsLeft();
|
||||
if (grid.xyExchanged)
|
||||
{
|
||||
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointA,
|
||||
grid.context.pointB,
|
||||
relativedAxis);
|
||||
if (xAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
|
||||
isLeft ? grid.context.pointD : grid.context.pointA,
|
||||
isLeft ? grid.context.pointC : grid.context.pointB,
|
||||
relativedAxis2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointA,
|
||||
grid.context.pointD,
|
||||
relativedAxis);
|
||||
if (xAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointB,
|
||||
grid.context.pointC,
|
||||
relativedAxis2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawXAxisTick(VertexHelper vh, XAxis3D xAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(xAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
|
||||
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisTick(vh, xAxis, chart.theme.axis, dataZoom,
|
||||
xAxis.context.start,
|
||||
xAxis.context.end,
|
||||
-relativedAxis.context.dire);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawXAxisLine(VertexHelper vh, XAxis3D axis)
|
||||
{
|
||||
if (axis.show && axis.axisLine.show)
|
||||
{
|
||||
var theme = chart.theme.axis;
|
||||
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
|
||||
var lineType = axis.axisLine.GetType(theme.lineType);
|
||||
var lineColor = axis.axisLine.GetColor(theme.lineColor);
|
||||
|
||||
var start = axis.context.start;
|
||||
var end = axis.context.end;
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
|
||||
}
|
||||
}
|
||||
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
return component.context.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs.meta
Normal file
11
Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc1147481a423494d963df29b423f3a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -35,6 +35,11 @@ namespace XCharts.Runtime
|
||||
var relativedAxis = chart.GetChartComponent<XAxis>(axis.gridIndex);
|
||||
axis.context.x = AxisHelper.GetYAxisXOrY(grid, axis, relativedAxis);
|
||||
axis.context.y = grid.context.y;
|
||||
axis.context.start = new Vector3(axis.context.x, grid.context.y);
|
||||
axis.context.end = new Vector3(axis.context.x, grid.context.y + grid.context.height);
|
||||
var vect = axis.context.end - axis.context.start;
|
||||
axis.context.dire = vect.normalized;
|
||||
axis.context.length = vect.magnitude;
|
||||
axis.context.zeroX = axis.context.x;
|
||||
axis.context.zeroY = axis.context.y + axis.context.offset;
|
||||
}
|
||||
|
||||
8
Runtime/Component/Axis/YAxis3D.meta
Normal file
8
Runtime/Component/Axis/YAxis3D.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa26616789b6b4903aae479a4c552b89
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Runtime/Component/Axis/YAxis3D/YAxis3D.cs
Normal file
33
Runtime/Component/Axis/YAxis3D/YAxis3D.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate.
|
||||
/// ||直角坐标系 grid 中的 y 轴。
|
||||
/// </summary>
|
||||
[Since("v3.11.0")]
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
|
||||
[ComponentHandler(typeof(YAxis3DHander), true)]
|
||||
public class YAxis3D : Axis
|
||||
{
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = true;
|
||||
m_Type = AxisType.Value;
|
||||
m_Min = 0;
|
||||
m_Max = 0;
|
||||
m_SplitNumber = 0;
|
||||
m_BoundaryGap = false;
|
||||
m_Position = AxisPosition.Left;
|
||||
m_Data = new List<string>(5);
|
||||
splitLine.show = true;
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = false;
|
||||
axisTick.showStartTick = true;
|
||||
axisName.name = "Y";
|
||||
axisName.labelStyle.position = LabelStyle.Position.Middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/YAxis3D/YAxis3D.cs.meta
Normal file
11
Runtime/Component/Axis/YAxis3D/YAxis3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3cb4a6657aaf473bbae7162eb189cc0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
176
Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs
Normal file
176
Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
internal sealed class YAxis3DHander : AxisHandler<YAxis3D>
|
||||
{
|
||||
protected override Orient orient { get { return Orient.Vertical; } }
|
||||
|
||||
public override void InitComponent()
|
||||
{
|
||||
InitYAxis(component);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
UpdateAxisMinMaxValue(component.index, component);
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdatePosition(component);
|
||||
DrawYAxisSplit(vh, component.index, component);
|
||||
DrawYAxisLine(vh, component.index, component);
|
||||
DrawYAxisTick(vh, component.index, component);
|
||||
}
|
||||
|
||||
private void UpdatePosition(YAxis3D axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
if (axis.position == Axis.AxisPosition.Right)
|
||||
{
|
||||
axis.context.start = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
|
||||
axis.context.end = grid.context.pointC;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.context.start = grid.context.pointA;
|
||||
axis.context.end = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
|
||||
}
|
||||
axis.context.x = axis.context.start.x;
|
||||
axis.context.y = axis.context.start.y;
|
||||
var vect = axis.context.end - axis.context.start;
|
||||
axis.context.dire = vect.normalized;
|
||||
axis.context.length = vect.magnitude;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitYAxis(YAxis3D yAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
var yAxisIndex = yAxis.index;
|
||||
yAxis.painter = chart.painter;
|
||||
yAxis.refreshComponent = delegate ()
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<YAxis3D>(yAxis.index);
|
||||
InitAxis3D(xAxis, orient);
|
||||
}
|
||||
};
|
||||
yAxis.refreshComponent();
|
||||
}
|
||||
|
||||
internal override void UpdateAxisLabelText(Axis axis)
|
||||
{
|
||||
base.UpdateAxisLabelText(axis);
|
||||
if (axis.IsTime() || axis.IsValue())
|
||||
{
|
||||
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
|
||||
{
|
||||
var label = axis.context.labelObjectList[i];
|
||||
if (label != null)
|
||||
{
|
||||
var pos = GetLabelPosition(0, i);
|
||||
label.SetPosition(pos);
|
||||
CheckValueLabelActive(axis, i, label, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Vector3 GetLabelPosition(float scaleWid, int i)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<XAxis3D>(component.index);
|
||||
return Axis3DHelper.GetLabelPosition(i, component, xAxis, chart.theme.axis, scaleWid);
|
||||
}
|
||||
|
||||
private void DrawYAxisSplit(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(yAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
|
||||
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
|
||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||
var isLeft = grid.IsLeft();
|
||||
if (grid.xyExchanged)
|
||||
{
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointA,
|
||||
grid.context.pointD,
|
||||
relativedAxis);
|
||||
if (yAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointB, grid.context.pointC, relativedAxis2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointA,
|
||||
grid.context.pointB,
|
||||
relativedAxis);
|
||||
if (yAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
isLeft ? grid.context.pointD : grid.context.pointA,
|
||||
isLeft ? grid.context.pointC : grid.context.pointB,
|
||||
relativedAxis2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawYAxisTick(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(yAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
|
||||
|
||||
Axis3DHelper.DrawAxisTick(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
yAxis.context.start,
|
||||
yAxis.context.end,
|
||||
-relativedAxis.context.dire);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawYAxisLine(VertexHelper vh, int axisIndex, YAxis3D axis)
|
||||
{
|
||||
if (axis.show && axis.axisLine.show)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var theme = chart.theme.axis;
|
||||
|
||||
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
|
||||
var lineType = axis.axisLine.GetType(theme.lineType);
|
||||
var lineColor = axis.axisLine.GetColor(theme.lineColor);
|
||||
|
||||
var start = axis.context.start;
|
||||
var end = axis.context.end;
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
|
||||
}
|
||||
}
|
||||
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
return component.context.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs.meta
Normal file
11
Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56b4be734c61645e1bf91c22a6e3da6c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Runtime/Component/Axis/ZAxis3D.meta
Normal file
8
Runtime/Component/Axis/ZAxis3D.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 378448672ed084b0798c7ad343314693
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs
Normal file
33
Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The x axis in cartesian(rectangular) coordinate.
|
||||
/// ||直角坐标系 grid 中的 y 轴。
|
||||
/// </summary>
|
||||
[Since("v3.11.0")]
|
||||
[System.Serializable]
|
||||
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
|
||||
[ComponentHandler(typeof(ZAxis3DHander), true)]
|
||||
public class ZAxis3D : Axis
|
||||
{
|
||||
public override void SetDefaultValue()
|
||||
{
|
||||
m_Show = true;
|
||||
m_Type = AxisType.Value;
|
||||
m_Min = 0;
|
||||
m_Max = 0;
|
||||
m_SplitNumber = 0;
|
||||
m_BoundaryGap = false;
|
||||
m_Position = AxisPosition.Left;
|
||||
m_Data = new List<string>(5);
|
||||
splitLine.show = true;
|
||||
splitLine.lineStyle.type = LineStyle.Type.None;
|
||||
axisLabel.textLimit.enable = false;
|
||||
axisTick.showStartTick = true;
|
||||
axisName.name = "Z";
|
||||
axisName.labelStyle.position = LabelStyle.Position.Middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs.meta
Normal file
11
Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65aa8ae88610c431ebdab86935af2379
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
198
Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs
Normal file
198
Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs
Normal file
@@ -0,0 +1,198 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
internal sealed class ZAxis3DHander : AxisHandler<ZAxis3D>
|
||||
{
|
||||
protected override Orient orient { get { return Orient.Vertical; } }
|
||||
|
||||
public override void InitComponent()
|
||||
{
|
||||
InitYAxis(component);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
UpdateAxisMinMaxValue(component.index, component);
|
||||
UpdatePointerValue(component);
|
||||
}
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdatePosition(component);
|
||||
DrawZAxisSplit(vh, component.index, component);
|
||||
DrawZAxisLine(vh, component.index, component);
|
||||
DrawZAxisTick(vh, component.index, component);
|
||||
}
|
||||
|
||||
private void UpdatePosition(ZAxis3D axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
if (grid.context.pointB.x < grid.context.pointA.x)
|
||||
{
|
||||
axis.context.start = grid.context.pointD;
|
||||
axis.context.end = grid.context.pointH;
|
||||
}
|
||||
else if (axis.position == Axis.AxisPosition.Center)
|
||||
{
|
||||
axis.context.start = grid.context.pointB;
|
||||
axis.context.end = grid.context.pointF;
|
||||
}
|
||||
else if (axis.position == Axis.AxisPosition.Right)
|
||||
{
|
||||
axis.context.start = grid.context.pointC;
|
||||
axis.context.end = grid.context.pointG;
|
||||
}
|
||||
else
|
||||
{
|
||||
axis.context.start = grid.context.pointA;
|
||||
axis.context.end = grid.context.pointE;
|
||||
}
|
||||
axis.context.x = axis.context.start.x;
|
||||
axis.context.y = axis.context.start.y;
|
||||
var vect = axis.context.end - axis.context.start;
|
||||
axis.context.dire = vect.normalized;
|
||||
axis.context.length = vect.magnitude;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitYAxis(ZAxis3D yAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
var yAxisIndex = yAxis.index;
|
||||
yAxis.painter = chart.painter;
|
||||
yAxis.refreshComponent = delegate ()
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<ZAxis3D>(yAxis.index);
|
||||
InitAxis3D(relativedAxis, orient);
|
||||
}
|
||||
};
|
||||
yAxis.refreshComponent();
|
||||
}
|
||||
|
||||
internal override void UpdateAxisLabelText(Axis axis)
|
||||
{
|
||||
base.UpdateAxisLabelText(axis);
|
||||
if (axis.IsTime() || axis.IsValue())
|
||||
{
|
||||
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
|
||||
{
|
||||
var label = axis.context.labelObjectList[i];
|
||||
if (label != null)
|
||||
{
|
||||
var pos = GetLabelPosition(0, i);
|
||||
label.SetPosition(pos);
|
||||
CheckValueLabelActive(axis, i, label, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override Vector3 GetLabelPosition(float scaleWid, int i)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(component.gridIndex);
|
||||
if (grid == null)
|
||||
return Vector3.zero;
|
||||
|
||||
var yAxis = chart.GetChartComponent<XAxis3D>(component.index);
|
||||
return Axis3DHelper.GetLabelPosition(i, component, yAxis,
|
||||
chart.theme.axis,
|
||||
scaleWid);
|
||||
}
|
||||
|
||||
private void DrawZAxisSplit(VertexHelper vh, int yAxisIndex, ZAxis3D yAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(yAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var isLeft = grid.IsLeft();
|
||||
if (grid.xyExchanged)
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
|
||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
isLeft ? grid.context.pointD : grid.context.pointA,
|
||||
isLeft ? grid.context.pointH : grid.context.pointE,
|
||||
relativedAxis);
|
||||
if (yAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointB,
|
||||
grid.context.pointF,
|
||||
relativedAxis2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
|
||||
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
isLeft ? grid.context.pointD : grid.context.pointA,
|
||||
isLeft ? grid.context.pointH : grid.context.pointE,
|
||||
relativedAxis);
|
||||
if (yAxis.splitLine.showZLine)
|
||||
{
|
||||
var relativedAxis2 = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
|
||||
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
|
||||
grid.context.pointB,
|
||||
grid.context.pointF,
|
||||
relativedAxis2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawZAxisTick(VertexHelper vh, int yAxisIndex, ZAxis3D zAxis)
|
||||
{
|
||||
if (AxisHelper.NeedShowSplit(zAxis))
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(zAxis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(zAxis);
|
||||
var relativedDire = grid.context.pointA - grid.context.pointB;
|
||||
Axis3DHelper.DrawAxisTick(vh, zAxis, chart.theme.axis, dataZoom,
|
||||
zAxis.context.start,
|
||||
zAxis.context.end,
|
||||
relativedDire.normalized);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawZAxisLine(VertexHelper vh, int axisIndex, ZAxis3D axis)
|
||||
{
|
||||
if (axis.show && axis.axisLine.show)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
|
||||
if (grid == null)
|
||||
return;
|
||||
|
||||
var theme = chart.theme.axis;
|
||||
|
||||
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
|
||||
var lineType = axis.axisLine.GetType(theme.lineType);
|
||||
var lineColor = axis.axisLine.GetColor(theme.lineColor);
|
||||
|
||||
var start = axis.context.start;
|
||||
var end = axis.context.end;
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
|
||||
}
|
||||
}
|
||||
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
return component.context.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs.meta
Normal file
11
Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67fb4be32885d4915979719c676aac5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -37,7 +37,7 @@ namespace XCharts.Runtime
|
||||
/// crosshair indicator, which is actually the shortcut of enable two axisPointers of two orthometric axes.
|
||||
/// ||十字准星指示器。坐标轴显示Label和交叉线。
|
||||
/// </summary>
|
||||
Corss,
|
||||
Cross,
|
||||
/// <summary>
|
||||
/// Auto select indicator according to serie type.
|
||||
/// ||根据serie的类型自动选择显示指示器。
|
||||
@@ -73,6 +73,23 @@ namespace XCharts.Runtime
|
||||
Auto
|
||||
}
|
||||
/// <summary>
|
||||
/// the condition of trigger tooltip.
|
||||
/// ||触发条件。
|
||||
/// </summary>
|
||||
public enum TriggerOn
|
||||
{
|
||||
/// <summary>
|
||||
/// Trigger when mouse move.
|
||||
/// ||鼠标移动时触发。
|
||||
/// </summary>
|
||||
MouseMove,
|
||||
/// <summary>
|
||||
/// Trigger when mouse click.
|
||||
/// ||鼠标点击时触发。
|
||||
/// </summary>
|
||||
Click,
|
||||
}
|
||||
/// <summary>
|
||||
/// Position type.
|
||||
/// ||坐标类型。
|
||||
/// </summary>
|
||||
@@ -102,6 +119,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private Type m_Type = Type.Auto;
|
||||
[SerializeField] private Trigger m_Trigger = Trigger.Auto;
|
||||
[SerializeField][Since("v3.11.0")] private TriggerOn m_TriggerOn = TriggerOn.MouseMove;
|
||||
[SerializeField][Since("v3.3.0")] private Position m_Position = Position.Auto;
|
||||
[SerializeField] private string m_ItemFormatter;
|
||||
[SerializeField] private string m_TitleFormatter;
|
||||
@@ -144,6 +162,12 @@ namespace XCharts.Runtime
|
||||
public TooltipContext context = new TooltipContext();
|
||||
public TooltipView view;
|
||||
|
||||
/// <summary>
|
||||
/// the callback of tooltip click index.
|
||||
/// ||Tooltip为Click触发时,点击的X轴索引的回调。
|
||||
/// </summary>
|
||||
public System.Action<int> onClickIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show the tooltip component.
|
||||
/// ||是否显示提示框组件。
|
||||
@@ -172,6 +196,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Trigger, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Condition of trigger tooltip.
|
||||
/// ||触发条件。
|
||||
/// </summary>
|
||||
public TriggerOn triggerOn
|
||||
{
|
||||
get { return m_TriggerOn; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_TriggerOn, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Type of position.
|
||||
/// ||显示位置类型。
|
||||
/// </summary>
|
||||
@@ -211,7 +244,7 @@ namespace XCharts.Runtime
|
||||
/// {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/>
|
||||
/// {f}为数据总和。<br/>
|
||||
/// {g}为数据总个数。<br/>
|
||||
/// {f}为value所对应的y轴的类目值。<br/>
|
||||
/// {y}为value所对应的y轴的类目值。<br/>
|
||||
/// {.1}表示指定index为1的serie对应颜色的圆点。<br/>
|
||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/>
|
||||
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/>
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace XCharts.Runtime
|
||||
public float width;
|
||||
public float height;
|
||||
public float angle;
|
||||
public int xAxisClickIndex = -1;
|
||||
public Tooltip.Type type;
|
||||
public Tooltip.Trigger trigger;
|
||||
public TooltipData data = new TooltipData();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using XUGL;
|
||||
|
||||
@@ -36,6 +37,15 @@ namespace XCharts.Runtime
|
||||
DrawTooltipIndicator(vh, component);
|
||||
}
|
||||
|
||||
public override void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
base.OnPointerExit(eventData);
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
component.context.xAxisClickIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitTooltip(Tooltip tooltip)
|
||||
{
|
||||
tooltip.painter = chart.m_PainterUpper;
|
||||
@@ -55,6 +65,7 @@ namespace XCharts.Runtime
|
||||
|
||||
m_LabelRoot = ChartHelper.AddObject("label", tooltip.gameObject.transform, chart.chartMinAnchor,
|
||||
chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
m_LabelRoot.transform.SetSiblingIndex(0);
|
||||
ChartHelper.HideAllObject(m_LabelRoot);
|
||||
m_IndicatorLabels.Clear();
|
||||
foreach (var com in chart.components)
|
||||
@@ -70,6 +81,7 @@ namespace XCharts.Runtime
|
||||
m_IndicatorLabels[labelName] = item;
|
||||
}
|
||||
}
|
||||
chart.isTriggerOnClick = tooltip.triggerOn == Tooltip.TriggerOn.Click;
|
||||
};
|
||||
tooltip.refreshComponent();
|
||||
}
|
||||
@@ -93,39 +105,57 @@ namespace XCharts.Runtime
|
||||
|
||||
private void UpdateTooltipData(Tooltip tooltip)
|
||||
{
|
||||
showTooltip = false;
|
||||
m_ShowTooltip = false;
|
||||
if (tooltip.trigger == Tooltip.Trigger.None) return;
|
||||
if (chart.isPointerInChart && tooltip.show)
|
||||
chart.isTriggerOnClick = tooltip.triggerOn == Tooltip.TriggerOn.Click;
|
||||
|
||||
if ((tooltip.show && chart.isPointerInChart) &&
|
||||
((tooltip.triggerOn == Tooltip.TriggerOn.Click && chart.isPointerClick) ||
|
||||
(tooltip.triggerOn == Tooltip.TriggerOn.MouseMove))
|
||||
)
|
||||
{
|
||||
for (int i = chart.series.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var serie = chart.series[i];
|
||||
if (!(serie is INeedSerieContainer))
|
||||
{
|
||||
showTooltip = true;
|
||||
containerSeries = null;
|
||||
m_ShowTooltip = true;
|
||||
m_ContainerSeries = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
containerSeries = ListPool<Serie>.Get();
|
||||
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref containerSeries);
|
||||
if (containerSeries.Count > 0)
|
||||
m_ContainerSeries = ListPool<Serie>.Get();
|
||||
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref m_ContainerSeries);
|
||||
if (m_ContainerSeries.Count > 0)
|
||||
{
|
||||
showTooltip = true;
|
||||
m_ShowTooltip = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!showTooltip && tooltip.IsActive())
|
||||
|
||||
if (!m_ShowTooltip && tooltip.IsActive())
|
||||
{
|
||||
tooltip.ClearValue();
|
||||
tooltip.SetActive(false);
|
||||
component.context.xAxisClickIndex = -1;
|
||||
chart.pointerClickEventData = null;
|
||||
}
|
||||
}
|
||||
|
||||
private bool showTooltip;
|
||||
private List<Serie> containerSeries;
|
||||
private bool m_ShowTooltip;
|
||||
private List<Serie> m_ContainerSeries;
|
||||
private void UpdateTooltip(Tooltip tooltip)
|
||||
{
|
||||
if (!showTooltip) return;
|
||||
if (!m_ShowTooltip)
|
||||
{
|
||||
if (m_ContainerSeries != null)
|
||||
{
|
||||
ListPool<Serie>.Release(m_ContainerSeries);
|
||||
m_ContainerSeries = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var anyTrigger = false;
|
||||
for (int i = chart.series.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -140,24 +170,33 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
}
|
||||
if (containerSeries != null)
|
||||
if (!anyTrigger && m_ContainerSeries == null)
|
||||
{
|
||||
if (!SetSerieTooltip(tooltip, containerSeries))
|
||||
showTooltip = false;
|
||||
m_ContainerSeries = ListPool<Serie>.Get();
|
||||
UpdatePointerContainerAndSeriesAndTooltip(tooltip, ref m_ContainerSeries);
|
||||
}
|
||||
if (m_ContainerSeries != null)
|
||||
{
|
||||
if (!SetSerieTooltip(tooltip, m_ContainerSeries))
|
||||
m_ShowTooltip = false;
|
||||
else
|
||||
anyTrigger = true;
|
||||
ListPool<Serie>.Release(containerSeries);
|
||||
ListPool<Serie>.Release(m_ContainerSeries);
|
||||
m_ContainerSeries = null;
|
||||
}
|
||||
if (!showTooltip || !anyTrigger)
|
||||
if (!m_ShowTooltip || !anyTrigger)
|
||||
{
|
||||
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
||||
if (tooltip.context.type == Tooltip.Type.Cross && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
||||
{
|
||||
m_ShowTooltip = true;
|
||||
tooltip.SetActive(true);
|
||||
tooltip.SetContentActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ShowTooltip = false;
|
||||
tooltip.SetActive(false);
|
||||
chart.pointerClickEventData = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -172,7 +211,7 @@ namespace XCharts.Runtime
|
||||
if (tooltip.context.type == Tooltip.Type.None) return;
|
||||
if (m_PointerContainer != null)
|
||||
{
|
||||
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||
if (tooltip.context.type == Tooltip.Type.Cross)
|
||||
{
|
||||
if (m_PointerContainer is GridCoord)
|
||||
{
|
||||
@@ -223,7 +262,8 @@ namespace XCharts.Runtime
|
||||
if (axis.IsCategory())
|
||||
{
|
||||
var index = (int)axis.context.pointerValue;
|
||||
var category = axis.GetData(index);
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
var category = axis.GetData(index, dataZoom);
|
||||
label.SetText(axis.indicatorLabel.GetFormatterContent(index, category));
|
||||
}
|
||||
else if (axis.IsTime())
|
||||
@@ -274,20 +314,26 @@ namespace XCharts.Runtime
|
||||
serie.context.tooltipTrigger : tooltip.trigger;
|
||||
}
|
||||
var isTriggerAxis = tooltip.IsTriggerAxis();
|
||||
var inchart = true;
|
||||
if (container is GridCoord)
|
||||
{
|
||||
var xAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||
UpdateAxisPointerDataIndex(serie, xAxis, yAxis, container as GridCoord, isTriggerAxis);
|
||||
inchart = UpdateAxisPointerDataIndex(serie, xAxis, yAxis, container as GridCoord, isTriggerAxis);
|
||||
}
|
||||
else if (container is PolarCoord)
|
||||
{
|
||||
var m_AngleAxis = ComponentHelper.GetAngleAxis(chart.components, container.index);
|
||||
tooltip.context.angle = (float)m_AngleAxis.context.pointerValue;
|
||||
}
|
||||
list.Add(serie);
|
||||
if (!isTriggerAxis)
|
||||
chart.RefreshTopPainter();
|
||||
if (inchart)
|
||||
{
|
||||
list.Add(serie);
|
||||
if (!isTriggerAxis)
|
||||
{
|
||||
chart.RefreshTopPainter();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_PointerContainer = container;
|
||||
@@ -296,10 +342,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||
private bool UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||
{
|
||||
serie.context.pointerAxisDataIndexs.Clear();
|
||||
if (xAxis == null || yAxis == null) return;
|
||||
if (xAxis == null || yAxis == null) return false;
|
||||
var flag = true;
|
||||
if (serie is Heatmap)
|
||||
{
|
||||
GetSerieDataByXYAxis(serie, xAxis, yAxis);
|
||||
@@ -328,20 +375,45 @@ namespace XCharts.Runtime
|
||||
if (isTriggerAxis)
|
||||
{
|
||||
var index = serie.context.dataZoomStartIndex + (int)xAxis.context.pointerValue;
|
||||
if (chart.isTriggerOnClick)
|
||||
{
|
||||
if (serie.insertDataToHead)
|
||||
index = index + (serie.context.totalDataIndex - serie.context.clickTotalDataIndex);
|
||||
else if (serie.context.totalDataIndex >= serie.dataCount)
|
||||
index = index - (serie.context.totalDataIndex - serie.context.clickTotalDataIndex);
|
||||
if (index < 0 || index >= serie.dataCount)
|
||||
{
|
||||
index = -1;
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
if (component.context.xAxisClickIndex != index)
|
||||
{
|
||||
component.context.xAxisClickIndex = index;
|
||||
if (component.onClickIndex != null)
|
||||
{
|
||||
component.onClickIndex(index);
|
||||
}
|
||||
}
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerAxisDataIndexs.Add(index);
|
||||
serie.context.pointerItemDataIndex = index;
|
||||
xAxis.context.axisTooltipValue = xAxis.context.pointerValue;
|
||||
xAxis.context.axisTooltipValue = index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
if (isTriggerAxis)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
GetSerieDataIndexByAxis(serie, xAxis, grid);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSerieDataIndexByItem(serie, xAxis, grid);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private void GetSerieDataByXYAxis(Serie serie, Axis xAxis, Axis yAxis)
|
||||
@@ -446,7 +518,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
axis.context.axisTooltipValue = serie.GetSerieData(serie.context.pointerItemDataIndex).GetData(dimension);
|
||||
}
|
||||
else if (component.type == Tooltip.Type.Corss)
|
||||
else if (component.type == Tooltip.Type.Cross)
|
||||
{
|
||||
axis.context.axisTooltipValue = axis.context.pointerValue;
|
||||
}
|
||||
@@ -464,7 +536,7 @@ namespace XCharts.Runtime
|
||||
if (tooltip.context.trigger == Tooltip.Trigger.None) return false;
|
||||
tooltip.context.data.param.Clear();
|
||||
tooltip.context.data.title = serie.serieName;
|
||||
tooltip.context.pointer = chart.pointerPos;
|
||||
tooltip.context.pointer = GetTooltipPointerPos();
|
||||
|
||||
serie.handler.UpdateTooltipSerieParams(serie.context.pointerItemDataIndex, false, null,
|
||||
tooltip.marker, tooltip.itemFormatter, tooltip.numericFormatter, tooltip.ignoreDataDefaultContent,
|
||||
@@ -472,12 +544,20 @@ namespace XCharts.Runtime
|
||||
ref tooltip.context.data.title);
|
||||
TooltipHelper.ResetTooltipParamsByItemFormatter(tooltip, chart);
|
||||
|
||||
tooltip.SetActive(true);
|
||||
tooltip.SetActive(m_ShowTooltip);
|
||||
tooltip.view.Refresh();
|
||||
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
|
||||
return true;
|
||||
}
|
||||
|
||||
private Vector2 GetTooltipPointerPos()
|
||||
{
|
||||
if (chart.isTriggerOnClick && chart.isPointerClick)
|
||||
return chart.clickPos;
|
||||
else
|
||||
return chart.pointerPos;
|
||||
}
|
||||
|
||||
private bool SetSerieTooltip(Tooltip tooltip, List<Serie> series)
|
||||
{
|
||||
if (tooltip.context.trigger == Tooltip.Trigger.None)
|
||||
@@ -489,10 +569,10 @@ namespace XCharts.Runtime
|
||||
string category = null;
|
||||
var showCategory = false;
|
||||
var isTriggerByAxis = false;
|
||||
var isTriggerByItem = false;
|
||||
var isTriggerByItem = tooltip.context.trigger == Tooltip.Trigger.Item;
|
||||
var dataIndex = -1;
|
||||
tooltip.context.data.param.Clear();
|
||||
tooltip.context.pointer = chart.pointerPos;
|
||||
tooltip.context.pointer = GetTooltipPointerPos();
|
||||
if (m_PointerContainer is GridCoord)
|
||||
{
|
||||
GetAxisCategory(m_PointerContainer.index, ref dataIndex, ref category);
|
||||
@@ -514,11 +594,13 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
var triggerSerieCount = 0;
|
||||
for (int i = 0; i < series.Count; i++)
|
||||
{
|
||||
var serie = series[i];
|
||||
if (!serie.show) continue;
|
||||
if (isTriggerByItem && serie.context.pointerItemDataIndex < 0) continue;
|
||||
triggerSerieCount++;
|
||||
serie.context.isTriggerByAxis = isTriggerByAxis;
|
||||
if (isTriggerByAxis && dataIndex >= 0 && serie.context.pointerItemDataIndex < 0)
|
||||
serie.context.pointerItemDataIndex = dataIndex;
|
||||
@@ -528,10 +610,14 @@ namespace XCharts.Runtime
|
||||
ref tooltip.context.data.param,
|
||||
ref tooltip.context.data.title);
|
||||
}
|
||||
if (triggerSerieCount <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
TooltipHelper.ResetTooltipParamsByItemFormatter(tooltip, chart);
|
||||
if (tooltip.context.data.param.Count > 0 || !string.IsNullOrEmpty(tooltip.context.data.title))
|
||||
{
|
||||
tooltip.SetActive(true);
|
||||
tooltip.SetActive(m_ShowTooltip);
|
||||
if (tooltip.view != null)
|
||||
tooltip.view.Refresh();
|
||||
TooltipHelper.LimitInRect(tooltip, chart.chartRect);
|
||||
@@ -551,7 +637,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
dataIndex = double.IsNaN(axis.context.pointerValue)
|
||||
? axis.context.dataZoomStartIndex
|
||||
: axis.context.dataZoomStartIndex + (int)axis.context.pointerValue;
|
||||
: axis.context.dataZoomStartIndex + (int)axis.context.axisTooltipValue;
|
||||
category = axis.GetData(dataIndex);
|
||||
return true;
|
||||
}
|
||||
@@ -612,7 +698,7 @@ namespace XCharts.Runtime
|
||||
float splitWidth = AxisHelper.GetDataWidth(xAxis, grid.context.width, dataCount, dataZoom);
|
||||
switch (tooltip.context.type)
|
||||
{
|
||||
case Tooltip.Type.Corss:
|
||||
case Tooltip.Type.Cross:
|
||||
case Tooltip.Type.Line:
|
||||
float pX = grid.context.x;
|
||||
pX += xAxis.IsCategory() ?
|
||||
@@ -624,7 +710,7 @@ namespace XCharts.Runtime
|
||||
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||
if (tooltip.context.type == Tooltip.Type.Cross)
|
||||
{
|
||||
sp = new Vector2(grid.context.x, chart.pointerPos.y);
|
||||
ep = new Vector2(grid.context.x + grid.context.width, chart.pointerPos.y);
|
||||
@@ -678,7 +764,7 @@ namespace XCharts.Runtime
|
||||
float splitWidth = AxisHelper.GetDataWidth(yAxis, grid.context.height, dataCount, dataZoom);
|
||||
switch (tooltip.context.type)
|
||||
{
|
||||
case Tooltip.Type.Corss:
|
||||
case Tooltip.Type.Cross:
|
||||
case Tooltip.Type.Line:
|
||||
float pY = (float)(grid.context.y + yAxis.context.pointerValue * splitWidth +
|
||||
(yAxis.boundaryGap ? splitWidth / 2 : 0));
|
||||
@@ -688,7 +774,7 @@ namespace XCharts.Runtime
|
||||
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme.tooltip.lineColor);
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
if (tooltip.context.type == Tooltip.Type.Corss)
|
||||
if (tooltip.context.type == Tooltip.Type.Cross)
|
||||
{
|
||||
sp = new Vector2(chart.pointerPos.x, grid.context.y);
|
||||
ep = new Vector2(chart.pointerPos.x, grid.context.y + grid.context.height);
|
||||
@@ -733,7 +819,7 @@ namespace XCharts.Runtime
|
||||
|
||||
switch (tooltip.context.type)
|
||||
{
|
||||
case Tooltip.Type.Corss:
|
||||
case Tooltip.Type.Cross:
|
||||
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, sp, ep, lineColor);
|
||||
var dist = Vector2.Distance(chart.pointerPos, cenPos);
|
||||
if (dist > radius) dist = radius;
|
||||
|
||||
@@ -386,8 +386,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public float runtimeRangeMinHeight { get { return (float) ((rangeMin - min) / (max - min) * itemHeight); } }
|
||||
public float runtimeRangeMaxHeight { get { return (float) ((rangeMax - min) / (max - min) * itemHeight); } }
|
||||
public float runtimeRangeMinHeight { get { return (float)((rangeMin - min) / (max - min) * itemHeight); } }
|
||||
public float runtimeRangeMaxHeight { get { return (float)((rangeMax - min) / (max - min) * itemHeight); } }
|
||||
|
||||
public void AddColors(List<Color32> colors)
|
||||
{
|
||||
@@ -413,6 +413,25 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public Color32 GetColor(double xValue, double yValue, double zValue, byte alpha = 255)
|
||||
{
|
||||
Color32 color;
|
||||
if (m_Dimension == 0)
|
||||
{
|
||||
color = GetColor(xValue);
|
||||
}
|
||||
else if (m_Dimension == 1)
|
||||
{
|
||||
color = GetColor(yValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = GetColor(zValue);
|
||||
}
|
||||
color.a = alpha;
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetColor(double value)
|
||||
{
|
||||
int index = GetIndex(value);
|
||||
@@ -437,7 +456,7 @@ namespace XCharts.Runtime
|
||||
if (index == splitNumber - 1)
|
||||
return m_InRange[index].color;
|
||||
else
|
||||
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float) rate);
|
||||
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float)rate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
Runtime/Coord/Grid3D.meta
Normal file
8
Runtime/Coord/Grid3D.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14f9081aa22ba4bcb9cdbfbb95c7221e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
270
Runtime/Coord/Grid3D/GridCoord3D.cs
Normal file
270
Runtime/Coord/Grid3D/GridCoord3D.cs
Normal file
@@ -0,0 +1,270 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using XUGL;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// View control component in 3D coordinate system.
|
||||
/// ||3D视角控制组件。
|
||||
/// </summary>
|
||||
[Since("v3.11.0")]
|
||||
[Serializable]
|
||||
public class ViewControl : ChildComponent
|
||||
{
|
||||
[SerializeField][Range(-90, 180)] private float m_Alpha = 90f;
|
||||
[SerializeField][Range(-90, 90)] private float m_Beta = 55f;
|
||||
|
||||
/// <summary>
|
||||
/// The angle of the view in the x-z plane.
|
||||
/// ||视角在x-z平面的角度。
|
||||
/// </summary>
|
||||
public float alpha
|
||||
{
|
||||
get { return m_Alpha; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Alpha, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The angle of the view in the y-z plane.
|
||||
/// ||视角在y-z平面的角度。
|
||||
/// </summary>
|
||||
public float beta
|
||||
{
|
||||
get { return m_Beta; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Beta, value)) SetVerticesDirty(); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid component.
|
||||
/// ||Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
|
||||
/// ||3D网格组件。
|
||||
/// 3D直角坐标系内绘图网格。可以在网格上绘制3D折线图,3D柱状图,3D散点图。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[ComponentHandler(typeof(GridCoord3DHandler), true)]
|
||||
public class GridCoord3D : CoordSystem, IUpdateRuntimeData, ISerieContainer
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Left = 0.15f;
|
||||
[SerializeField] private float m_Right = 0.2f;
|
||||
[SerializeField] private float m_Top = 0.3f;
|
||||
[SerializeField] private float m_Bottom = 0.15f;
|
||||
[SerializeField] private bool m_ShowBorder = false;
|
||||
[SerializeField] private float m_BoxWidth = 0.55f;
|
||||
[SerializeField] private float m_BoxHeight = 0.4f;
|
||||
[SerializeField] private float m_BoxDepth = 0.2f;
|
||||
[SerializeField] private bool m_XYExchanged = false;
|
||||
[SerializeField] private ViewControl m_ViewControl = new ViewControl();
|
||||
|
||||
public GridCoord3DContext context = new GridCoord3DContext();
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show the grid in rectangular coordinate.
|
||||
/// ||是否显示直角坐标系网格。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between grid component and the left side of the container.
|
||||
/// ||grid 组件离容器左侧的距离。
|
||||
/// </summary>
|
||||
public float left
|
||||
{
|
||||
get { return m_Left; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between grid component and the right side of the container.
|
||||
/// ||grid 组件离容器右侧的距离。
|
||||
/// </summary>
|
||||
public float right
|
||||
{
|
||||
get { return m_Right; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between grid component and the top side of the container.
|
||||
/// ||grid 组件离容器上侧的距离。
|
||||
/// </summary>
|
||||
public float top
|
||||
{
|
||||
get { return m_Top; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between grid component and the bottom side of the container.
|
||||
/// ||grid 组件离容器下侧的距离。
|
||||
/// </summary>
|
||||
public float bottom
|
||||
{
|
||||
get { return m_Bottom; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the grid border.
|
||||
/// ||是否显示网格边框。
|
||||
/// </summary>
|
||||
public bool showBorder
|
||||
{
|
||||
get { return m_ShowBorder; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowBorder, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The width of the box in the coordinate system.
|
||||
/// ||坐标系的宽度。
|
||||
/// </summary>
|
||||
public float boxWidth
|
||||
{
|
||||
get { return m_BoxWidth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BoxWidth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The height of the box in the coordinate system.
|
||||
/// ||坐标系的高度。
|
||||
/// </summary>
|
||||
public float boxHeight
|
||||
{
|
||||
get { return m_BoxHeight; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BoxHeight, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The depth of the box in the coordinate system.
|
||||
/// ||坐标系的深度。
|
||||
/// </summary>
|
||||
public float boxDepth
|
||||
{
|
||||
get { return m_BoxDepth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BoxDepth, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to exchange the x and y axes.
|
||||
/// ||是否交换x和y轴。
|
||||
/// </summary>
|
||||
public bool xyExchanged
|
||||
{
|
||||
get { return m_XYExchanged; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_XYExchanged, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// View control component in 3D coordinate system.
|
||||
/// ||3D视角控制组件。
|
||||
/// </summary>
|
||||
public ViewControl viewControl
|
||||
{
|
||||
get { return m_ViewControl; }
|
||||
//set { if (PropertyUtil.SetClass(ref m_ViewControl, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
var actualLeft = left <= 1 ? left * chartWidth : left;
|
||||
var actualBottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
var actualBoxWidth = m_BoxWidth <= 1 ? m_BoxWidth * chartWidth : m_BoxWidth;
|
||||
var actualBoxHeight = m_BoxHeight <= 1 ? m_BoxHeight * chartHeight : m_BoxHeight;
|
||||
var actualBoxDepth = m_BoxDepth <= 1 ? m_BoxDepth * chartWidth : m_BoxDepth;
|
||||
context.x = chartX + actualLeft;
|
||||
context.y = chartY + actualBottom;
|
||||
context.pointA.x = context.x;
|
||||
context.pointA.y = context.y;
|
||||
|
||||
var angle = m_ViewControl.alpha * Mathf.Deg2Rad;
|
||||
context.pointD.x = context.x + actualBoxWidth * Mathf.Sin(angle);
|
||||
context.pointD.y = context.y - actualBoxWidth * Mathf.Cos(angle);
|
||||
|
||||
angle = (90 - m_ViewControl.beta) * Mathf.Deg2Rad;
|
||||
context.pointB.x = context.x + actualBoxDepth * Mathf.Cos(angle);
|
||||
context.pointB.y = context.y + actualBoxDepth * Mathf.Sin(angle);
|
||||
|
||||
context.pointC = context.pointB + (context.pointD - context.pointA);
|
||||
|
||||
context.pointE.x = context.pointA.x;
|
||||
context.pointE.y = context.pointA.y + actualBoxHeight;
|
||||
|
||||
var diff = context.pointE - context.pointA;
|
||||
context.pointF = context.pointB + diff;
|
||||
context.pointG = context.pointC + diff;
|
||||
context.pointH = context.pointD + diff;
|
||||
|
||||
var minX = Mathf.Min(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
|
||||
var minY = Mathf.Min(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
|
||||
var maxX = Mathf.Max(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
|
||||
var maxY = Mathf.Max(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
|
||||
|
||||
context.maxRect.x = minX;
|
||||
context.maxRect.y = minY;
|
||||
context.maxRect.width = maxX - minX;
|
||||
context.maxRect.height = maxY - minY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The opening of the coordinate system faces to the left.
|
||||
/// 坐标系开口朝向左边。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsLeft()
|
||||
{
|
||||
return context.pointB.x < context.pointA.x;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the pointer is in the grid.
|
||||
/// ||指针是否在网格内。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsPointerEnter()
|
||||
{
|
||||
return context.isPointerEnter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the given position is in the grid.
|
||||
/// ||给定的位置是否在网格内。
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public bool Contains(Vector3 pos)
|
||||
{
|
||||
if (!context.maxRect.Contains(pos)) return false;
|
||||
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointB, context.pointC, context.pointD)) return true;
|
||||
if (UGLHelper.IsPointInPolygon(pos, context.pointB, context.pointF, context.pointG, context.pointC)) return true;
|
||||
if (IsLeft())
|
||||
if (UGLHelper.IsPointInPolygon(pos, context.pointC, context.pointG, context.pointH, context.pointD)) return true;
|
||||
else
|
||||
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointE, context.pointF, context.pointB)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clamp the position of pos to the grid.
|
||||
/// ||将位置限制在网格内。
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
public void Clamp(ref Vector3 pos)
|
||||
{
|
||||
//TODO:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a given line segment will not intersect the Grid boundary at all.
|
||||
/// ||判断给定的线段是否与Grid边界是否完全不会相交。
|
||||
/// </summary>
|
||||
/// <param name="sp"></param>
|
||||
/// <param name="ep"></param>
|
||||
/// <returns></returns>
|
||||
public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
|
||||
{
|
||||
//TODO:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid3D/GridCoord3D.cs.meta
Normal file
11
Runtime/Coord/Grid3D/GridCoord3D.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95f8c8c3492e54987af59175d94f8761
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Runtime/Coord/Grid3D/GridCoord3DContext.cs
Normal file
23
Runtime/Coord/Grid3D/GridCoord3DContext.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
public class GridCoord3DContext : MainComponentContext
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public Rect maxRect = new Rect(0, 0, 0, 0);
|
||||
public bool isPointerEnter;
|
||||
public List<ChartLabel> endLabelList = new List<ChartLabel>();
|
||||
//public Vector3 position = Vector3.zero;
|
||||
public Vector3 pointA = Vector3.zero;
|
||||
public Vector3 pointB = Vector3.zero;
|
||||
public Vector3 pointC = Vector3.zero;
|
||||
public Vector3 pointD = Vector3.zero;
|
||||
public Vector3 pointE = Vector3.zero;
|
||||
public Vector3 pointF = Vector3.zero;
|
||||
public Vector3 pointG = Vector3.zero;
|
||||
public Vector3 pointH = Vector3.zero;
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid3D/GridCoord3DContext.cs.meta
Normal file
11
Runtime/Coord/Grid3D/GridCoord3DContext.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4a0f1dda078b4877bfabe3c16815498
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
79
Runtime/Coord/Grid3D/GridCoord3DHandler.cs
Normal file
79
Runtime/Coord/Grid3D/GridCoord3DHandler.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XUGL;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
internal sealed class GridCoord3DHandler : MainComponentHandler<GridCoord3D>
|
||||
{
|
||||
public override void InitComponent()
|
||||
{
|
||||
var grid = component;
|
||||
grid.painter = chart.painter;
|
||||
grid.refreshComponent = delegate ()
|
||||
{
|
||||
grid.UpdateRuntimeData(chart);
|
||||
chart.OnCoordinateChanged();
|
||||
};
|
||||
grid.refreshComponent();
|
||||
}
|
||||
|
||||
public override void CheckComponent(StringBuilder sb)
|
||||
{
|
||||
var grid = component;
|
||||
if (grid.left >= chart.chartWidth)
|
||||
sb.Append("warning:grid->left > chartWidth\n");
|
||||
if (grid.right >= chart.chartWidth)
|
||||
sb.Append("warning:grid->right > chartWidth\n");
|
||||
if (grid.top >= chart.chartHeight)
|
||||
sb.Append("warning:grid->top > chartHeight\n");
|
||||
if (grid.bottom >= chart.chartHeight)
|
||||
sb.Append("warning:grid->bottom > chartHeight\n");
|
||||
if (grid.left + grid.right >= chart.chartWidth)
|
||||
sb.Append("warning:grid.left + grid.right > chartWidth\n");
|
||||
if (grid.top + grid.bottom >= chart.chartHeight)
|
||||
sb.Append("warning:grid.top + grid.bottom > chartHeight\n");
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (chart.isPointerInChart)
|
||||
{
|
||||
component.context.isPointerEnter = component.Contains(chart.pointerPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.context.isPointerEnter = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawUpper(VertexHelper vh)
|
||||
{
|
||||
DrawCoord(vh, component);
|
||||
}
|
||||
|
||||
private void DrawCoord(VertexHelper vh, GridCoord3D grid)
|
||||
{
|
||||
if (!grid.show) return;
|
||||
if (grid.showBorder)
|
||||
{
|
||||
var borderWidth = chart.theme.axis.lineWidth;
|
||||
var borderColor = chart.theme.axis.lineColor;
|
||||
if (grid.IsLeft())
|
||||
{
|
||||
UGL.DrawLine(vh, grid.context.pointA, grid.context.pointE, borderWidth, borderColor);
|
||||
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointF, borderWidth, borderColor);
|
||||
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointH, borderWidth, borderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
UGL.DrawLine(vh, grid.context.pointD, grid.context.pointH, borderWidth, borderColor);
|
||||
UGL.DrawLine(vh, grid.context.pointE, grid.context.pointH, borderWidth, borderColor);
|
||||
UGL.DrawLine(vh, grid.context.pointG, grid.context.pointH, borderWidth, borderColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid3D/GridCoord3DHandler.cs.meta
Normal file
11
Runtime/Coord/Grid3D/GridCoord3DHandler.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92481e92b90724f46b3a7e8c585e12e7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -532,6 +532,7 @@ namespace XCharts.Runtime
|
||||
xAxis.context.maxValue = 0;
|
||||
yAxis.context.minValue = 0;
|
||||
yAxis.context.maxValue = 0;
|
||||
ResetChartStatus();
|
||||
RefreshChart();
|
||||
}
|
||||
}
|
||||
@@ -566,6 +567,26 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// set insert data to head.
|
||||
/// ||设置数据插入到头部。
|
||||
/// </summary>
|
||||
/// <param name="insertDataToHead"></param>
|
||||
[Since("v3.11.0")]
|
||||
public void SetInsertDataToHead(bool insertDataToHead)
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
serie.insertDataToHead = insertDataToHead;
|
||||
|
||||
var coms = GetChartComponents<XAxis>();
|
||||
foreach (var com in coms)
|
||||
{
|
||||
var axis = com as XAxis;
|
||||
if (axis.type == Axis.AxisType.Category)
|
||||
axis.insertDataToHead = insertDataToHead;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 GetTitlePosition(Title title)
|
||||
{
|
||||
return chartPosition + title.location.GetPosition(chartWidth, chartHeight);
|
||||
@@ -735,7 +756,8 @@ namespace XCharts.Runtime
|
||||
[Since("v3.7.0")]
|
||||
public void CancelTooltip()
|
||||
{
|
||||
m_PointerEventData = null;
|
||||
pointerMoveEventData = null;
|
||||
pointerClickEventData = null;
|
||||
var tooltip = GetChartComponent<Tooltip>();
|
||||
if (tooltip != null)
|
||||
{
|
||||
@@ -750,6 +772,7 @@ namespace XCharts.Runtime
|
||||
[Since("v3.10.0")]
|
||||
public void ResetChartStatus()
|
||||
{
|
||||
foreach (var component in m_Components) component.ResetStatus();
|
||||
foreach (var handler in m_SerieHandlers) handler.ForceUpdateSerieContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,13 +317,29 @@ namespace XCharts.Runtime
|
||||
GridCoord grid = null;
|
||||
if (dataZoom.xAxisIndexs != null && dataZoom.xAxisIndexs.Count > 0)
|
||||
{
|
||||
var xAxis = GetChartComponent<XAxis>(dataZoom.xAxisIndexs[0]);
|
||||
grid = GetChartComponent<GridCoord>(xAxis.gridIndex);
|
||||
for (int i = 0; i < dataZoom.xAxisIndexs.Count; i++)
|
||||
{
|
||||
var xAxis = GetChartComponent<XAxis>(dataZoom.xAxisIndexs[i]);
|
||||
var tempGrid = GetChartComponent<GridCoord>(xAxis.gridIndex);
|
||||
if (tempGrid.IsPointerEnter())
|
||||
{
|
||||
grid = tempGrid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dataZoom.yAxisIndexs != null && dataZoom.yAxisIndexs.Count > 0)
|
||||
{
|
||||
var yAxis = GetChartComponent<YAxis>(dataZoom.yAxisIndexs[0]);
|
||||
grid = GetChartComponent<GridCoord>(yAxis.gridIndex);
|
||||
for (int i = 0; i < dataZoom.yAxisIndexs.Count; i++)
|
||||
{
|
||||
var yAxis = GetChartComponent<YAxis>(dataZoom.yAxisIndexs[i]);
|
||||
var tempGrid = GetChartComponent<GridCoord>(yAxis.gridIndex);
|
||||
if (tempGrid.IsPointerEnter())
|
||||
{
|
||||
grid = tempGrid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (grid == null) return GetChartComponent<GridCoord>();
|
||||
else return grid;
|
||||
|
||||
@@ -11,7 +11,19 @@ namespace XCharts.Runtime
|
||||
public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)
|
||||
{
|
||||
var needAnimationData = !axis.context.needAnimation;
|
||||
if (IsAllAxisValue())
|
||||
if (axis is XAxis3D)
|
||||
{
|
||||
SeriesHelper.GetXMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
|
||||
}
|
||||
else if (axis is ZAxis3D)
|
||||
{
|
||||
SeriesHelper.GetZMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
|
||||
}
|
||||
else if (axis is YAxis3D)
|
||||
{
|
||||
SeriesHelper.GetYMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
|
||||
}
|
||||
else if (IsAllAxisValue())
|
||||
{
|
||||
if (axis is XAxis)
|
||||
{
|
||||
|
||||
@@ -447,16 +447,16 @@ namespace XCharts.Runtime
|
||||
/// ||添加一个关系图的关系数据。
|
||||
/// </summary>
|
||||
/// <param name="serieIndex">the index of serie</param>
|
||||
/// <param name="sourceName">the source name of link</param>
|
||||
/// <param name="targetName">the target name of link</param>
|
||||
/// <param name="sourceId">the source id of link</param>
|
||||
/// <param name="targetId">the target id of link</param>
|
||||
/// <param name="value">the value of link</param>
|
||||
/// <returns></returns>
|
||||
public SerieDataLink AddLink(int serieIndex, string sourceName, string targetName, double value)
|
||||
public SerieDataLink AddLink(int serieIndex, string sourceId, string targetId, double value = 0)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
var link = serie.AddLink(sourceName, targetName, value);
|
||||
var link = serie.AddLink(sourceId, targetId, value);
|
||||
RefreshPainter(serie.painter);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -124,9 +124,15 @@ namespace XCharts.Runtime
|
||||
base.InitComponent();
|
||||
SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName);
|
||||
foreach (var handler in m_ComponentHandlers)
|
||||
{
|
||||
handler.InitComponent();
|
||||
handler.inited = true;
|
||||
}
|
||||
foreach (var handler in m_SerieHandlers)
|
||||
{
|
||||
handler.InitComponent();
|
||||
handler.inited = true;
|
||||
}
|
||||
m_DebugInfo.Init(this);
|
||||
}
|
||||
|
||||
@@ -216,7 +222,15 @@ namespace XCharts.Runtime
|
||||
foreach (var handler in m_SerieHandlers) handler.BeforeUpdate();
|
||||
foreach (var handler in m_ComponentHandlers) handler.BeforceSerieUpdate();
|
||||
foreach (var handler in m_SerieHandlers) handler.Update();
|
||||
foreach (var handler in m_ComponentHandlers) handler.Update();
|
||||
foreach (var handler in m_ComponentHandlers)
|
||||
{
|
||||
if (!handler.inited)
|
||||
{
|
||||
handler.InitComponent();
|
||||
handler.inited = true;
|
||||
}
|
||||
handler.Update();
|
||||
}
|
||||
foreach (var handler in m_SerieHandlers) handler.AfterUpdate();
|
||||
|
||||
m_DebugInfo.Update();
|
||||
|
||||
@@ -43,16 +43,21 @@ namespace XCharts.Runtime
|
||||
public Vector2 graphMaxAnchor { get { return m_GraphMaxAnchor; } }
|
||||
public Vector2 graphAnchoredPosition { get { return m_GraphAnchoredPosition; } }
|
||||
/// <summary>
|
||||
/// The postion of pointer.
|
||||
/// The postion of pointer move.
|
||||
/// ||鼠标位置。
|
||||
/// </summary>
|
||||
public Vector2 pointerPos { get; protected set; }
|
||||
public Vector2 clickPos { get; protected set; }
|
||||
/// <summary>
|
||||
/// Whether the mouse pointer is in the chart.
|
||||
/// ||鼠标是否在图表内。
|
||||
/// </summary>
|
||||
public bool isPointerInChart
|
||||
{ get { return m_PointerEventData != null; } }
|
||||
public bool isPointerInChart { get { return pointerMoveEventData != null; } }
|
||||
/// <summary>
|
||||
/// Whether the mouse click the chart.
|
||||
/// ||鼠标是否点击了图表。
|
||||
/// </summary>
|
||||
public bool isPointerClick { get { return pointerClickEventData != null; } }
|
||||
/// <summary>
|
||||
/// 警告信息。
|
||||
/// </summary>
|
||||
|
||||
@@ -35,7 +35,9 @@ namespace XCharts.Runtime
|
||||
protected bool m_PainerDirty = false;
|
||||
protected bool m_IsOnValidate = false;
|
||||
protected Vector3 m_LastLocalPosition;
|
||||
protected PointerEventData m_PointerEventData;
|
||||
internal PointerEventData pointerMoveEventData;
|
||||
internal PointerEventData pointerClickEventData;
|
||||
internal bool isTriggerOnClick = false;
|
||||
|
||||
protected Action<PointerEventData, BaseGraph> m_OnPointerClick;
|
||||
protected Action<PointerEventData, BaseGraph> m_OnPointerDown;
|
||||
@@ -213,17 +215,23 @@ namespace XCharts.Runtime
|
||||
|
||||
private void CheckPointerPos()
|
||||
{
|
||||
if (!isPointerInChart) return;
|
||||
if (canvas == null) return;
|
||||
Vector2 mousePos = m_PointerEventData.position;
|
||||
if (pointerMoveEventData != null)
|
||||
{
|
||||
pointerPos = MousePos2ChartPos(pointerMoveEventData.position);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 MousePos2ChartPos(Vector2 mousePos)
|
||||
{
|
||||
Vector2 local;
|
||||
if (!ScreenPointToChartPoint(mousePos, out local))
|
||||
{
|
||||
pointerPos = Vector2.zero;
|
||||
return Vector2.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
pointerPos = local;
|
||||
return local;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +277,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
pointerClickEventData = eventData;
|
||||
clickPos = MousePos2ChartPos(pointerClickEventData.position);
|
||||
if (m_OnPointerClick != null) m_OnPointerClick(eventData, this);
|
||||
}
|
||||
|
||||
@@ -284,13 +294,14 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
m_PointerEventData = eventData;
|
||||
pointerMoveEventData = eventData;
|
||||
if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this);
|
||||
}
|
||||
|
||||
public virtual void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
m_PointerEventData = null;
|
||||
pointerMoveEventData = null;
|
||||
pointerClickEventData = null;
|
||||
if (m_OnPointerExit != null) m_OnPointerExit(eventData, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual void Reset() { }
|
||||
|
||||
public virtual void ResetStatus() { }
|
||||
|
||||
public virtual void ClearData() { }
|
||||
|
||||
public virtual void ClearDirty()
|
||||
@@ -91,6 +93,7 @@ namespace XCharts.Runtime
|
||||
public int order { get; internal set; }
|
||||
public BaseChart chart { get; internal set; }
|
||||
public ComponentHandlerAttribute attribute { get; internal set; }
|
||||
public bool inited { get; internal set; }
|
||||
|
||||
public virtual void InitComponent() { }
|
||||
public virtual void RemoveComponent() { }
|
||||
@@ -120,7 +123,7 @@ namespace XCharts.Runtime
|
||||
|
||||
internal override void SetComponent(MainComponent component)
|
||||
{
|
||||
this.component = (T) component;
|
||||
this.component = (T)component;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace XCharts.Runtime
|
||||
/// the data struct of graph.
|
||||
/// ||数据结构-图。
|
||||
/// </summary>
|
||||
public class Graph
|
||||
public class GraphData
|
||||
{
|
||||
public bool directed;
|
||||
public List<GraphNode> nodes = new List<GraphNode>();
|
||||
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
|
||||
public Dictionary<string, GraphNode> nodeMap = new Dictionary<string, GraphNode>();
|
||||
public Dictionary<string, GraphEdge> edgeMap = new Dictionary<string, GraphEdge>();
|
||||
|
||||
public Graph(bool directed)
|
||||
public GraphData(bool directed)
|
||||
{
|
||||
this.directed = directed;
|
||||
}
|
||||
@@ -42,11 +42,27 @@ namespace XCharts.Runtime
|
||||
double totalValue = 0;
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
totalValue += node.totalValues;
|
||||
if (node.IsAnyInEdgesExpanded())
|
||||
{
|
||||
totalValue += node.totalValues;
|
||||
}
|
||||
}
|
||||
return totalValue;
|
||||
}
|
||||
|
||||
public static int GetExpandedNodesCount(List<GraphNode> nodes)
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (node.IsAnyInEdgesExpanded())
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<List<GraphNode>> GetDepthNodes()
|
||||
{
|
||||
List<List<GraphNode>> depthNodes = new List<List<GraphNode>>();
|
||||
@@ -108,7 +124,7 @@ namespace XCharts.Runtime
|
||||
// {
|
||||
// if (recursiveCount > 50)
|
||||
// {
|
||||
// XLog.Error("Graph.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
|
||||
// XLog.Error("GraphData.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
|
||||
// return;
|
||||
// }
|
||||
// if (node.inDegree == 0)
|
||||
@@ -129,7 +145,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (recursiveCount > 50)
|
||||
{
|
||||
XLog.Error("Graph.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
|
||||
XLog.Error("GraphData.GetNodeDeep(): recursiveCount > 50, maybe graph is ring");
|
||||
return 0;
|
||||
}
|
||||
int depth = 0;
|
||||
@@ -193,7 +209,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex)
|
||||
public GraphNode AddNode(string nodeId, string nodeName, int dataIndex, double value)
|
||||
{
|
||||
if (nodeMap.ContainsKey(nodeId))
|
||||
{
|
||||
@@ -214,27 +230,27 @@ namespace XCharts.Runtime
|
||||
GraphNode node1, node2;
|
||||
if (!nodeMap.TryGetValue(nodeId1, out node1))
|
||||
{
|
||||
XLog.Warning("Graph.AddEdge(): " + nodeId1 + " not exist");
|
||||
XLog.Warning("GraphData.AddEdge(): " + nodeId1 + " not exist");
|
||||
return null;
|
||||
}
|
||||
if (!nodeMap.TryGetValue(nodeId2, out node2))
|
||||
{
|
||||
XLog.Warning("Graph.AddEdge(): " + nodeId2 + " not exist");
|
||||
XLog.Warning("GraphData.AddEdge(): " + nodeId2 + " not exist");
|
||||
return null;
|
||||
}
|
||||
if (node1 == null)
|
||||
{
|
||||
XLog.Warning("Graph.AddEdge(): node1 is null");
|
||||
XLog.Warning("GraphData.AddEdge(): node1 is null");
|
||||
return null;
|
||||
}
|
||||
if (node2 == null)
|
||||
{
|
||||
XLog.Warning("Graph.AddEdge(): node2 is null");
|
||||
XLog.Warning("GraphData.AddEdge(): node2 is null");
|
||||
return null;
|
||||
}
|
||||
if (node1 == node2)
|
||||
if (directed && node1 == node2)
|
||||
{
|
||||
XLog.Warning("Graph.AddEdge(): node1 == node2");
|
||||
XLog.Warning("GraphData.AddEdge(): node1 == node2:" + node1);
|
||||
return null;
|
||||
}
|
||||
string edgeKey = nodeId1 + "_" + nodeId2;
|
||||
@@ -331,6 +347,35 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ExpandNode(string nodeId, bool flag)
|
||||
{
|
||||
var node = GetNode(nodeId);
|
||||
if (node != null)
|
||||
{
|
||||
node.Expand(flag);
|
||||
}
|
||||
}
|
||||
|
||||
public void ExpandAllNodes(bool flag, int level = -1)
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (level < 0 || node.level == level)
|
||||
{
|
||||
node.Expand(flag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAllNodeInZeroPosition()
|
||||
{
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
if (node.position != Vector3.zero) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -341,13 +386,20 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public string id;
|
||||
public string name;
|
||||
public double value;
|
||||
public List<GraphEdge> edges = new List<GraphEdge>();
|
||||
public List<GraphEdge> inEdges = new List<GraphEdge>();
|
||||
public List<GraphEdge> outEdges = new List<GraphEdge>();
|
||||
public Graph hostGraph;
|
||||
public GraphData hostGraph;
|
||||
public int dataIndex;
|
||||
public bool visited;
|
||||
public int depth = -1;
|
||||
public bool expand = true;
|
||||
public int level = 0;
|
||||
public Vector3 position = Vector3.zero;
|
||||
public Vector3 pp = Vector3.zero;
|
||||
public float weight;
|
||||
public float repulsion;
|
||||
|
||||
public GraphNode(string id, string name, int dataIndex)
|
||||
{
|
||||
@@ -388,6 +440,36 @@ namespace XCharts.Runtime
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public bool IsAllInEdgesCollapsed()
|
||||
{
|
||||
if (inEdges.Count == 0) return false;
|
||||
foreach (var edge in inEdges)
|
||||
{
|
||||
if (!edge.expand) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsAnyInEdgesExpanded()
|
||||
{
|
||||
if (inEdges.Count == 0) return true;
|
||||
foreach (var edge in inEdges)
|
||||
{
|
||||
if (edge.expand) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Expand(bool flag)
|
||||
{
|
||||
if (expand == flag) return;
|
||||
expand = flag;
|
||||
foreach (var edge in outEdges)
|
||||
{
|
||||
edge.expand = flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -400,11 +482,14 @@ namespace XCharts.Runtime
|
||||
public GraphNode node1;
|
||||
public GraphNode node2;
|
||||
public double value;
|
||||
public Graph hostGraph;
|
||||
public GraphData hostGraph;
|
||||
|
||||
public List<Vector3> points = new List<Vector3>();
|
||||
public List<Vector3> upPoints = new List<Vector3>();
|
||||
public List<Vector3> downPoints = new List<Vector3>();
|
||||
public float width;
|
||||
public float distance;
|
||||
public bool highlight;
|
||||
public bool expand = true;
|
||||
|
||||
public GraphEdge(GraphNode node1, GraphNode node2, double value)
|
||||
{
|
||||
@@ -412,5 +497,24 @@ namespace XCharts.Runtime
|
||||
this.node2 = node2;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public bool IsPointInEdge(Vector2 point)
|
||||
{
|
||||
if (upPoints.Count == 0 || downPoints.Count == 0) return false;
|
||||
var lastCount = upPoints.Count - 1;
|
||||
if (point.x < upPoints[0].x || point.x > upPoints[lastCount].x) return false;
|
||||
if (point.y > upPoints[0].y && point.y > upPoints[lastCount].y) return false;
|
||||
if (point.y < downPoints[0].y && point.y < downPoints[lastCount].y) return false;
|
||||
|
||||
for (int i = 0; i < upPoints.Count - 1; i++)
|
||||
{
|
||||
var diff = point.x - upPoints[i].x;
|
||||
if (diff <= 0)
|
||||
{
|
||||
return point.y < upPoints[i].y && point.y > downPoints[i].y;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Internal/Data/GraphData.cs.meta
Normal file
11
Runtime/Internal/Data/GraphData.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d8951dd10b1247c9baf8515b3a22771
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
internal static class DataHelper
|
||||
public static class DataHelper
|
||||
{
|
||||
public static double DataAverage(ref List<SerieData> showData, SampleType sampleType,
|
||||
int minCount, int maxCount, int rate)
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
public static class XChartsMgr
|
||||
{
|
||||
public static readonly string version = "3.10.2";
|
||||
public static readonly int versionDate = 20240311;
|
||||
public static readonly string version = "3.11.0";
|
||||
public static readonly int versionDate = 20240616;
|
||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||
|
||||
internal static List<BaseChart> chartList = new List<BaseChart>();
|
||||
|
||||
@@ -16,14 +16,17 @@ namespace XCharts.Runtime
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
{
|
||||
var serie = chart.AddSerie<Candlestick>(serieName);
|
||||
var defaultDataCount = 5;
|
||||
for (int i = 0; i < defaultDataCount; i++)
|
||||
var lastValue = 50d;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
var open = Random.Range(20, 60);
|
||||
var close = Random.Range(40, 90);
|
||||
var lowest = Random.Range(0, 50);
|
||||
var heighest = Random.Range(50, 100);
|
||||
var open = lastValue;
|
||||
var close = open + Random.Range(-20, 20);
|
||||
var min = open < close ? open : close;
|
||||
var max = open > close ? open : close;
|
||||
var lowest = min + Random.Range(-10, -10);
|
||||
var heighest = max + Random.Range(10, 10);
|
||||
chart.AddData(serie.index, i, open, close, lowest, heighest);
|
||||
lastValue = close;
|
||||
}
|
||||
return serie;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace XCharts.Runtime
|
||||
var close = serieData.GetCurrData(startDataIndex + 1, dataAddDuration, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue, unscaledTime);
|
||||
var lowest = serieData.GetCurrData(startDataIndex + 2, dataAddDuration, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue, unscaledTime);
|
||||
var heighest = serieData.GetCurrData(startDataIndex + 3, dataAddDuration, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue, unscaledTime);
|
||||
var isRise = yAxis.inverse ? close<open : close> open;
|
||||
var isRise = yAxis.inverse ? close < open : close > open;
|
||||
var borderWidth = open == 0 ? 0f :
|
||||
(itemStyle.borderWidth == 0 ? theme.serie.candlestickBorderWidth :
|
||||
itemStyle.borderWidth);
|
||||
@@ -138,18 +138,30 @@ namespace XCharts.Runtime
|
||||
var minCut = (yMinValue > 0 ? yMinValue : 0);
|
||||
if (valueTotal != 0)
|
||||
{
|
||||
barHig = (float) ((close - open) / valueTotal * grid.context.height);
|
||||
pY += (float) ((open - minCut) / valueTotal * grid.context.height);
|
||||
barHig = (float)((close - open) / valueTotal * grid.context.height);
|
||||
pY += (float)((open - minCut) / valueTotal * grid.context.height);
|
||||
}
|
||||
serieData.context.stackHeight = barHig;
|
||||
float currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig);
|
||||
Vector3 plb, plt, prt, prb, top;
|
||||
|
||||
plb = new Vector3(pX + gap + borderWidth, pY + borderWidth);
|
||||
plt = new Vector3(pX + gap + borderWidth, pY + currHig - borderWidth);
|
||||
prt = new Vector3(pX + gap + barWidth - borderWidth, pY + currHig - borderWidth);
|
||||
prb = new Vector3(pX + gap + barWidth - borderWidth, pY + borderWidth);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig - borderWidth);
|
||||
var offset = 2 * borderWidth;
|
||||
if (isRise)
|
||||
{
|
||||
plb = new Vector3(pX + gap + offset, pY + offset);
|
||||
plt = new Vector3(pX + gap + offset, pY + currHig - offset);
|
||||
prt = new Vector3(pX + gap + barWidth - offset, pY + currHig - offset);
|
||||
prb = new Vector3(pX + gap + barWidth - offset, pY + offset);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig - offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
plb = new Vector3(pX + gap + offset, pY - offset);
|
||||
plt = new Vector3(pX + gap + offset, pY + currHig + offset);
|
||||
prt = new Vector3(pX + gap + barWidth - offset, pY + currHig + offset);
|
||||
prb = new Vector3(pX + gap + barWidth - offset, pY - offset);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig + offset);
|
||||
}
|
||||
if (serie.clip)
|
||||
{
|
||||
plb = chart.ClampInGrid(grid, plb);
|
||||
@@ -169,8 +181,8 @@ namespace XCharts.Runtime
|
||||
var itemWidth = Mathf.Abs(prt.x - plb.x);
|
||||
var itemHeight = Mathf.Abs(plt.y - prb.y);
|
||||
var center = new Vector3((plb.x + prt.x) / 2, (plt.y + prb.y) / 2);
|
||||
var lowPos = new Vector3(center.x, zeroY + (float) ((lowest - minCut) / valueTotal * grid.context.height));
|
||||
var heighPos = new Vector3(center.x, zeroY + (float) ((heighest - minCut) / valueTotal * grid.context.height));
|
||||
var lowPos = new Vector3(center.x, zeroY + (float)((lowest - minCut) / valueTotal * grid.context.height));
|
||||
var heighPos = new Vector3(center.x, zeroY + (float)((heighest - minCut) / valueTotal * grid.context.height));
|
||||
var openCenterPos = new Vector3(center.x, prb.y);
|
||||
var closeCenterPos = new Vector3(center.x, prt.y);
|
||||
if (intensive)
|
||||
|
||||
@@ -17,16 +17,17 @@ namespace XCharts.Runtime
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
{
|
||||
var serie = chart.AddSerie<SimplifiedCandlestick>(serieName);
|
||||
|
||||
var lastValue = 50d;
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
lastValue += UnityEngine.Random.Range(-10, 20);
|
||||
var open = lastValue + Random.Range(-10, 5);
|
||||
var close = lastValue + Random.Range(-5, 10);
|
||||
var lowest = lastValue + Random.Range(-15, -10);
|
||||
var heighest = lastValue + Random.Range(10, 20);
|
||||
var open = lastValue;
|
||||
var close = open + Random.Range(-20, 20);
|
||||
var min = open < close ? open : close;
|
||||
var max = open > close ? open : close;
|
||||
var lowest = min + Random.Range(-10, -10);
|
||||
var heighest = max + Random.Range(10, 10);
|
||||
chart.AddData(serie.index, i, open, close, lowest, heighest);
|
||||
lastValue = close;
|
||||
}
|
||||
return serie;
|
||||
}
|
||||
|
||||
@@ -144,11 +144,23 @@ namespace XCharts.Runtime
|
||||
float currHig = AnimationStyleHelper.CheckDataAnimation(chart, serie, i, barHig);
|
||||
Vector3 plb, plt, prt, prb, top;
|
||||
|
||||
plb = new Vector3(pX + gap + borderWidth, pY + borderWidth);
|
||||
plt = new Vector3(pX + gap + borderWidth, pY + currHig - borderWidth);
|
||||
prt = new Vector3(pX + gap + barWidth - borderWidth, pY + currHig - borderWidth);
|
||||
prb = new Vector3(pX + gap + barWidth - borderWidth, pY + borderWidth);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig - borderWidth);
|
||||
var offset = 2 * borderWidth;
|
||||
if (isRise)
|
||||
{
|
||||
plb = new Vector3(pX + gap + offset, pY + offset);
|
||||
plt = new Vector3(pX + gap + offset, pY + currHig - offset);
|
||||
prt = new Vector3(pX + gap + barWidth - offset, pY + currHig - offset);
|
||||
prb = new Vector3(pX + gap + barWidth - offset, pY + offset);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig - offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
plb = new Vector3(pX + gap + offset, pY - offset);
|
||||
plt = new Vector3(pX + gap + offset, pY + currHig + offset);
|
||||
prt = new Vector3(pX + gap + barWidth - offset, pY + currHig + offset);
|
||||
prb = new Vector3(pX + gap + barWidth - offset, pY - offset);
|
||||
top = new Vector3(pX + gap + barWidth / 2, pY + currHig + offset);
|
||||
}
|
||||
// if (serie.clip)
|
||||
// {
|
||||
// plb = chart.ClampInGrid(grid, plb);
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace XCharts.Runtime
|
||||
maxCount -= serie.context.dataZoomStartIndexOffset;
|
||||
var scaleWid = AxisHelper.GetDataWidth(axis, axisLength, maxCount, dataZoom);
|
||||
var scaleRelativedWid = AxisHelper.GetDataWidth(relativedAxis, axisRelativedLength, maxCount, dataZoom);
|
||||
int rate = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false);
|
||||
int rate = LineHelper.GetDataAverageRate(serie, axisLength, maxCount, false);
|
||||
var totalAverage = serie.sampleAverage > 0 ?
|
||||
serie.sampleAverage :
|
||||
DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
|
||||
|
||||
@@ -5,17 +5,16 @@ using XUGL;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
internal static class LineHelper
|
||||
public static class LineHelper
|
||||
{
|
||||
private static List<Vector3> s_CurvesPosList = new List<Vector3>();
|
||||
|
||||
public static int GetDataAverageRate(Serie serie, GridCoord grid, int maxCount, bool isYAxis)
|
||||
public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)
|
||||
{
|
||||
var sampleDist = serie.sampleDist;
|
||||
var rate = 0;
|
||||
var width = isYAxis ? grid.context.height : grid.context.width;
|
||||
if (sampleDist > 0)
|
||||
rate = (int)((maxCount - serie.minShow) / (width / sampleDist));
|
||||
rate = (int)((maxCount - serie.minShow) / (axisLength / sampleDist));
|
||||
if (rate < 1)
|
||||
rate = 1;
|
||||
return rate;
|
||||
@@ -303,11 +302,12 @@ namespace XCharts.Runtime
|
||||
isBreak = true;
|
||||
var ip = Vector3.zero;
|
||||
var progress = serie.animation.GetCurrDetail();
|
||||
if (AnimationStyleHelper.GetAnimationPosition(serie.animation, isY, lp, cp, progress, ref ip))
|
||||
var rate = 0f;
|
||||
if (AnimationStyleHelper.GetAnimationPosition(serie.animation, isY, lp, cp, progress, ref ip, ref rate))
|
||||
cp = np = ip;
|
||||
}
|
||||
serie.context.lineEndPostion = cp;
|
||||
serie.context.lineEndValue = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
serie.context.lineEndValueY = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
var handled = false;
|
||||
var isClip = false;
|
||||
if (serie.clip)
|
||||
@@ -383,7 +383,7 @@ namespace XCharts.Runtime
|
||||
AddLineVertToVertexHelper(vh, clp, crp, lineColor, isVisualMapGradient, isLineStyleGradient,
|
||||
visualMap, serie.lineStyle, grid, axis, relativedAxis, true, lastDataIsIgnore, isIgnore);
|
||||
serie.context.lineEndPostion = cp;
|
||||
serie.context.lineEndValue = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
serie.context.lineEndValueY = AxisHelper.GetAxisPositionValue(grid, relativedAxis, cp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace XCharts.Runtime
|
||||
var scaleWid = AxisHelper.GetDataWidth(axis, axisLength, maxCount, dataZoom);
|
||||
var scaleRelativedWid = AxisHelper.GetDataWidth(relativedAxis, axisRelativedLength, maxCount, dataZoom);
|
||||
|
||||
int rate = LineHelper.GetDataAverageRate(serie, m_SerieGrid, maxCount, false);
|
||||
int rate = LineHelper.GetDataAverageRate(serie, axisLength, maxCount, false);
|
||||
var totalAverage = serie.sampleAverage > 0 ?
|
||||
serie.sampleAverage :
|
||||
DataHelper.DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
|
||||
|
||||
@@ -1357,7 +1357,7 @@ namespace XCharts.Runtime
|
||||
return serieData;
|
||||
}
|
||||
|
||||
public void AddSerieData(SerieData serieData)
|
||||
public virtual void AddSerieData(SerieData serieData)
|
||||
{
|
||||
if (m_InsertDataToHead)
|
||||
m_Data.Insert(0, serieData);
|
||||
@@ -1547,15 +1547,15 @@ namespace XCharts.Runtime
|
||||
/// Add a link data.
|
||||
/// ||添加一个关系图的关系数据。
|
||||
/// </summary>
|
||||
/// <param name="sourceName"></param>
|
||||
/// <param name="targetName"></param>
|
||||
/// <param name="sourceId"></param>
|
||||
/// <param name="targetId"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public SerieDataLink AddLink(string sourceName, string targetName, double value)
|
||||
public virtual SerieDataLink AddLink(string sourceId, string targetId, double value = 0)
|
||||
{
|
||||
var link = new SerieDataLink();
|
||||
link.source = sourceName;
|
||||
link.target = targetName;
|
||||
link.source = sourceId;
|
||||
link.target = targetId;
|
||||
link.value = value;
|
||||
m_Links.Add(link);
|
||||
SetVerticesDirty();
|
||||
@@ -2083,6 +2083,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var newSerie = Activator.CreateInstance(GetType()) as Serie;
|
||||
SerieHelper.CopySerie(this, newSerie);
|
||||
newSerie.animation = new AnimationStyle();
|
||||
return newSerie;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,23 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public Vector3 position;
|
||||
public bool isIgnoreBreak;
|
||||
public double xValue;
|
||||
public double yValue;
|
||||
public double zValue;
|
||||
|
||||
public PointInfo(Vector3 pos, bool ignore)
|
||||
// public PointInfo(Vector3 pos, bool ignore)
|
||||
// {
|
||||
// this.position = pos;
|
||||
// this.isIgnoreBreak = ignore;
|
||||
// }
|
||||
|
||||
public PointInfo(Vector3 pos, bool ignore, double x = 0, double y = 0, double z = 0)
|
||||
{
|
||||
this.position = pos;
|
||||
this.isIgnoreBreak = ignore;
|
||||
this.xValue = x;
|
||||
this.yValue = y;
|
||||
this.zValue = z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +57,9 @@ namespace XCharts.Runtime
|
||||
/// 线段终点
|
||||
/// </summary>
|
||||
public Vector3 lineEndPostion;
|
||||
public double lineEndValue;
|
||||
public double lineEndValueX;
|
||||
public double lineEndValueY;
|
||||
public double lineEndValueZ;
|
||||
/// <summary>
|
||||
/// 内半径
|
||||
/// </summary>
|
||||
@@ -119,6 +133,7 @@ namespace XCharts.Runtime
|
||||
public Tooltip.Type tooltipType;
|
||||
public Tooltip.Trigger tooltipTrigger;
|
||||
public int totalDataIndex;
|
||||
public int clickTotalDataIndex;
|
||||
/// <summary>
|
||||
/// 水平方向的
|
||||
/// </summary>
|
||||
|
||||
@@ -59,16 +59,13 @@ namespace XCharts.Runtime
|
||||
/// Whether the data item is highlighted.
|
||||
/// ||该数据项是否被高亮,一般由鼠标悬停或图例悬停触发高亮。
|
||||
/// </summary>
|
||||
public bool highlight
|
||||
{
|
||||
get { return m_Highligth; }
|
||||
set
|
||||
{
|
||||
m_Highligth = value;
|
||||
}
|
||||
}
|
||||
private bool m_Highligth;
|
||||
public bool highlight;
|
||||
public bool selected;
|
||||
/// <summary>
|
||||
/// the id of the node in the graph.
|
||||
/// ||图中节点的id。
|
||||
/// </summary>
|
||||
public string graphNodeId;
|
||||
public double inTotalValue;
|
||||
public double outTotalValue;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public BaseChart chart { get; internal set; }
|
||||
public SerieHandlerAttribute attribute { get; internal set; }
|
||||
public bool inited { get; internal set; }
|
||||
public virtual int defaultDimension { get; internal set; }
|
||||
|
||||
public virtual void InitComponent() { }
|
||||
@@ -150,6 +151,18 @@ namespace XCharts.Runtime
|
||||
}
|
||||
if (serie.interactDirty)
|
||||
{
|
||||
if (serie.animation.enable && serie.animation.interaction.enable)
|
||||
{
|
||||
Color32 color1, toColor1;
|
||||
bool needInteract = false;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
SerieHelper.GetItemColor(out color1, out toColor1, serie, serieData, chart.theme, state);
|
||||
serieData.interact.SetColor(ref needInteract, color1, toColor1);
|
||||
}
|
||||
}
|
||||
chart.RefreshChart();
|
||||
serie.interactDirty = false;
|
||||
m_ForceUpdateSerieContext = true;
|
||||
}
|
||||
@@ -557,7 +570,7 @@ namespace XCharts.Runtime
|
||||
m_EndLabel.SetActive(active);
|
||||
if (active)
|
||||
{
|
||||
var value = serie.context.lineEndValue;
|
||||
var value = serie.context.lineEndValueY;
|
||||
var content = SerieLabelHelper.GetFormatterContent(serie, null, value, 0,
|
||||
endLabelStyle, Color.clear);
|
||||
m_EndLabel.SetText(content);
|
||||
@@ -741,6 +754,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
serie.context.clickTotalDataIndex = serie.context.totalDataIndex;
|
||||
if (serie.onClick == null && chart.onSerieClick == null) return;
|
||||
if (!serie.context.pointerEnter) return;
|
||||
var dataIndex = GetPointerItemDataIndex();
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace XCharts.Runtime
|
||||
public static void GetXMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
|
||||
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
|
||||
{
|
||||
GetMinMaxValue(chart, axisIndex, inverse, false, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
|
||||
GetMinMaxValue(chart, axisIndex, inverse, 0, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -324,13 +324,26 @@ namespace XCharts.Runtime
|
||||
public static void GetYMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
|
||||
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
|
||||
{
|
||||
GetMinMaxValue(chart, axisIndex, inverse, true, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
|
||||
GetMinMaxValue(chart, axisIndex, inverse, 1, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得维度Z的最大最小值
|
||||
/// </summary>
|
||||
/// <param name="dataZoom"></param>
|
||||
/// <param name="axisIndex"></param>
|
||||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
public static void GetZMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
|
||||
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
|
||||
{
|
||||
GetMinMaxValue(chart, axisIndex, inverse, 2, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
|
||||
}
|
||||
|
||||
private static Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
|
||||
private static Dictionary<int, double> _serieTotalValueForMinMax = new Dictionary<int, double>();
|
||||
public static void GetMinMaxValue(BaseChart chart, int axisIndex,
|
||||
bool inverse, bool yValue, out double minValue, out double maxValue, bool isPolar = false,
|
||||
bool inverse, int dimension, out double minValue, out double maxValue, bool isPolar = false,
|
||||
bool filterByDataZoom = true, bool needAnimation = false)
|
||||
{
|
||||
double min = double.MaxValue;
|
||||
@@ -371,8 +384,8 @@ namespace XCharts.Runtime
|
||||
var performanceMode = serie.IsPerformanceMode();
|
||||
foreach (var data in showData)
|
||||
{
|
||||
var currData = performanceMode ? data.GetData(yValue ? 1 : 0, inverse) :
|
||||
data.GetCurrData(yValue ? 1 : 0, dataAddDuration, updateDuration, unscaledTime, inverse);
|
||||
var currData = performanceMode ? data.GetData(dimension, inverse) :
|
||||
data.GetCurrData(dimension, dataAddDuration, updateDuration, unscaledTime, inverse);
|
||||
if (!serie.IsIgnoreValue(data, currData))
|
||||
{
|
||||
if (currData > max) max = currData;
|
||||
@@ -419,7 +432,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else
|
||||
{
|
||||
currData = showData[j].GetCurrData(yValue ? 1 : 0, dataAddDuration, updateDuration, unscaledTime, inverse);
|
||||
currData = showData[j].GetCurrData(dimension, dataAddDuration, updateDuration, unscaledTime, inverse);
|
||||
}
|
||||
if (!serie.IsIgnoreValue(showData[j], currData))
|
||||
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + currData;
|
||||
|
||||
@@ -6,8 +6,11 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public static class DateTimeUtil
|
||||
{
|
||||
//private static readonly DateTime k_DateTime1970 = TimeZoneInfo.ConvertTime(new DateTime(1970, 1, 1), TimeZoneInfo.Local);
|
||||
private static readonly DateTime k_DateTime1970 = new DateTime(1970, 1, 1);
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
private static readonly DateTime k_DateTime1970 = TimeZoneInfo.ConvertTimeFromUtc(new DateTime(1970, 1, 1), TimeZoneInfo.Local);
|
||||
#else
|
||||
private static readonly DateTime k_DateTime1970 = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
#endif
|
||||
public static readonly int ONE_SECOND = 1;
|
||||
public static readonly int ONE_MINUTE = ONE_SECOND * 60;
|
||||
public static readonly int ONE_HOUR = ONE_MINUTE * 60;
|
||||
@@ -34,10 +37,21 @@ namespace XCharts.Runtime
|
||||
return (int)(time - k_DateTime1970).TotalSeconds;
|
||||
}
|
||||
|
||||
public static int GetTimestamp(string dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetTimestamp(DateTime.Parse(dateTime));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime GetDateTime(int timestamp)
|
||||
{
|
||||
long span = ((long)timestamp) * 10000000;
|
||||
return k_DateTime1970.Add(new TimeSpan(span));
|
||||
return k_DateTime1970.AddSeconds(timestamp);
|
||||
}
|
||||
|
||||
internal static string GetDateTimeFormatString(DateTime dateTime, double range)
|
||||
|
||||
73
Runtime/Utilities/JsonUtil.cs
Normal file
73
Runtime/Utilities/JsonUtil.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
public static class JsonUtil
|
||||
{
|
||||
|
||||
public static IEnumerator GetWebJson<T>(string url, Action<T[]> callback)
|
||||
{
|
||||
var www = UnityWebRequest.Get(url);
|
||||
yield return www;
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
#else
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
#endif
|
||||
{
|
||||
Debug.LogError("GetWebJson Error: " + www.error);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
var json = www.downloadHandler.text.Trim();
|
||||
callback(GetJsonArray<T>(json));
|
||||
www.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerator GetWebJson<T>(string url, Action<T> callback)
|
||||
{
|
||||
var www = UnityWebRequest.Get(url);
|
||||
yield return www;
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
if (www.result != UnityWebRequest.Result.Success)
|
||||
#else
|
||||
if (www.isNetworkError || www.isHttpError)
|
||||
#endif
|
||||
{
|
||||
Debug.LogError("GetWebJson Error: " + www.error);
|
||||
}
|
||||
else
|
||||
{
|
||||
var json = www.downloadHandler.text.Trim();
|
||||
callback(GetJsonObject<T>(json));
|
||||
www.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static T GetJsonObject<T>(string json)
|
||||
{
|
||||
return JsonUtility.FromJson<T>(json);
|
||||
}
|
||||
|
||||
public static T[] GetJsonArray<T>(string json)
|
||||
{
|
||||
string newJson = "{ \"array\": " + json + "}";
|
||||
Wrapper<T> wrapper = JsonUtility.FromJson<Wrapper<T>>(newJson);
|
||||
return wrapper.array;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
private class Wrapper<T>
|
||||
{
|
||||
#pragma warning disable 0649
|
||||
public T[] array;
|
||||
#pragma warning restore 0649
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Utilities/JsonUtil.cs.meta
Normal file
11
Runtime/Utilities/JsonUtil.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88e9115d32af34a3dae0d5c3e32de41c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1986,6 +1986,36 @@ namespace XUGL
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawEdge(VertexHelper vh, List<Vector3> topList, List<Vector3> bottomList,
|
||||
Color32 lineColor, Color32 lineToColor, Direction dire, float currProgress = float.NaN)
|
||||
{
|
||||
if (topList.Count < 2 || bottomList.Count < 2) return;
|
||||
var minCount = Mathf.Min(topList.Count, bottomList.Count);
|
||||
var isGradient = !UGLHelper.IsValueEqualsColor(lineColor, lineToColor);
|
||||
AddVertToVertexHelper(vh, topList[0], bottomList[0], lineColor, false);
|
||||
for (int i = 1; i < minCount; i++)
|
||||
{
|
||||
var up = topList[i];
|
||||
var dn = bottomList[i];
|
||||
if (currProgress != float.NaN)
|
||||
{
|
||||
if (dire == Direction.YAxis && up.y > currProgress)
|
||||
break;
|
||||
if (dire == Direction.XAxis && up.x > currProgress)
|
||||
break;
|
||||
}
|
||||
if (isGradient)
|
||||
{
|
||||
var tcolor = Color32.Lerp(lineColor, lineToColor, i * 1.0f / minCount);
|
||||
AddVertToVertexHelper(vh, up, dn, tcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddVertToVertexHelper(vh, up, dn, lineColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawSvgPath(VertexHelper vh, string path)
|
||||
{
|
||||
SVG.DrawPath(vh, path);
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace XUGL
|
||||
/// <param name="nbp">下一个点的下角点</param>
|
||||
/// <param name="itp">交汇点的上角点</param>
|
||||
/// <param name="ibp">交汇点的下角点</param>
|
||||
internal static void GetLinePoints(Vector3 lp, Vector3 cp, Vector3 np, float width,
|
||||
public static void GetLinePoints(Vector3 lp, Vector3 cp, Vector3 np, float width,
|
||||
ref Vector3 ltp, ref Vector3 lbp,
|
||||
ref Vector3 ntp, ref Vector3 nbp,
|
||||
ref Vector3 itp, ref Vector3 ibp,
|
||||
@@ -397,6 +397,23 @@ namespace XUGL
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
|
||||
public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)
|
||||
{
|
||||
if (polyons.Length == 0) return false;
|
||||
var inside = false;
|
||||
var j = polyons.Length - 1;
|
||||
for (int i = 0; i < polyons.Length; j = i++)
|
||||
{
|
||||
var pi = polyons[i];
|
||||
var pj = polyons[j];
|
||||
if (((pi.y <= p.y && p.y < pj.y) || (pj.y <= p.y && p.y < pi.y)) &&
|
||||
(p.x < (pj.x - pi.x) * (p.y - pi.y) / (pj.y - pi.y) + pi.x))
|
||||
inside = !inside;
|
||||
}
|
||||
return inside;
|
||||
}
|
||||
|
||||
public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)
|
||||
{
|
||||
if (polyons.Count == 0) return false;
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"displayName": "XCharts",
|
||||
"author": "monitor1394",
|
||||
"license": "MIT",
|
||||
"version": "3.10.2",
|
||||
"date": "20240311",
|
||||
"checkdate": "20240311",
|
||||
"version": "3.11.0",
|
||||
"date": "20240616",
|
||||
"checkdate": "20240616",
|
||||
"unity": "2018.3",
|
||||
"description": "A charting and data visualization library for Unity. Support line chart, bar chart, pie chart, radar chart, scatter chart, heatmap chart, ring chart, candlestick chart, polar chart and parallel coordinates.",
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user