diff --git a/Documentation~/en/api.md b/Documentation~/en/api.md
index 6b971eb0..92c6fdf5 100644
--- a/Documentation~/en/api.md
+++ b/Documentation~/en/api.md
@@ -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)
@@ -84,6 +86,8 @@ slug: /api
- [GraphEdge](#graphedge)
- [GraphNode](#graphnode)
- [GridCoord](#gridcoord)
+- [GridCoord3D](#gridcoord3d)
+- [GridCoord3DContext](#gridcoord3dcontext)
- [GridCoordContext](#gridcoordcontext)
- [GridLayout](#gridlayout)
- [GridLayoutContext](#gridlayoutcontext)
@@ -119,6 +123,7 @@ slug: /api
- [Line](#line)
- [LineArrow](#linearrow)
- [LineChart](#linechart)
+- [LineHelper](#linehelper)
- [LineStyle](#linestyle)
- [ListFor](#listfor)
- [ListForComponent](#listforcomponent)
@@ -225,12 +230,14 @@ slug: /api
- [UIComponent](#uicomponent)
- [UIComponentTheme](#uicomponenttheme)
- [UIHelper](#uihelper)
+- [ViewControl](#viewcontrol)
- [VisualMap](#visualmap)
- [VisualMapContext](#visualmapcontext)
- [VisualMapHelper](#visualmaphelper)
- [VisualMapRange](#visualmaprange)
- [VisualMapTheme](#visualmaptheme)
- [XAxis](#xaxis)
+- [XAxis3D](#xaxis3d)
- [XChartsMgr](#xchartsmgr)
- [XCResourceImporterWindow](#xcresourceimporterwindow)
- [XCResourcesImporter](#xcresourcesimporter)
@@ -238,6 +245,8 @@ slug: /api
- [XCThemeMgr](#xcthememgr)
- [XLog](#xlog)
- [YAxis](#yaxis)
+- [YAxis3D](#yaxis3d)
+- [ZAxis3D](#zaxis3d)
## AngleAxis
@@ -418,7 +427,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.
@@ -434,7 +443,7 @@ The axis in rectangular coordinate.
|GetAddedDataCount()||public int GetAddedDataCount()
get the history data count. |
|GetData()||public string GetData(int index)
获得指定索引的类目数据 |
|GetData()||public string GetData(int index, DataZoom dataZoom)
获得在dataZoom范围内指定索引的类目数据 |
-|GetDistance()||public float GetDistance(double value, float axisLength)
获得值在坐标轴上的距离 |
+|GetDistance()||public float GetDistance(double value, float axisLength = 0)
获得值在坐标轴上的距离 |
|GetIcon()||public Sprite GetIcon(int index)|
|GetLabelValue()||public double GetLabelValue(int index)|
|GetLastLabelValue()||public double GetLastLabelValue()|
@@ -458,6 +467,17 @@ The axis in rectangular coordinate.
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)
更新图标 |
|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)
@@ -1171,7 +1191,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|
@@ -1269,10 +1289,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)
@@ -1332,6 +1357,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
@@ -1429,6 +1455,7 @@ the data struct of graph.
|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)|
@@ -1485,6 +1512,28 @@ Grid component.
|NotAnyIntersect()|v3.10.0|public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
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)
Clamp the position of pos to the grid. |
+|Contains()||public bool Contains(Vector3 pos)
Whether the given position is in the grid. |
+|IsLeft()||public bool IsLeft()
The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
+|IsPointerEnter()||public bool IsPointerEnter()
Whether the pointer is in the grid. |
+|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
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)
@@ -1635,7 +1684,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
@@ -1671,7 +1720,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
@@ -1870,6 +1919,16 @@ Line chart relates all the data points symbol by broken lines, which is used to
|DefaultStepLineChart()||public void DefaultStepLineChart()
default step line chart. |
|DefaultTimeLineChart()||public void DefaultTimeLineChart()
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)
@@ -1967,7 +2026,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
@@ -3220,6 +3279,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)|
@@ -3259,6 +3319,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)
@@ -3272,6 +3340,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)|
@@ -3329,6 +3398,18 @@ The x axis in cartesian(rectangular) coordinate.
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()
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()
The x axis in cartesian(rectangular) coordinate. |
+
## XChartsMgr
> class in XCharts.Runtime
@@ -3434,3 +3515,27 @@ The x axis in cartesian(rectangular) coordinate.
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()
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()
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()
The x axis in cartesian(rectangular) coordinate. |
+
diff --git a/Documentation~/en/configuration.md b/Documentation~/en/configuration.md
index 3d34f3f9..3f87ec82 100644
--- a/Documentation~/en/configuration.md
+++ b/Documentation~/en/configuration.md
@@ -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)
@@ -385,7 +390,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 +407,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.
`Axis.AxisPosition`:
- `Left`: the position of axis in grid.
- `Right`: the position of axis in grid.
- `Bottom`: the position of axis in grid.
- `Top`: the position of axis in grid.
|
+|position|||the position of axis in grid.
`Axis.AxisPosition`:
- `Left`: the position of axis in grid.
- `Right`: the position of axis in grid.
- `Bottom`: the position of axis in grid.
- `Top`: the position of axis in grid.
- `Center`: the position of axis in grid.
|
|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`
@@ -606,6 +611,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
@@ -774,7 +780,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 +871,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 +1028,37 @@ Grid component.
```
+## GridCoord3D
+
+> class in XCharts.Runtime / Inherits from: [CoordSystem](#coordsystem), [IUpdateRuntimeData](#iupdateruntimedata), [ISerieContainer](#iseriecontainer)
+
+> Since `v3.11.0`
+
+Grid component.
+
+```mdx-code-block
+
+```
+
+
+|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
+
+```
+
## GridLayout
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
@@ -1177,7 +1214,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 +1266,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
@@ -2377,6 +2414,28 @@ Tooltip component.
```
+## ViewControl
+
+> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
+
+> Since `v3.11.0`
+
+View control component in 3D coordinate system.
+
+```mdx-code-block
+
+```
+
+
+|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
+
+```
+
## VisualMap
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent)
@@ -2467,6 +2526,14 @@ VisualMap component. Mapping data to visual elements such as colors.
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
@@ -2528,3 +2595,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.
+
diff --git a/Documentation~/zh/api.md b/Documentation~/zh/api.md
index 8955a3ac..c9c54379 100644
--- a/Documentation~/zh/api.md
+++ b/Documentation~/zh/api.md
@@ -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)
@@ -84,6 +86,8 @@ slug: /api
- [GraphEdge](#graphedge)
- [GraphNode](#graphnode)
- [GridCoord](#gridcoord)
+- [GridCoord3D](#gridcoord3d)
+- [GridCoord3DContext](#gridcoord3dcontext)
- [GridCoordContext](#gridcoordcontext)
- [GridLayout](#gridlayout)
- [GridLayoutContext](#gridlayoutcontext)
@@ -119,6 +123,7 @@ slug: /api
- [Line](#line)
- [LineArrow](#linearrow)
- [LineChart](#linechart)
+- [LineHelper](#linehelper)
- [LineStyle](#linestyle)
- [ListFor](#listfor)
- [ListForComponent](#listforcomponent)
@@ -225,12 +230,14 @@ slug: /api
- [UIComponent](#uicomponent)
- [UIComponentTheme](#uicomponenttheme)
- [UIHelper](#uihelper)
+- [ViewControl](#viewcontrol)
- [VisualMap](#visualmap)
- [VisualMapContext](#visualmapcontext)
- [VisualMapHelper](#visualmaphelper)
- [VisualMapRange](#visualmaprange)
- [VisualMapTheme](#visualmaptheme)
- [XAxis](#xaxis)
+- [XAxis3D](#xaxis3d)
- [XChartsMgr](#xchartsmgr)
- [XCResourceImporterWindow](#xcresourceimporterwindow)
- [XCResourcesImporter](#xcresourcesimporter)
@@ -238,6 +245,8 @@ slug: /api
- [XCThemeMgr](#xcthememgr)
- [XLog](#xlog)
- [YAxis](#yaxis)
+- [YAxis3D](#yaxis3d)
+- [ZAxis3D](#zaxis3d)
## AngleAxis
@@ -418,7 +427,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)
直角坐标系的坐标轴组件。
@@ -434,7 +443,7 @@ slug: /api
|GetAddedDataCount()||public int GetAddedDataCount()
获得添加过的历史数据总数 |
|GetData()||public string GetData(int index)
获得指定索引的类目数据 |
|GetData()||public string GetData(int index, DataZoom dataZoom)
获得在dataZoom范围内指定索引的类目数据 |
-|GetDistance()||public float GetDistance(double value, float axisLength)
获得值在坐标轴上的距离 |
+|GetDistance()||public float GetDistance(double value, float axisLength = 0)
获得值在坐标轴上的距离 |
|GetIcon()||public Sprite GetIcon(int index)|
|GetLabelValue()||public double GetLabelValue(int index)|
|GetLastLabelValue()||public double GetLastLabelValue()|
@@ -458,6 +467,17 @@ slug: /api
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)
更新图标 |
|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)
@@ -1171,7 +1191,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|版本|描述|
@@ -1269,10 +1289,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)
@@ -1332,6 +1357,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
@@ -1429,6 +1455,7 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|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)|
@@ -1485,6 +1512,28 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|NotAnyIntersect()|v3.10.0|public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
判断给定的线段是否与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)
将位置限制在网格内。 |
+|Contains()||public bool Contains(Vector3 pos)
给定的位置是否在网格内。 |
+|IsLeft()||public bool IsLeft()
The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
+|IsPointerEnter()||public bool IsPointerEnter()
指针是否在网格内。 |
+|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
判断给定的线段是否与Grid边界是否完全不会相交。 |
+|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
+
+## GridCoord3DContext
+
+> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
+
+
## GridCoordContext
> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
@@ -1635,7 +1684,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
@@ -1671,7 +1720,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
@@ -1870,6 +1919,16 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|DefaultStepLineChart()||public void DefaultStepLineChart()
默认阶梯折线图。 |
|DefaultTimeLineChart()||public void DefaultTimeLineChart()
默认时间折线图。 |
+## 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)
@@ -1967,7 +2026,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
@@ -3220,6 +3279,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)|
@@ -3259,6 +3319,14 @@ UI组件基类。
UI帮助类。
+## ViewControl
+
+> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
+
+> 从 `v3.11.0` 开始支持
+
+3D视角控制组件。
+
## VisualMap
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
@@ -3272,6 +3340,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)|
@@ -3329,6 +3398,18 @@ UI帮助类。
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()
直角坐标系 grid 中的 x 轴。 |
+## XAxis3D
+
+> class in XCharts.Runtime / 继承自: [Axis](#axis)
+
+> 从 `v3.11.0` 开始支持
+
+直角坐标系 grid 中的 x 轴。
+
+|API|版本|描述|
+|--|--|--|
+|SetDefaultValue()||public override void SetDefaultValue()
直角坐标系 grid 中的 x 轴。 |
+
## XChartsMgr
> class in XCharts.Runtime
@@ -3434,3 +3515,27 @@ UI帮助类。
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()
直角坐标系 grid 中的 y 轴。 |
+## YAxis3D
+
+> class in XCharts.Runtime / 继承自: [Axis](#axis)
+
+> 从 `v3.11.0` 开始支持
+
+直角坐标系 grid 中的 y 轴。
+
+|API|版本|描述|
+|--|--|--|
+|SetDefaultValue()||public override void SetDefaultValue()
直角坐标系 grid 中的 y 轴。 |
+
+## ZAxis3D
+
+> class in XCharts.Runtime / 继承自: [Axis](#axis)
+
+> 从 `v3.11.0` 开始支持
+
+直角坐标系 grid 中的 y 轴。
+
+|API|版本|描述|
+|--|--|--|
+|SetDefaultValue()||public override void SetDefaultValue()
直角坐标系 grid 中的 y 轴。 |
+
diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md
index 7000dd0e..650b60aa 100644
--- a/Documentation~/zh/changelog.md
+++ b/Documentation~/zh/changelog.md
@@ -73,6 +73,8 @@ slug: /changelog
## master
+* (2024.04.22) 增加`GridCoord3D`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)
diff --git a/Documentation~/zh/configuration.md b/Documentation~/zh/configuration.md
index db80a6fe..4e51f47b 100644
--- a/Documentation~/zh/configuration.md
+++ b/Documentation~/zh/configuration.md
@@ -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)
@@ -379,7 +384,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 +400,7 @@ import APITable from '@site/src/components/APITable';
|gridIndex|||坐标轴所在的 grid 的索引,默认位于第一个 grid。
|polarIndex|||坐标轴所在的 ploar 的索引,默认位于第一个 polar。
|parallelIndex|||坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
-|position|||坐标轴在Grid中的位置。
`Axis.AxisPosition`:
- `Left`: 坐标轴在Grid中的位置
- `Right`: 坐标轴在Grid中的位置
- `Bottom`: 坐标轴在Grid中的位置
- `Top`: 坐标轴在Grid中的位置
|
+|position|||坐标轴在Grid中的位置。
`Axis.AxisPosition`:
- `Left`: 坐标轴在Grid中的位置
- `Right`: 坐标轴在Grid中的位置
- `Bottom`: 坐标轴在Grid中的位置
- `Top`: 坐标轴在Grid中的位置
- `Center`: 坐标轴在Grid中的位置
|
|offset|||坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
|min|||设定的坐标轴刻度最小值,当minMaxType为Custom时有效。
|max|||设定的坐标轴刻度最大值,当minMaxType为Custom时有效。
@@ -591,6 +596,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
@@ -754,7 +760,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 +847,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 +999,36 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter 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.
+
+```mdx-code-block
+
+```
+
+|参数|默认|版本|描述|
+|--|--|--|--|
+|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
+
+```
+
## GridLayout
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
@@ -1143,7 +1179,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 +1230,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
@@ -2234,7 +2270,7 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
|triggerOn||v3.11.0|触发条件。
`Tooltip.TriggerOn`:
- `MouseMove`: 鼠标移动时触发。
- `Click`: 鼠标点击时触发。
|
|position||v3.3.0|显示位置类型。
`Tooltip.Position`:
- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。
- `Custom`: 自定义。完全自定义显示位置(x,y)。
- `FixedX`: 只固定坐标X。Y跟随鼠标位置。
- `FixedY`:
|
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。
{i}或-表示忽略当前项。 {.}为当前所指示的serie或数据项的对应颜色的圆点。
{a}为当前所指示的serie或数据项的系列名name。
{b}为当前所指示的serie或数据项的数据项serieData的name,或者类目值(如折线图的X轴)。
{c}为当前所指示的serie或数据项的y维(dimesion为1)的数值。
{d}为当前所指示的serie或数据项的y维(dimesion为1)百分比值,注意不带%号。
{e}为当前所指示的serie或数据项的数据项serieData的name。
{f}为当前所指示的serie的默认维度的数据总和。
{g}为当前所指示的serie的数据总个数。
{h}为当前所指示的serie的十六进制颜色值。
{y}为当前所指示的serie的y轴的类目值。
{c0}表示当前数据项维度为0的数据。
{c1}表示当前数据项维度为1的数据。
{d3}表示维度3的数据的百分比。它的分母是默认维度(一般是1维度)数据。
|表示多个列的分隔。
示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}", "{.}|{b}|{y}"
-|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。
{.}为当前所指示或index为0的serie的对应颜色的圆点。
{a}为当前所指示或index为0的serie的系列名name。
{b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。
{c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。
{d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。
{e}为当前所指示或index为0的serie的数据项serieData的name。
{h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。
{f}为数据总和。
{g}为数据总个数。
{f}为value所对应的y轴的类目值。
{.1}表示指定index为1的serie对应颜色的圆点。
{a1}、{b1}、{c1}中的1表示指定index为1的serie。
{c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。
{c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。
{d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。
{d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。
示例:"{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}。
{.}为当前所指示或index为0的serie的对应颜色的圆点。
{a}为当前所指示或index为0的serie的系列名name。
{b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。
{c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。
{d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。
{e}为当前所指示或index为0的serie的数据项serieData的name。
{h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。
{f}为数据总和。
{g}为数据总个数。
{y}为value所对应的y轴的类目值。
{.1}表示指定index为1的serie对应颜色的圆点。
{a1}、{b1}、{c1}中的1表示指定index为1的serie。
{c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。
{c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。
{d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。
{d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。
示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|marker|||serie的符号标志。
|fixedWidth|0||固定宽度。比 minWidth 优先。
|fixedHeight|0||固定高度。比 minHeight 优先。
@@ -2304,6 +2340,27 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
```
+## ViewControl
+
+> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
+
+> 从 `v3.11.0` 开始支持
+
+3D视角控制组件。
+
+```mdx-code-block
+
+```
+
+|参数|默认|版本|描述|
+|--|--|--|--|
+|alpha|90f||视角在x-z平面的角度。
+|beta|55f||视角在y-z平面的角度。
+
+```mdx-code-block
+
+```
+
## VisualMap
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
@@ -2391,6 +2448,14 @@ Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种
直角坐标系 grid 中的 x 轴。
+## XAxis3D
+
+> class in XCharts.Runtime / 继承自: [Axis](#axis)
+
+> 从 `v3.11.0` 开始支持
+
+直角坐标系 grid 中的 x 轴。
+
## XCResourcesImporter
> class in XCharts.Runtime
@@ -2451,3 +2516,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 轴。
+
diff --git a/Editor/ChildComponents/LineDrawer.cs b/Editor/ChildComponents/LineDrawer.cs
index f3519bb1..dceb65c0 100644
--- a/Editor/ChildComponents/LineDrawer.cs
+++ b/Editor/ChildComponents/LineDrawer.cs
@@ -46,6 +46,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
+ PropertyField(prop, "m_ShowZLine");
}
}
diff --git a/Editor/ChildComponents/ViewControlDrawer.cs b/Editor/ChildComponents/ViewControlDrawer.cs
new file mode 100644
index 00000000..74292abc
--- /dev/null
+++ b/Editor/ChildComponents/ViewControlDrawer.cs
@@ -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;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Editor/ChildComponents/ViewControlDrawer.cs.meta b/Editor/ChildComponents/ViewControlDrawer.cs.meta
new file mode 100644
index 00000000..02ebcb2a
--- /dev/null
+++ b/Editor/ChildComponents/ViewControlDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: faeb8611591ee4c038e88fdb5a67b5ae
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Editor/MainComponents/AxisEditor.cs b/Editor/MainComponents/AxisEditor.cs
index 2a1d6e8e..fdc840b6 100644
--- a/Editor/MainComponents/AxisEditor.cs
+++ b/Editor/MainComponents/AxisEditor.cs
@@ -106,6 +106,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
{
diff --git a/Editor/MainComponents/GridCoord3DEditor.cs b/Editor/MainComponents/GridCoord3DEditor.cs
new file mode 100644
index 00000000..4dd20aa8
--- /dev/null
+++ b/Editor/MainComponents/GridCoord3DEditor.cs
@@ -0,0 +1,23 @@
+using UnityEditor;
+using XCharts.Runtime;
+
+namespace XCharts.Editor
+{
+ [ComponentEditor(typeof(GridCoord3D))]
+ public class GridCoord3DEditor : MainComponentEditor
+ {
+ 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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Editor/MainComponents/GridCoord3DEditor.cs.meta b/Editor/MainComponents/GridCoord3DEditor.cs.meta
new file mode 100644
index 00000000..32b3c336
--- /dev/null
+++ b/Editor/MainComponents/GridCoord3DEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c9a4a8a30b1124c4e996e234d5717a07
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Editor/Series/SerieBaseEditor.cs b/Editor/Series/SerieBaseEditor.cs
index 1022c1f0..48e59668 100644
--- a/Editor/Series/SerieBaseEditor.cs
+++ b/Editor/Series/SerieBaseEditor.cs
@@ -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;
diff --git a/Runtime/Component/Axis/Axis.cs b/Runtime/Component/Axis/Axis.cs
index 5ea81183..696f37de 100644
--- a/Runtime/Component/Axis/Axis.cs
+++ b/Runtime/Component/Axis/Axis.cs
@@ -75,7 +75,8 @@ namespace XCharts.Runtime
Left,
Right,
Bottom,
- Top
+ Top,
+ Center
}
[SerializeField] protected bool m_Show = true;
@@ -729,10 +730,14 @@ namespace XCharts.Runtime
///
///
///
- 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)
{
diff --git a/Runtime/Component/Axis/Axis3DHelper.cs b/Runtime/Component/Axis/Axis3DHelper.cs
new file mode 100644
index 00000000..bd3be5d1
--- /dev/null
+++ b/Runtime/Component/Axis/Axis3DHelper.cs
@@ -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);
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/Axis3DHelper.cs.meta b/Runtime/Component/Axis/Axis3DHelper.cs.meta
new file mode 100644
index 00000000..5d5ac29b
--- /dev/null
+++ b/Runtime/Component/Axis/Axis3DHelper.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 52469636872044a81a291bb00b71a140
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/AxisContext.cs b/Runtime/Component/Axis/AxisContext.cs
index 7a84d3d7..6090feab 100644
--- a/Runtime/Component/Axis/AxisContext.cs
+++ b/Runtime/Component/Axis/AxisContext.cs
@@ -15,6 +15,9 @@ namespace XCharts.Runtime
/// 坐标轴的起点Y
///
public float y;
+ public Vector3 start;
+ public Vector3 end;
+ public Vector3 dire;
///
/// 坐标轴原点X
///
@@ -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;
diff --git a/Runtime/Component/Axis/AxisHandler.cs b/Runtime/Component/Axis/AxisHandler.cs
index f79d2a86..1c476ed1 100644
--- a/Runtime/Component/Axis/AxisHandler.cs
+++ b/Runtime/Component/Axis/AxisHandler.cs
@@ -369,6 +369,116 @@ namespace XCharts
}
}
+ protected void InitAxis3D(Axis relativedAxis, Orient orient)
+ {
+ Axis axis = component;
+ var axisLength = (axis.context.end - axis.context.start).magnitude;
+ 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(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);
+ //CheckValueLabelActive(axis, i, label, 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)
{
diff --git a/Runtime/Component/Axis/AxisSplitLine.cs b/Runtime/Component/Axis/AxisSplitLine.cs
index acebe148..3b2a1fe3 100644
--- a/Runtime/Component/Axis/AxisSplitLine.cs
+++ b/Runtime/Component/Axis/AxisSplitLine.cs
@@ -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;
///
/// 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(); }
}
+ ///
+ /// Whether to show the Z axis part of the split line. Generally used for 3D coordinate systems.
+ /// ||是否显示Z轴部分分割线。一般用于3D坐标系。
+ ///
+ 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()
diff --git a/Runtime/Component/Axis/ParallelAxis/ParallelAxisHander.cs b/Runtime/Component/Axis/ParallelAxis/ParallelAxisHander.cs
index f1e8d57a..be431133 100644
--- a/Runtime/Component/Axis/ParallelAxis/ParallelAxisHander.cs
+++ b/Runtime/Component/Axis/ParallelAxis/ParallelAxisHander.cs
@@ -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;
diff --git a/Runtime/Component/Axis/SingleAxis/SingleAxis.cs b/Runtime/Component/Axis/SingleAxis/SingleAxis.cs
index 5d3cd726..5b2e89e0 100644
--- a/Runtime/Component/Axis/SingleAxis/SingleAxis.cs
+++ b/Runtime/Component/Axis/SingleAxis/SingleAxis.cs
@@ -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);
}
diff --git a/Runtime/Component/Axis/XAxis/XAxisHander.cs b/Runtime/Component/Axis/XAxis/XAxisHander.cs
index 04731658..eb30656d 100644
--- a/Runtime/Component/Axis/XAxis/XAxisHander.cs
+++ b/Runtime/Component/Axis/XAxis/XAxisHander.cs
@@ -57,6 +57,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent(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;
}
diff --git a/Runtime/Component/Axis/XAxis3D.meta b/Runtime/Component/Axis/XAxis3D.meta
new file mode 100644
index 00000000..52962a44
--- /dev/null
+++ b/Runtime/Component/Axis/XAxis3D.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6350e9983955e49c5b48704d3866cbfe
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/XAxis3D/XAxis3D.cs b/Runtime/Component/Axis/XAxis3D/XAxis3D.cs
new file mode 100644
index 00000000..e7f931c5
--- /dev/null
+++ b/Runtime/Component/Axis/XAxis3D/XAxis3D.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace XCharts.Runtime
+{
+ ///
+ /// The x axis in cartesian(rectangular) coordinate.
+ /// ||直角坐标系 grid 中的 x 轴。
+ ///
+ [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() { "x1", "x2", "x3", "x4", "x5" };
+ m_Icons = new List(5);
+ splitLine.show = false;
+ splitLine.lineStyle.type = LineStyle.Type.None;
+ axisLabel.textLimit.enable = true;
+ axisName.name = "X";
+ axisName.labelStyle.position = LabelStyle.Position.Middle;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/XAxis3D/XAxis3D.cs.meta b/Runtime/Component/Axis/XAxis3D/XAxis3D.cs.meta
new file mode 100644
index 00000000..b4a328ee
--- /dev/null
+++ b/Runtime/Component/Axis/XAxis3D/XAxis3D.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9129bca9c2a864e1ea337d7eb74d1024
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs b/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs
new file mode 100644
index 00000000..2c53f601
--- /dev/null
+++ b/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs
@@ -0,0 +1,190 @@
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.EventSystems;
+
+namespace XCharts.Runtime
+{
+ [UnityEngine.Scripting.Preserve]
+ internal sealed class XAxis3DHander : AxisHandler
+ {
+ 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(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(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(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(xAxis.gridIndex);
+ var relativedAxis = chart.GetChartComponent(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(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(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(xAxis.gridIndex);
+ if (grid == null)
+ return;
+
+ var dataZoom = chart.GetDataZoomOfAxis(xAxis);
+ var relativedAxis = chart.GetChartComponent(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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs.meta b/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs.meta
new file mode 100644
index 00000000..20521e32
--- /dev/null
+++ b/Runtime/Component/Axis/XAxis3D/XAxis3DHander.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fc1147481a423494d963df29b423f3a0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/YAxis/YAxisHander.cs b/Runtime/Component/Axis/YAxis/YAxisHander.cs
index 82c54fdd..2474264d 100644
--- a/Runtime/Component/Axis/YAxis/YAxisHander.cs
+++ b/Runtime/Component/Axis/YAxis/YAxisHander.cs
@@ -35,6 +35,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent(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;
}
diff --git a/Runtime/Component/Axis/YAxis3D.meta b/Runtime/Component/Axis/YAxis3D.meta
new file mode 100644
index 00000000..c3f19930
--- /dev/null
+++ b/Runtime/Component/Axis/YAxis3D.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: aa26616789b6b4903aae479a4c552b89
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/YAxis3D/YAxis3D.cs b/Runtime/Component/Axis/YAxis3D/YAxis3D.cs
new file mode 100644
index 00000000..d212c681
--- /dev/null
+++ b/Runtime/Component/Axis/YAxis3D/YAxis3D.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+
+namespace XCharts.Runtime
+{
+ ///
+ /// The x axis in cartesian(rectangular) coordinate.
+ /// ||直角坐标系 grid 中的 y 轴。
+ ///
+ [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(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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/YAxis3D/YAxis3D.cs.meta b/Runtime/Component/Axis/YAxis3D/YAxis3D.cs.meta
new file mode 100644
index 00000000..68c96812
--- /dev/null
+++ b/Runtime/Component/Axis/YAxis3D/YAxis3D.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a3cb4a6657aaf473bbae7162eb189cc0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs b/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs
new file mode 100644
index 00000000..703a3d9f
--- /dev/null
+++ b/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs
@@ -0,0 +1,176 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace XCharts.Runtime
+{
+ [UnityEngine.Scripting.Preserve]
+ internal sealed class YAxis3DHander : AxisHandler
+ {
+ 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(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(yAxis.gridIndex);
+ if (grid != null)
+ {
+ var xAxis = chart.GetChartComponent(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(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(yAxis.gridIndex);
+ var relativedAxis = chart.GetChartComponent(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(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(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(yAxis.gridIndex);
+ if (grid == null)
+ return;
+
+ var dataZoom = chart.GetDataZoomOfAxis(yAxis);
+ var relativedAxis = chart.GetChartComponent(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(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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs.meta b/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs.meta
new file mode 100644
index 00000000..04333262
--- /dev/null
+++ b/Runtime/Component/Axis/YAxis3D/YAxis3DHander.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 56b4be734c61645e1bf91c22a6e3da6c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/ZAxis3D.meta b/Runtime/Component/Axis/ZAxis3D.meta
new file mode 100644
index 00000000..a8fde686
--- /dev/null
+++ b/Runtime/Component/Axis/ZAxis3D.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 378448672ed084b0798c7ad343314693
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs b/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs
new file mode 100644
index 00000000..e4f3e013
--- /dev/null
+++ b/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs
@@ -0,0 +1,33 @@
+using System.Collections.Generic;
+
+namespace XCharts.Runtime
+{
+ ///
+ /// The x axis in cartesian(rectangular) coordinate.
+ /// ||直角坐标系 grid 中的 y 轴。
+ ///
+ [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(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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs.meta b/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs.meta
new file mode 100644
index 00000000..428821da
--- /dev/null
+++ b/Runtime/Component/Axis/ZAxis3D/ZAxis3D.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 65aa8ae88610c431ebdab86935af2379
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs b/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs
new file mode 100644
index 00000000..e6e92574
--- /dev/null
+++ b/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs
@@ -0,0 +1,198 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace XCharts.Runtime
+{
+ [UnityEngine.Scripting.Preserve]
+ internal sealed class ZAxis3DHander : AxisHandler
+ {
+ 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(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(yAxis.gridIndex);
+ if (grid != null)
+ {
+ var relativedAxis = chart.GetChartComponent(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(component.gridIndex);
+ if (grid == null)
+ return Vector3.zero;
+
+ var yAxis = chart.GetChartComponent(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(yAxis.gridIndex);
+ if (grid == null)
+ return;
+
+ var isLeft = grid.IsLeft();
+ if (grid.xyExchanged)
+ {
+ var relativedAxis = chart.GetChartComponent(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(yAxis.gridIndex);
+ Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
+ grid.context.pointB,
+ grid.context.pointF,
+ relativedAxis2);
+ }
+ }
+ else
+ {
+ var relativedAxis = chart.GetChartComponent(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(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(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(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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs.meta b/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs.meta
new file mode 100644
index 00000000..3ea9afe0
--- /dev/null
+++ b/Runtime/Component/Axis/ZAxis3D/ZAxis3DHander.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 67fb4be32885d4915979719c676aac5a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Component/VisualMap/VisualMap.cs b/Runtime/Component/VisualMap/VisualMap.cs
index deee8550..756b8d96 100644
--- a/Runtime/Component/VisualMap/VisualMap.cs
+++ b/Runtime/Component/VisualMap/VisualMap.cs
@@ -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 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);
}
}
diff --git a/Runtime/Coord/Grid3D.meta b/Runtime/Coord/Grid3D.meta
new file mode 100644
index 00000000..08f47467
--- /dev/null
+++ b/Runtime/Coord/Grid3D.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 14f9081aa22ba4bcb9cdbfbb95c7221e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Coord/Grid3D/GridCoord3D.cs b/Runtime/Coord/Grid3D/GridCoord3D.cs
new file mode 100644
index 00000000..04f24314
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3D.cs
@@ -0,0 +1,270 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using XUGL;
+
+namespace XCharts.Runtime
+{
+ ///
+ /// View control component in 3D coordinate system.
+ /// ||3D视角控制组件。
+ ///
+ [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;
+
+ ///
+ /// The angle of the view in the x-z plane.
+ /// ||视角在x-z平面的角度。
+ ///
+ public float alpha
+ {
+ get { return m_Alpha; }
+ set { if (PropertyUtil.SetStruct(ref m_Alpha, value)) SetVerticesDirty(); }
+ }
+
+ ///
+ /// The angle of the view in the y-z plane.
+ /// ||视角在y-z平面的角度。
+ ///
+ public float beta
+ {
+ get { return m_Beta; }
+ set { if (PropertyUtil.SetStruct(ref m_Beta, value)) SetVerticesDirty(); }
+ }
+ }
+
+ ///
+ /// Grid component.
+ /// ||Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
+ /// ||3D网格组件。
+ /// 3D直角坐标系内绘图网格。可以在网格上绘制3D折线图,3D柱状图,3D散点图。
+ ///
+ [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();
+
+ ///
+ /// Whether to show the grid in rectangular coordinate.
+ /// ||是否显示直角坐标系网格。
+ ///
+ public bool show
+ {
+ get { return m_Show; }
+ set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// Distance between grid component and the left side of the container.
+ /// ||grid 组件离容器左侧的距离。
+ ///
+ public float left
+ {
+ get { return m_Left; }
+ set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetAllDirty(); }
+ }
+ ///
+ /// Distance between grid component and the right side of the container.
+ /// ||grid 组件离容器右侧的距离。
+ ///
+ public float right
+ {
+ get { return m_Right; }
+ set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetAllDirty(); }
+ }
+ ///
+ /// Distance between grid component and the top side of the container.
+ /// ||grid 组件离容器上侧的距离。
+ ///
+ public float top
+ {
+ get { return m_Top; }
+ set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetAllDirty(); }
+ }
+ ///
+ /// Distance between grid component and the bottom side of the container.
+ /// ||grid 组件离容器下侧的距离。
+ ///
+ public float bottom
+ {
+ get { return m_Bottom; }
+ set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
+ }
+ ///
+ /// Whether to show the grid border.
+ /// ||是否显示网格边框。
+ ///
+ public bool showBorder
+ {
+ get { return m_ShowBorder; }
+ set { if (PropertyUtil.SetStruct(ref m_ShowBorder, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// The width of the box in the coordinate system.
+ /// ||坐标系的宽度。
+ ///
+ public float boxWidth
+ {
+ get { return m_BoxWidth; }
+ set { if (PropertyUtil.SetStruct(ref m_BoxWidth, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// The height of the box in the coordinate system.
+ /// ||坐标系的高度。
+ ///
+ public float boxHeight
+ {
+ get { return m_BoxHeight; }
+ set { if (PropertyUtil.SetStruct(ref m_BoxHeight, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// The depth of the box in the coordinate system.
+ /// ||坐标系的深度。
+ ///
+ public float boxDepth
+ {
+ get { return m_BoxDepth; }
+ set { if (PropertyUtil.SetStruct(ref m_BoxDepth, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// Whether to exchange the x and y axes.
+ /// ||是否交换x和y轴。
+ ///
+ public bool xyExchanged
+ {
+ get { return m_XYExchanged; }
+ set { if (PropertyUtil.SetStruct(ref m_XYExchanged, value)) SetVerticesDirty(); }
+ }
+ ///
+ /// View control component in 3D coordinate system.
+ /// ||3D视角控制组件。
+ ///
+ 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;
+ }
+
+ ///
+ /// The opening of the coordinate system faces to the left.
+ /// 坐标系开口朝向左边。
+ ///
+ ///
+ public bool IsLeft()
+ {
+ return context.pointB.x < context.pointA.x;
+ }
+
+ ///
+ /// Whether the pointer is in the grid.
+ /// ||指针是否在网格内。
+ ///
+ ///
+ public bool IsPointerEnter()
+ {
+ return context.isPointerEnter;
+ }
+
+ ///
+ /// Whether the given position is in the grid.
+ /// ||给定的位置是否在网格内。
+ ///
+ ///
+ ///
+ 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;
+ }
+
+ ///
+ /// Clamp the position of pos to the grid.
+ /// ||将位置限制在网格内。
+ ///
+ ///
+ public void Clamp(ref Vector3 pos)
+ {
+ //TODO:
+ }
+
+ ///
+ /// Determines whether a given line segment will not intersect the Grid boundary at all.
+ /// ||判断给定的线段是否与Grid边界是否完全不会相交。
+ ///
+ ///
+ ///
+ ///
+ public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
+ {
+ //TODO:
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Coord/Grid3D/GridCoord3D.cs.meta b/Runtime/Coord/Grid3D/GridCoord3D.cs.meta
new file mode 100644
index 00000000..9094e1ca
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3D.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 95f8c8c3492e54987af59175d94f8761
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Coord/Grid3D/GridCoord3DContext.cs b/Runtime/Coord/Grid3D/GridCoord3DContext.cs
new file mode 100644
index 00000000..1b134f15
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3DContext.cs
@@ -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 endLabelList = new List();
+ //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;
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Coord/Grid3D/GridCoord3DContext.cs.meta b/Runtime/Coord/Grid3D/GridCoord3DContext.cs.meta
new file mode 100644
index 00000000..7e53fdc3
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3DContext.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a4a0f1dda078b4877bfabe3c16815498
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Coord/Grid3D/GridCoord3DHandler.cs b/Runtime/Coord/Grid3D/GridCoord3DHandler.cs
new file mode 100644
index 00000000..4dcf685b
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3DHandler.cs
@@ -0,0 +1,80 @@
+using System.Text;
+using UnityEngine;
+using UnityEngine.UI;
+using XUGL;
+
+namespace XCharts.Runtime
+{
+ [UnityEngine.Scripting.Preserve]
+ internal sealed class GridCoord3DHandler : MainComponentHandler
+ {
+ 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 DrawBase(VertexHelper vh)
+ {
+ if (!SeriesHelper.IsAnyClipSerie(chart.series))
+ {
+ DrawCoord(vh, component);
+ }
+ }
+ public override void DrawUpper(VertexHelper vh)
+ {
+ if (SeriesHelper.IsAnyClipSerie(chart.series))
+ {
+ DrawCoord(vh, component);
+ }
+ }
+
+ private void DrawCoord(VertexHelper vh, GridCoord3D grid)
+ {
+ if (!grid.show) return;
+ if (grid.showBorder)
+ {
+ var borderWidth = chart.theme.axis.lineWidth * 2;
+ var borderColor = chart.theme.axis.lineColor;
+ UGL.DrawBorder(vh, grid.context.maxRect, borderWidth, borderColor);
+ // UGL.DrawBorder(vh, grid.context.center, grid.context.width - borderWidth,
+ // grid.context.height - borderWidth, borderWidth, borderColor);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Runtime/Coord/Grid3D/GridCoord3DHandler.cs.meta b/Runtime/Coord/Grid3D/GridCoord3DHandler.cs.meta
new file mode 100644
index 00000000..0fab114b
--- /dev/null
+++ b/Runtime/Coord/Grid3D/GridCoord3DHandler.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 92481e92b90724f46b3a7e8c585e12e7
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Internal/BaseChart.Custom.cs b/Runtime/Internal/BaseChart.Custom.cs
index 7c761e68..1159477d 100644
--- a/Runtime/Internal/BaseChart.Custom.cs
+++ b/Runtime/Internal/BaseChart.Custom.cs
@@ -13,10 +13,14 @@ namespace XCharts.Runtime
var needAnimationData = !axis.context.needAnimation;
if (IsAllAxisValue())
{
- if (axis is XAxis)
+ if (axis is XAxis || 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
{
SeriesHelper.GetYMinMaxValue(this, axisIndex, axis.inverse, out tempMinValue, out tempMaxValue, false, false, needAnimationData);
diff --git a/Runtime/Internal/Data/GraphData.cs b/Runtime/Internal/Data/GraphData.cs
index cc293751..ea0414c1 100644
--- a/Runtime/Internal/Data/GraphData.cs
+++ b/Runtime/Internal/Data/GraphData.cs
@@ -386,6 +386,11 @@ namespace XCharts.Runtime
public int depth = -1;
public bool expand = true;
public int level = 0;
+ public Vector3 position;
+ public Vector3 delta;
+ public float weight;
+ public float repulsion;
+ public Vector3 pp;
public GraphNode(string id, string name, int dataIndex)
{
@@ -472,6 +477,7 @@ namespace XCharts.Runtime
public List points = new List();
public float width;
+ public float distance;
public bool highlight;
public bool expand = true;
diff --git a/Runtime/Internal/Utilities/DataHelper.cs b/Runtime/Internal/Utilities/DataHelper.cs
index c7c8db54..b0399248 100644
--- a/Runtime/Internal/Utilities/DataHelper.cs
+++ b/Runtime/Internal/Utilities/DataHelper.cs
@@ -3,7 +3,7 @@ using UnityEngine;
namespace XCharts.Runtime
{
- internal static class DataHelper
+ public static class DataHelper
{
public static double DataAverage(ref List showData, SampleType sampleType,
int minCount, int maxCount, int rate)
diff --git a/Runtime/Serie/Candlestick/Candlestick.cs b/Runtime/Serie/Candlestick/Candlestick.cs
index dcfbfddf..64ab8f80 100644
--- a/Runtime/Serie/Candlestick/Candlestick.cs
+++ b/Runtime/Serie/Candlestick/Candlestick.cs
@@ -16,7 +16,6 @@ namespace XCharts.Runtime
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
{
var serie = chart.AddSerie(serieName);
- var defaultDataCount = 5;
var lastValue = 50d;
for (int i = 0; i < 5; i++)
{
diff --git a/Runtime/Serie/Line/LineHandler.GridCoord.cs b/Runtime/Serie/Line/LineHandler.GridCoord.cs
index dd450e9d..c390ff7c 100644
--- a/Runtime/Serie/Line/LineHandler.GridCoord.cs
+++ b/Runtime/Serie/Line/LineHandler.GridCoord.cs
@@ -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);
diff --git a/Runtime/Serie/Line/LineHelper.cs b/Runtime/Serie/Line/LineHelper.cs
index fb43eb6e..9ade9211 100644
--- a/Runtime/Serie/Line/LineHelper.cs
+++ b/Runtime/Serie/Line/LineHelper.cs
@@ -5,17 +5,16 @@ using XUGL;
namespace XCharts.Runtime
{
- internal static class LineHelper
+ public static class LineHelper
{
private static List s_CurvesPosList = new List();
- 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;
diff --git a/Runtime/Serie/Line/SimplifiedLineHandler.cs b/Runtime/Serie/Line/SimplifiedLineHandler.cs
index 069b9e0c..aedd02a6 100644
--- a/Runtime/Serie/Line/SimplifiedLineHandler.cs
+++ b/Runtime/Serie/Line/SimplifiedLineHandler.cs
@@ -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);
diff --git a/Runtime/Serie/SerieContext.cs b/Runtime/Serie/SerieContext.cs
index d3b3931a..e7ff4551 100644
--- a/Runtime/Serie/SerieContext.cs
+++ b/Runtime/Serie/SerieContext.cs
@@ -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;
}
}
diff --git a/Runtime/Serie/SeriesHelper.cs b/Runtime/Serie/SeriesHelper.cs
index a8575bc2..fc65b45b 100644
--- a/Runtime/Serie/SeriesHelper.cs
+++ b/Runtime/Serie/SeriesHelper.cs
@@ -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);
}
///
@@ -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);
+ }
+
+ ///
+ /// 获得维度Z的最大最小值
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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> _stackSeriesForMinMax = new Dictionary>();
private static Dictionary _serieTotalValueForMinMax = new Dictionary();
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;
diff --git a/Runtime/XUGL/UGLHelper.cs b/Runtime/XUGL/UGLHelper.cs
index c695cb45..a4d54a0d 100644
--- a/Runtime/XUGL/UGLHelper.cs
+++ b/Runtime/XUGL/UGLHelper.cs
@@ -310,7 +310,7 @@ namespace XUGL
/// 下一个点的下角点
/// 交汇点的上角点
/// 交汇点的下角点
- 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 polyons)
{
if (polyons.Count == 0) return false;