增加GridCoord3D3D坐标系

This commit is contained in:
monitor1394
2024-04-22 22:25:12 +08:00
parent e2120b3da6
commit 120c6d5408
55 changed files with 2062 additions and 51 deletions

View File

@@ -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()<br/>get the history data count. |
|GetData()||public string GetData(int index)<br/>获得指定索引的类目数据 |
|GetData()||public string GetData(int index, DataZoom dataZoom)<br/>获得在dataZoom范围内指定索引的类目数据 |
|GetDistance()||public float GetDistance(double value, float axisLength)<br/>获得值在坐标轴上的距离 |
|GetDistance()||public float GetDistance(double value, float axisLength = 0)<br/>获得值在坐标轴上的距离 |
|GetIcon()||public Sprite GetIcon(int index)|
|GetLabelValue()||public double GetLabelValue(int index)|
|GetLastLabelValue()||public double GetLastLabelValue()|
@@ -458,6 +467,17 @@ The axis in rectangular coordinate.
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)<br/>更新图标 |
|UpdateZeroOffset()||public void UpdateZeroOffset(float axisLength)|
## Axis3DHelper
> class in XCharts.Runtime
|public method|since|description|
|--|--|--|
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)|
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)|
|GetLabelPosition()||public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)|
## AxisAnimation
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
@@ -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&lt;List&lt;GraphNode&gt;&gt; GetDepthNodes()|
|GetEdge()||public GraphEdge GetEdge(string nodeId1, string nodeId2)|
|GetExpandedNodesCount()||public static int GetExpandedNodesCount(List&lt;GraphNode&gt; 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)<br/>Determines whether a given line segment will not intersect the Grid boundary at all. |
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
## GridCoord3D
> class in XCharts.Runtime / Inherits from: [CoordSystem](#coordsystem),[IUpdateRuntimeData](#iupdateruntimedata),[ISerieContainer](#iseriecontainer)
> Since `v3.11.0`
Grid component.
|public method|since|description|
|--|--|--|
|Clamp()||public void Clamp(ref Vector3 pos)<br/>Clamp the position of pos to the grid. |
|Contains()||public bool Contains(Vector3 pos)<br/>Whether the given position is in the grid. |
|IsLeft()||public bool IsLeft()<br/>The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
|IsPointerEnter()||public bool IsPointerEnter()<br/>Whether the pointer is in the grid. |
|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>Determines whether a given line segment will not intersect the Grid boundary at all. |
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
## GridCoord3DContext
> class in XCharts.Runtime / Inherits from: [MainComponentContext](#maincomponentcontext)
## GridCoordContext
> class in XCharts.Runtime / Inherits from: [MainComponentContext](#maincomponentcontext)
@@ -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()<br/>default step line chart. |
|DefaultTimeLineChart()||public void DefaultTimeLineChart()<br/>default time line chart. |
## LineHelper
> class in XCharts.Runtime
|public method|since|description|
|--|--|--|
|GetDataAverageRate()||public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)|
|GetLineWidth()||public static float GetLineWidth(ref bool interacting, Serie serie, float defaultWidth)|
## LineStyle
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent),[ISerieDataComponent](#iseriedatacomponent)
@@ -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&lt;Vector2&gt; polyons)|
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List&lt;Vector3&gt; 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()<br/>The x axis in cartesian(rectangular) coordinate. |
## XAxis3D
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
> Since `v3.11.0`
The x axis in cartesian(rectangular) coordinate.
|public method|since|description|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
## XChartsMgr
> class in XCharts.Runtime
@@ -3434,3 +3515,27 @@ The x axis in cartesian(rectangular) coordinate.
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
## YAxis3D
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
> Since `v3.11.0`
The x axis in cartesian(rectangular) coordinate.
|public method|since|description|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |
## ZAxis3D
> class in XCharts.Runtime / Inherits from: [Axis](#axis)
> Since `v3.11.0`
The x axis in cartesian(rectangular) coordinate.
|public method|since|description|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>The x axis in cartesian(rectangular) coordinate. |

View File

@@ -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.<br/>`Axis.AxisPosition`:<br/>- `Left`: the position of axis in grid.<br/>- `Right`: the position of axis in grid.<br/>- `Bottom`: the position of axis in grid.<br/>- `Top`: the position of axis in grid.<br/>|
|position|||the position of axis in grid.<br/>`Axis.AxisPosition`:<br/>- `Left`: the position of axis in grid.<br/>- `Right`: the position of axis in grid.<br/>- `Bottom`: the position of axis in grid.<br/>- `Top`: the position of axis in grid.<br/>- `Center`: the position of axis in grid.<br/>|
|offset|||the offset of axis from the default position. Useful when the same position has multiple axes.
|min|||The minimun value of axis.Valid when `minMaxType` is `Custom`
|max|||The maximum value of axis.Valid when `minMaxType` is `Custom`
@@ -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
</APITable>
@@ -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.
</APITable>
```
## GridCoord3D
> class in XCharts.Runtime / Inherits from: [CoordSystem](#coordsystem), [IUpdateRuntimeData](#iupdateruntimedata), [ISerieContainer](#iseriecontainer)
> Since `v3.11.0`
Grid component.
```mdx-code-block
<APITable name="GridCoord3D">
```
|field|default|since|comment|
|--|--|--|--|
|show|true||Whether to show the grid in rectangular coordinate.
|left|0.15f||Distance between grid component and the left side of the container.
|right|0.2f||Distance between grid component and the right side of the container.
|top|0.3f||Distance between grid component and the top side of the container.
|bottom|0.15f||Distance between grid component and the bottom side of the container.
|showBorder|false||Whether to show the grid border.
|boxWidth|0.55f||The width of the box in the coordinate system.
|boxHeight|0.4f||The height of the box in the coordinate system.
|boxDepth|0.2f||The depth of the box in the coordinate system.
|xYExchanged|false||
|viewControl|||View control component in 3D coordinate system. [ViewControl](#viewcontrol)|
```mdx-code-block
</APITable>
```
## GridLayout
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
@@ -1177,7 +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.
</APITable>
```
## ViewControl
> class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
> Since `v3.11.0`
View control component in 3D coordinate system.
```mdx-code-block
<APITable name="ViewControl">
```
|field|default|since|comment|
|--|--|--|--|
|alpha|90f||The angle of the view in the x-z plane.
|beta|55f||The angle of the view in the y-z plane.
```mdx-code-block
</APITable>
```
## VisualMap
> class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent)
@@ -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.

View File

@@ -22,6 +22,7 @@ slug: /api
- [AreaStyle](#areastyle)
- [ArrowStyle](#arrowstyle)
- [Axis](#axis)
- [Axis3DHelper](#axis3dhelper)
- [AxisAnimation](#axisanimation)
- [AxisContext](#axiscontext)
- [AxisHandler&lt;T&gt;](#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()<br/>获得添加过的历史数据总数 |
|GetData()||public string GetData(int index)<br/>获得指定索引的类目数据 |
|GetData()||public string GetData(int index, DataZoom dataZoom)<br/>获得在dataZoom范围内指定索引的类目数据 |
|GetDistance()||public float GetDistance(double value, float axisLength)<br/>获得值在坐标轴上的距离 |
|GetDistance()||public float GetDistance(double value, float axisLength = 0)<br/>获得值在坐标轴上的距离 |
|GetIcon()||public Sprite GetIcon(int index)|
|GetLabelValue()||public double GetLabelValue(int index)|
|GetLastLabelValue()||public double GetLastLabelValue()|
@@ -458,6 +467,17 @@ slug: /api
|UpdateIcon()||public void UpdateIcon(int index, Sprite icon)<br/>更新图标 |
|UpdateZeroOffset()||public void UpdateZeroOffset(float axisLength)|
## Axis3DHelper
> class in XCharts.Runtime
|API|版本|描述|
|--|--|--|
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)|
|Get3DGridPosition()||public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)|
|GetLabelPosition()||public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)|
## AxisAnimation
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
@@ -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&lt;List&lt;GraphNode&gt;&gt; GetDepthNodes()|
|GetEdge()||public GraphEdge GetEdge(string nodeId1, string nodeId2)|
|GetExpandedNodesCount()||public static int GetExpandedNodesCount(List&lt;GraphNode&gt; 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)<br/>判断给定的线段是否与Grid边界是否完全不会相交。 |
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
## GridCoord3D
> class in XCharts.Runtime / 继承自: [CoordSystem](#coordsystem),[IUpdateRuntimeData](#iupdateruntimedata),[ISerieContainer](#iseriecontainer)
> 从 `v3.11.0` 开始支持
Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
|API|版本|描述|
|--|--|--|
|Clamp()||public void Clamp(ref Vector3 pos)<br/>将位置限制在网格内。 |
|Contains()||public bool Contains(Vector3 pos)<br/>给定的位置是否在网格内。 |
|IsLeft()||public bool IsLeft()<br/>The opening of the coordinate system faces to the left. 坐标系开口朝向左边。 |
|IsPointerEnter()||public bool IsPointerEnter()<br/>指针是否在网格内。 |
|NotAnyIntersect()||public bool NotAnyIntersect(Vector3 sp, Vector3 ep)<br/>判断给定的线段是否与Grid边界是否完全不会相交。 |
|UpdateRuntimeData()||public void UpdateRuntimeData(BaseChart chart)|
## GridCoord3DContext
> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
## GridCoordContext
> class in XCharts.Runtime / 继承自: [MainComponentContext](#maincomponentcontext)
@@ -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()<br/>默认阶梯折线图。 |
|DefaultTimeLineChart()||public void DefaultTimeLineChart()<br/>默认时间折线图。 |
## LineHelper
> class in XCharts.Runtime
|API|版本|描述|
|--|--|--|
|GetDataAverageRate()||public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)|
|GetLineWidth()||public static float GetLineWidth(ref bool interacting, Serie serie, float defaultWidth)|
## LineStyle
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent),[ISerieDataComponent](#iseriedatacomponent)
@@ -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&lt;Vector2&gt; polyons)|
|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List&lt;Vector3&gt; 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()<br/>直角坐标系 grid 中的 x 轴。 |
## XAxis3D
> class in XCharts.Runtime / 继承自: [Axis](#axis)
> 从 `v3.11.0` 开始支持
直角坐标系 grid 中的 x 轴。
|API|版本|描述|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 x 轴。 |
## XChartsMgr
> class in XCharts.Runtime
@@ -3434,3 +3515,27 @@ UI帮助类。
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |
## YAxis3D
> class in XCharts.Runtime / 继承自: [Axis](#axis)
> 从 `v3.11.0` 开始支持
直角坐标系 grid 中的 y 轴。
|API|版本|描述|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |
## ZAxis3D
> class in XCharts.Runtime / 继承自: [Axis](#axis)
> 从 `v3.11.0` 开始支持
直角坐标系 grid 中的 y 轴。
|API|版本|描述|
|--|--|--|
|SetDefaultValue()||public override void SetDefaultValue()<br/>直角坐标系 grid 中的 y 轴。 |

View File

@@ -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)

View File

@@ -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中的位置。<br/>`Axis.AxisPosition`:<br/>- `Left`: 坐标轴在Grid中的位置<br/>- `Right`: 坐标轴在Grid中的位置<br/>- `Bottom`: 坐标轴在Grid中的位置<br/>- `Top`: 坐标轴在Grid中的位置<br/>|
|position|||坐标轴在Grid中的位置。<br/>`Axis.AxisPosition`:<br/>- `Left`: 坐标轴在Grid中的位置<br/>- `Right`: 坐标轴在Grid中的位置<br/>- `Bottom`: 坐标轴在Grid中的位置<br/>- `Top`: 坐标轴在Grid中的位置<br/>- `Center`: 坐标轴在Grid中的位置<br/>|
|offset|||坐标轴相对默认位置的偏移。在相同position有多个坐标轴时有用。
|min|||设定的坐标轴刻度最小值当minMaxType为Custom时有效。
|max|||设定的坐标轴刻度最大值当minMaxType为Custom时有效。
@@ -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
</APITable>
@@ -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
</APITable>
```
## GridCoord3D
> class in XCharts.Runtime / 继承自: [CoordSystem](#coordsystem), [IUpdateRuntimeData](#iupdateruntimedata), [ISerieContainer](#iseriecontainer)
> 从 `v3.11.0` 开始支持
Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
```mdx-code-block
<APITable name="GridCoord3D">
```
|参数|默认|版本|描述|
|--|--|--|--|
|show|true||是否显示直角坐标系网格。
|left|0.15f||grid 组件离容器左侧的距离。
|right|0.2f||grid 组件离容器右侧的距离。
|top|0.3f||grid 组件离容器上侧的距离。
|bottom|0.15f||grid 组件离容器下侧的距离。
|showBorder|false||是否显示网格边框。
|boxWidth|0.55f||坐标系的宽度。
|boxHeight|0.4f||坐标系的高度。
|boxDepth|0.2f||坐标系的深度。
|xYExchanged|false||
|viewControl|||3D视角控制组件。 [ViewControl](#viewcontrol)|
```mdx-code-block
</APITable>
```
## GridLayout
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
@@ -1143,7 +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|触发条件。<br/>`Tooltip.TriggerOn`:<br/>- `MouseMove`: 鼠标移动时触发。<br/>- `Click`: 鼠标点击时触发。<br/>|
|position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>|
|itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用|来表示多个列的分隔。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {i}或-表示忽略当前项。 {.}为当前所指示的serie或数据项的对应颜色的圆点。<br/> {a}为当前所指示的serie或数据项的系列名name。<br/> {b}为当前所指示的serie或数据项的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示的serie或数据项的y维dimesion为1的数值。<br/> {d}为当前所指示的serie或数据项的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示的serie或数据项的数据项serieData的name。<br/> {f}为当前所指示的serie的默认维度的数据总和。<br/> {g}为当前所指示的serie的数据总个数。<br/> {h}为当前所指示的serie的十六进制颜色值。<br/> {y}为当前所指示的serie的y轴的类目值。<br/> {c0}表示当前数据项维度为0的数据。<br/> {c1}表示当前数据项维度为1的数据。<br/> {d3}表示维度3的数据的百分比。它的分母是默认维度一般是1维度数据。<br/> |表示多个列的分隔。<br/> 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}", "{.}|{b}|{y}"
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> {d}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {f}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name或者类目值如折线图的X轴。<br/> {c}为当前所指示或index为0的serie的y维dimesion为1的数值。<br/> {d}为当前所指示或index为0的serie的y维dimesion为1百分比值注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {y}为value所对应的y轴的类目值。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据一个数据项有多个数据index为2表示第3个数据。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据也就是要指定第几个数据项时必须要指定第几个数据。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## 用于百分比保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"
|marker|||serie的符号标志。
|fixedWidth|0||固定宽度。比 minWidth 优先。
|fixedHeight|0||固定高度。比 minHeight 优先。
@@ -2304,6 +2340,27 @@ Serie的状态样式。Serie的状态有正常高亮淡出选中四种
</APITable>
```
## ViewControl
> class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
> 从 `v3.11.0` 开始支持
3D视角控制组件。
```mdx-code-block
<APITable name="ViewControl">
```
|参数|默认|版本|描述|
|--|--|--|--|
|alpha|90f||视角在x-z平面的角度。
|beta|55f||视角在y-z平面的角度。
```mdx-code-block
</APITable>
```
## VisualMap
> class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent)
@@ -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 轴。

View File

@@ -46,6 +46,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
PropertyField(prop, "m_ShowZLine");
}
}

View File

@@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ViewControl), true)]
public class ViewControlDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ViewControl"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Alpha");
PropertyField(prop, "m_Beta");
--EditorGUI.indentLevel;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: faeb8611591ee4c038e88fdb5a67b5ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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
{

View File

@@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord3D))]
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Bottom");
PropertyField("m_BoxWidth");
PropertyField("m_BoxHeight");
PropertyField("m_BoxDepth");
PropertyField("m_XYExchanged");
PropertyField("m_ShowBorder");
PropertyField("m_ViewControl");
--EditorGUI.indentLevel;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9a4a8a30b1124c4e996e234d5717a07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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;

View File

@@ -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
/// <param name="value"></param>
/// <param name="axisLength"></param>
/// <returns></returns>
public float GetDistance(double value, float axisLength)
public float GetDistance(double value, float axisLength = 0)
{
if (context.minMaxRange == 0)
return 0;
if (axisLength == 0)
{
axisLength = context.length;
}
if (IsCategory() && boundaryGap)
{

View File

@@ -0,0 +1,160 @@
using UnityEngine;
using UnityEngine.UI;
using XUGL;
namespace XCharts.Runtime
{
public static class Axis3DHelper
{
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, ZAxis3D zAxis, double xValue, double yValue, double zValue)
{
var x = xAxis.GetDistance(xValue);
var y = yAxis.GetDistance(yValue);
var z = zAxis.GetDistance(zValue);
var dest = grid.context.pointA;
dest += xAxis.context.dire * x;
dest += yAxis.context.dire * y;
dest += zAxis.context.dire * z;
return dest;
}
public static Vector3 Get3DGridPosition(GridCoord3D grid, XAxis3D xAxis, YAxis3D yAxis, double xValue, double yValue)
{
var x = xAxis.GetDistance(xValue);
var y = yAxis.GetDistance(yValue);
var dest = grid.context.pointA;
dest += xAxis.context.dire * x;
dest += yAxis.context.dire * y;
return dest;
}
internal static void DrawAxisTick(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
Vector3 start, Vector3 end, Vector3 relativedDire)
{
var tickLength = axis.axisTick.GetLength(theme.tickLength);
var axisLength = Vector3.Distance(start, end);
var axisDire = (end - start).normalized;
if (axis.position == Axis.AxisPosition.Right)
{
relativedDire = -relativedDire;
}
if (AxisHelper.NeedShowSplit(axis))
{
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
if (axis.IsTime())
{
size += 1;
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
size += 1;
}
var tickWidth = axis.axisTick.GetWidth(theme.tickWidth);
var tickColor = axis.axisTick.GetColor(theme.tickColor);
var current = start;
for (int i = 0; i < size; i++)
{
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
var hideTick = (i == 0 && (!axis.axisTick.showStartTick || axis.axisTick.alignWithLabel)) ||
(i == size - 1 && !axis.axisTick.showEndTick);
if (axis.axisTick.show && !hideTick)
{
UGL.DrawLine(vh, current, current + relativedDire * tickLength, tickWidth, tickColor);
}
current += axisDire * scaleWidth;
}
}
if (axis.show && axis.axisLine.show && axis.axisLine.showArrow)
{
}
}
public static void DrawAxisSplit(VertexHelper vh, Axis axis, AxisTheme theme, DataZoom dataZoom,
Vector3 start, Vector3 end, Axis relativedAxis)
{
if (relativedAxis == null) return;
var axisLength = Vector3.Distance(start, end);
var axisDire = (end - start).normalized;
var splitLength = relativedAxis.context.length;
var relativeDire = relativedAxis.context.dire;
var axisLineWidth = axis.axisLine.GetWidth(theme.lineWidth);
splitLength -= axisLineWidth;
var lineColor = axis.splitLine.GetColor(theme.splitLineColor);
var lineWidth = axis.splitLine.GetWidth(theme.lineWidth);
var lineType = axis.splitLine.GetType(theme.splitLineType);
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
if (axis.IsTime())
{
size += 1;
if (!ChartHelper.IsEquals(axis.GetLastLabelValue(), axis.context.maxValue))
size += 1;
}
var current = start;
for (int i = 0; i < size; i++)
{
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
if (axis.boundaryGap && axis.axisTick.alignWithLabel)
current -= axisDire * scaleWidth / 2;
if (axis.splitArea.show && i <= size - 1)
{
var p1 = current;
var p2 = current + relativeDire * splitLength;
var p3 = p2 + axisDire * scaleWidth;
var p4 = p1 + axisDire * scaleWidth;
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, axis.splitArea.GetColor(i, theme));
}
if (axis.splitLine.show)
{
if (axis.splitLine.NeedShow(i, size))
{
if (relativedAxis == null || !relativedAxis.axisLine.show
|| (Vector3.Distance(current, relativedAxis.context.start) > 0.5f && Vector3.Distance(current, relativedAxis.context.end) > 0.5f))
{
ChartDrawer.DrawLineStyle(vh,
lineType,
lineWidth,
current,
current + relativeDire * splitLength,
lineColor);
}
}
}
current += axisDire * scaleWidth;
}
}
public static Vector3 GetLabelPosition(int i, Axis axis, Axis relativedAxis, AxisTheme theme, float scaleWid)
{
var axisStart = axis.context.start;
var axisEnd = axis.context.end;
var axisDire = axis.context.dire;
var relativedDire = relativedAxis != null ? relativedAxis.context.dire : Vector3.zero;
var axisLength = Vector3.Distance(axisStart, axisEnd);
var inside = axis.axisLabel.inside;
var fontSize = axis.axisLabel.textStyle.GetFontSize(theme);
var current = axis.offset;
if (axis.position == Axis.AxisPosition.Right)
{
relativedDire = -relativedDire;
}
if (axis.IsTime() || axis.IsValue())
{
scaleWid = axis.context.minMaxRange != 0 ?
axis.GetDistance(axis.GetLabelValue(i), axisLength) :
0;
}
return axisStart + axisDire * scaleWid + axis.axisLabel.offset - relativedDire * (axis.axisLabel.distance + fontSize / 2);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52469636872044a81a291bb00b71a140
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -15,6 +15,9 @@ namespace XCharts.Runtime
/// 坐标轴的起点Y
/// </summary>
public float y;
public Vector3 start;
public Vector3 end;
public Vector3 dire;
/// <summary>
/// 坐标轴原点X
/// </summary>
@@ -25,6 +28,7 @@ namespace XCharts.Runtime
public float zeroY;
public float width;
public float height;
public float length;
public Vector3 position;
public float left;
public float right;

View File

@@ -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<Bar>(chart.series);
var inside = axis.axisLabel.inside;
var defaultAlignment = orient == Orient.Horizonal ? TextAnchor.MiddleCenter :
((inside && axis.IsLeft()) || (!inside && axis.IsRight()) ?
TextAnchor.MiddleLeft :
TextAnchor.MiddleRight);
if (axis.IsCategory() && axis.boundaryGap)
splitNumber -= 1;
axis.context.aligment = defaultAlignment;
for (int i = 0; i < splitNumber; i++)
{
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
var labelName = AxisHelper.GetLabelName(axis, axisLength, i,
axis.context.destMinValue,
axis.context.destMaxValue,
dataZoom, isPercentStack);
var label = ChartHelper.AddAxisLabelObject(splitNumber, i,
ChartCached.GetAxisLabelName(i),
axisObj.transform,
new Vector2(textWidth, textHeight),
axis, chart.theme.axis, labelName,
Color.clear,
defaultAlignment,
chart.theme.GetColor(i));
if (i == 0)
axis.axisLabel.SetRelatedText(label.text, labelWidth);
var pos = GetLabelPosition(totalWidth + gapWidth, i);
label.SetPosition(pos);
//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)
{

View File

@@ -15,6 +15,7 @@ namespace XCharts.Runtime
[SerializeField] private bool m_AutoColor;
[SerializeField][Since("v3.3.0")] private bool m_ShowStartLine = true;
[SerializeField][Since("v3.3.0")] private bool m_ShowEndLine = true;
[SerializeField][Since("v3.11.0")] private bool m_ShowZLine = true;
/// <summary>
/// The distance between the split line and axis line.
@@ -53,6 +54,15 @@ namespace XCharts.Runtime
get { return m_ShowEndLine; }
set { if (PropertyUtil.SetStruct(ref m_ShowEndLine, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to show the Z axis part of the split line. Generally used for 3D coordinate systems.
/// ||是否显示Z轴部分分割线。一般用于3D坐标系。
/// </summary>
public bool showZLine
{
get { return m_ShowZLine; }
set { if (PropertyUtil.SetStruct(ref m_ShowZLine, value)) SetVerticesDirty(); }
}
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
public override void ClearVerticesDirty()

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -57,6 +57,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent<YAxis>(axis.gridIndex);
axis.context.x = grid.context.x;
axis.context.y = AxisHelper.GetXAxisXOrY(grid, axis, relativedAxis);
axis.context.start = new Vector3(grid.context.x, axis.context.y);
axis.context.end = new Vector3(grid.context.x + grid.context.width, axis.context.y);
var vec = axis.context.end - axis.context.start;
axis.context.dire = vec.normalized;
axis.context.length = vec.magnitude;
axis.context.zeroY = grid.context.y;
axis.context.zeroX = grid.context.x + axis.context.offset;
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6350e9983955e49c5b48704d3866cbfe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 x 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D))]
[ComponentHandler(typeof(XAxis3DHander), true)]
public class XAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Category;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = true;
m_Position = AxisPosition.Bottom;
m_Offset = 0;
m_Data = new List<string>() { "x1", "x2", "x3", "x4", "x5" };
m_Icons = new List<Sprite>(5);
splitLine.show = false;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = true;
axisName.name = "X";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9129bca9c2a864e1ea337d7eb74d1024
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,190 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class XAxis3DHander : AxisHandler<XAxis3D>
{
protected override Orient orient { get { return Orient.Horizonal; } }
public override void InitComponent()
{
InitXAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
if (!chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerClick(PointerEventData eventData)
{
base.OnPointerClick(eventData);
if (chart.isTriggerOnClick)
{
UpdatePointerValue(component);
}
}
public override void OnPointerExit(PointerEventData eventData)
{
base.OnPointerExit(eventData);
if (chart.isTriggerOnClick)
{
component.context.pointerValue = double.PositiveInfinity;
}
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawXAxisSplit(vh, component);
DrawXAxisLine(vh, component);
DrawXAxisTick(vh, component);
}
private void UpdatePosition(XAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (axis.position == Axis.AxisPosition.Right || axis.position == Axis.AxisPosition.Top)
{
axis.context.start = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
axis.context.end = grid.context.pointC;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
}
var vect = axis.context.end - axis.context.start;
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitXAxis(XAxis3D xAxis)
{
var theme = chart.theme;
var xAxisIndex = xAxis.index;
xAxis.painter = chart.painter;
xAxis.refreshComponent = delegate ()
{
var yAxis = chart.GetChartComponent<YAxis3D>(xAxis.index);
InitAxis3D(yAxis, orient);
};
xAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(component, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var yAxis = chart.GetChartComponent<YAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, yAxis, chart.theme.axis, scaleWid);
}
private void DrawXAxisSplit(VertexHelper vh, XAxis3D xAxis)
{
if (AxisHelper.NeedShowSplit(xAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointB,
relativedAxis);
if (xAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointC : grid.context.pointB,
relativedAxis2);
}
}
else
{
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointD,
relativedAxis);
if (xAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, xAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointC,
relativedAxis2);
}
}
}
}
private void DrawXAxisTick(VertexHelper vh, XAxis3D xAxis)
{
if (AxisHelper.NeedShowSplit(xAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(xAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(xAxis);
var relativedAxis = chart.GetChartComponent<YAxis3D>(xAxis.gridIndex);
Axis3DHelper.DrawAxisTick(vh, xAxis, chart.theme.axis, dataZoom,
xAxis.context.start,
xAxis.context.end,
-relativedAxis.context.dire);
}
}
private void DrawXAxisLine(VertexHelper vh, XAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.y;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fc1147481a423494d963df29b423f3a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -35,6 +35,11 @@ namespace XCharts.Runtime
var relativedAxis = chart.GetChartComponent<XAxis>(axis.gridIndex);
axis.context.x = AxisHelper.GetYAxisXOrY(grid, axis, relativedAxis);
axis.context.y = grid.context.y;
axis.context.start = new Vector3(axis.context.x, grid.context.y);
axis.context.end = new Vector3(axis.context.x, grid.context.y + grid.context.height);
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
axis.context.zeroX = axis.context.x;
axis.context.zeroY = axis.context.y + axis.context.offset;
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aa26616789b6b4903aae479a4c552b89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 y 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
[ComponentHandler(typeof(YAxis3DHander), true)]
public class YAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Value;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = false;
m_Position = AxisPosition.Left;
m_Data = new List<string>(5);
splitLine.show = true;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = false;
axisTick.showStartTick = true;
axisName.name = "Y";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a3cb4a6657aaf473bbae7162eb189cc0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,176 @@
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class YAxis3DHander : AxisHandler<YAxis3D>
{
protected override Orient orient { get { return Orient.Vertical; } }
public override void InitComponent()
{
InitYAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
UpdatePointerValue(component);
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawYAxisSplit(vh, component.index, component);
DrawYAxisLine(vh, component.index, component);
DrawYAxisTick(vh, component.index, component);
}
private void UpdatePosition(YAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (axis.position == Axis.AxisPosition.Right)
{
axis.context.start = grid.xyExchanged ? grid.context.pointB : grid.context.pointD;
axis.context.end = grid.context.pointC;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.xyExchanged ? grid.context.pointD : grid.context.pointB;
}
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitYAxis(YAxis3D yAxis)
{
var theme = chart.theme;
var yAxisIndex = yAxis.index;
yAxis.painter = chart.painter;
yAxis.refreshComponent = delegate ()
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid != null)
{
var xAxis = chart.GetChartComponent<YAxis3D>(yAxis.index);
InitAxis3D(xAxis, orient);
}
};
yAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(axis, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var xAxis = chart.GetChartComponent<XAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, xAxis, chart.theme.axis, scaleWid);
}
private void DrawYAxisSplit(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointD,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB, grid.context.pointC, relativedAxis2);
}
}
else
{
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointA,
grid.context.pointB,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<ZAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointC : grid.context.pointB,
relativedAxis2);
}
}
}
}
private void DrawYAxisTick(VertexHelper vh, int yAxisIndex, YAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisTick(vh, yAxis, chart.theme.axis, dataZoom,
yAxis.context.start,
yAxis.context.end,
-relativedAxis.context.dire);
}
}
private void DrawYAxisLine(VertexHelper vh, int axisIndex, YAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid == null)
return;
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.x;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 56b4be734c61645e1bf91c22a6e3da6c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 378448672ed084b0798c7ad343314693
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
namespace XCharts.Runtime
{
/// <summary>
/// The x axis in cartesian(rectangular) coordinate.
/// ||直角坐标系 grid 中的 y 轴。
/// </summary>
[Since("v3.11.0")]
[System.Serializable]
[RequireChartComponent(typeof(GridCoord3D), typeof(XAxis3D))]
[ComponentHandler(typeof(ZAxis3DHander), true)]
public class ZAxis3D : Axis
{
public override void SetDefaultValue()
{
m_Show = true;
m_Type = AxisType.Value;
m_Min = 0;
m_Max = 0;
m_SplitNumber = 0;
m_BoundaryGap = false;
m_Position = AxisPosition.Left;
m_Data = new List<string>(5);
splitLine.show = true;
splitLine.lineStyle.type = LineStyle.Type.None;
axisLabel.textLimit.enable = false;
axisTick.showStartTick = true;
axisName.name = "Z";
axisName.labelStyle.position = LabelStyle.Position.Middle;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 65aa8ae88610c431ebdab86935af2379
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,198 @@
using UnityEngine;
using UnityEngine.UI;
namespace XCharts.Runtime
{
[UnityEngine.Scripting.Preserve]
internal sealed class ZAxis3DHander : AxisHandler<ZAxis3D>
{
protected override Orient orient { get { return Orient.Vertical; } }
public override void InitComponent()
{
InitYAxis(component);
}
public override void Update()
{
UpdateAxisMinMaxValue(component.index, component);
UpdatePointerValue(component);
}
public override void DrawBase(VertexHelper vh)
{
UpdatePosition(component);
DrawZAxisSplit(vh, component.index, component);
DrawZAxisLine(vh, component.index, component);
DrawZAxisTick(vh, component.index, component);
}
private void UpdatePosition(ZAxis3D axis)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid != null)
{
if (grid.context.pointB.x < grid.context.pointA.x)
{
axis.context.start = grid.context.pointD;
axis.context.end = grid.context.pointH;
}
else if (axis.position == Axis.AxisPosition.Center)
{
axis.context.start = grid.context.pointB;
axis.context.end = grid.context.pointF;
}
else if (axis.position == Axis.AxisPosition.Right)
{
axis.context.start = grid.context.pointC;
axis.context.end = grid.context.pointG;
}
else
{
axis.context.start = grid.context.pointA;
axis.context.end = grid.context.pointE;
}
axis.context.x = axis.context.start.x;
axis.context.y = axis.context.start.y;
var vect = axis.context.end - axis.context.start;
axis.context.dire = vect.normalized;
axis.context.length = vect.magnitude;
}
}
private void InitYAxis(ZAxis3D yAxis)
{
var theme = chart.theme;
var yAxisIndex = yAxis.index;
yAxis.painter = chart.painter;
yAxis.refreshComponent = delegate ()
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid != null)
{
var relativedAxis = chart.GetChartComponent<ZAxis3D>(yAxis.index);
InitAxis3D(relativedAxis, orient);
}
};
yAxis.refreshComponent();
}
internal override void UpdateAxisLabelText(Axis axis)
{
base.UpdateAxisLabelText(axis);
if (axis.IsTime() || axis.IsValue())
{
for (int i = 0; i < axis.context.labelObjectList.Count; i++)
{
var label = axis.context.labelObjectList[i];
if (label != null)
{
var pos = GetLabelPosition(0, i);
label.SetPosition(pos);
CheckValueLabelActive(axis, i, label, pos);
}
}
}
}
protected override Vector3 GetLabelPosition(float scaleWid, int i)
{
var grid = chart.GetChartComponent<GridCoord3D>(component.gridIndex);
if (grid == null)
return Vector3.zero;
var yAxis = chart.GetChartComponent<XAxis3D>(component.index);
return Axis3DHelper.GetLabelPosition(i, component, yAxis,
chart.theme.axis,
scaleWid);
}
private void DrawZAxisSplit(VertexHelper vh, int yAxisIndex, ZAxis3D yAxis)
{
if (AxisHelper.NeedShowSplit(yAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(yAxis.gridIndex);
if (grid == null)
return;
var isLeft = grid.IsLeft();
if (grid.xyExchanged)
{
var relativedAxis = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointH : grid.context.pointE,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointF,
relativedAxis2);
}
}
else
{
var relativedAxis = chart.GetChartComponent<YAxis3D>(yAxis.gridIndex);
var dataZoom = chart.GetDataZoomOfAxis(yAxis);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
isLeft ? grid.context.pointD : grid.context.pointA,
isLeft ? grid.context.pointH : grid.context.pointE,
relativedAxis);
if (yAxis.splitLine.showZLine)
{
var relativedAxis2 = chart.GetChartComponent<XAxis3D>(yAxis.gridIndex);
Axis3DHelper.DrawAxisSplit(vh, yAxis, chart.theme.axis, dataZoom,
grid.context.pointB,
grid.context.pointF,
relativedAxis2);
}
}
}
}
private void DrawZAxisTick(VertexHelper vh, int yAxisIndex, ZAxis3D zAxis)
{
if (AxisHelper.NeedShowSplit(zAxis))
{
var grid = chart.GetChartComponent<GridCoord3D>(zAxis.gridIndex);
if (grid == null)
return;
var dataZoom = chart.GetDataZoomOfAxis(zAxis);
var relativedDire = grid.context.pointA - grid.context.pointB;
Axis3DHelper.DrawAxisTick(vh, zAxis, chart.theme.axis, dataZoom,
zAxis.context.start,
zAxis.context.end,
relativedDire.normalized);
}
}
private void DrawZAxisLine(VertexHelper vh, int axisIndex, ZAxis3D axis)
{
if (axis.show && axis.axisLine.show)
{
var grid = chart.GetChartComponent<GridCoord3D>(axis.gridIndex);
if (grid == null)
return;
var theme = chart.theme.axis;
var lineWidth = axis.axisLine.GetWidth(theme.lineWidth);
var lineType = axis.axisLine.GetType(theme.lineType);
var lineColor = axis.axisLine.GetColor(theme.lineColor);
var start = axis.context.start;
var end = axis.context.end;
ChartDrawer.DrawLineStyle(vh, lineType, lineWidth, start, end, lineColor);
}
}
internal override float GetAxisLineXOrY()
{
return component.context.x;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 67fb4be32885d4915979719c676aac5a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -386,8 +386,8 @@ namespace XCharts.Runtime
}
}
public float runtimeRangeMinHeight { get { return (float) ((rangeMin - min) / (max - min) * itemHeight); } }
public float runtimeRangeMaxHeight { get { return (float) ((rangeMax - min) / (max - min) * itemHeight); } }
public float runtimeRangeMinHeight { get { return (float)((rangeMin - min) / (max - min) * itemHeight); } }
public float runtimeRangeMaxHeight { get { return (float)((rangeMax - min) / (max - min) * itemHeight); } }
public void AddColors(List<Color32> colors)
{
@@ -413,6 +413,25 @@ namespace XCharts.Runtime
}
}
public Color32 GetColor(double xValue, double yValue, double zValue, byte alpha = 255)
{
Color32 color;
if (m_Dimension == 0)
{
color = GetColor(xValue);
}
else if (m_Dimension == 1)
{
color = GetColor(yValue);
}
else
{
color = GetColor(zValue);
}
color.a = alpha;
return color;
}
public Color32 GetColor(double value)
{
int index = GetIndex(value);
@@ -437,7 +456,7 @@ namespace XCharts.Runtime
if (index == splitNumber - 1)
return m_InRange[index].color;
else
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float) rate);
return Color32.Lerp(m_InRange[index].color, m_InRange[index + 1].color, (float)rate);
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14f9081aa22ba4bcb9cdbfbb95c7221e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using XUGL;
namespace XCharts.Runtime
{
/// <summary>
/// View control component in 3D coordinate system.
/// ||3D视角控制组件。
/// </summary>
[Since("v3.11.0")]
[Serializable]
public class ViewControl : ChildComponent
{
[SerializeField][Range(-90, 180)] private float m_Alpha = 90f;
[SerializeField][Range(-90, 90)] private float m_Beta = 55f;
/// <summary>
/// The angle of the view in the x-z plane.
/// ||视角在x-z平面的角度。
/// </summary>
public float alpha
{
get { return m_Alpha; }
set { if (PropertyUtil.SetStruct(ref m_Alpha, value)) SetVerticesDirty(); }
}
/// <summary>
/// The angle of the view in the y-z plane.
/// ||视角在y-z平面的角度。
/// </summary>
public float beta
{
get { return m_Beta; }
set { if (PropertyUtil.SetStruct(ref m_Beta, value)) SetVerticesDirty(); }
}
}
/// <summary>
/// Grid component.
/// ||Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart can be drawn in grid.
/// ||3D网格组件。
/// 3D直角坐标系内绘图网格。可以在网格上绘制3D折线图3D柱状图3D散点图。
/// </summary>
[Serializable]
[ComponentHandler(typeof(GridCoord3DHandler), true)]
public class GridCoord3D : CoordSystem, IUpdateRuntimeData, ISerieContainer
{
[SerializeField] private bool m_Show = true;
[SerializeField] private float m_Left = 0.15f;
[SerializeField] private float m_Right = 0.2f;
[SerializeField] private float m_Top = 0.3f;
[SerializeField] private float m_Bottom = 0.15f;
[SerializeField] private bool m_ShowBorder = false;
[SerializeField] private float m_BoxWidth = 0.55f;
[SerializeField] private float m_BoxHeight = 0.4f;
[SerializeField] private float m_BoxDepth = 0.2f;
[SerializeField] private bool m_XYExchanged = false;
[SerializeField] private ViewControl m_ViewControl = new ViewControl();
public GridCoord3DContext context = new GridCoord3DContext();
/// <summary>
/// Whether to show the grid in rectangular coordinate.
/// ||是否显示直角坐标系网格。
/// </summary>
public bool show
{
get { return m_Show; }
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
}
/// <summary>
/// Distance between grid component and the left side of the container.
/// ||grid 组件离容器左侧的距离。
/// </summary>
public float left
{
get { return m_Left; }
set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the right side of the container.
/// ||grid 组件离容器右侧的距离。
/// </summary>
public float right
{
get { return m_Right; }
set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the top side of the container.
/// ||grid 组件离容器上侧的距离。
/// </summary>
public float top
{
get { return m_Top; }
set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetAllDirty(); }
}
/// <summary>
/// Distance between grid component and the bottom side of the container.
/// ||grid 组件离容器下侧的距离。
/// </summary>
public float bottom
{
get { return m_Bottom; }
set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
}
/// <summary>
/// Whether to show the grid border.
/// ||是否显示网格边框。
/// </summary>
public bool showBorder
{
get { return m_ShowBorder; }
set { if (PropertyUtil.SetStruct(ref m_ShowBorder, value)) SetVerticesDirty(); }
}
/// <summary>
/// The width of the box in the coordinate system.
/// ||坐标系的宽度。
/// </summary>
public float boxWidth
{
get { return m_BoxWidth; }
set { if (PropertyUtil.SetStruct(ref m_BoxWidth, value)) SetVerticesDirty(); }
}
/// <summary>
/// The height of the box in the coordinate system.
/// ||坐标系的高度。
/// </summary>
public float boxHeight
{
get { return m_BoxHeight; }
set { if (PropertyUtil.SetStruct(ref m_BoxHeight, value)) SetVerticesDirty(); }
}
/// <summary>
/// The depth of the box in the coordinate system.
/// ||坐标系的深度。
/// </summary>
public float boxDepth
{
get { return m_BoxDepth; }
set { if (PropertyUtil.SetStruct(ref m_BoxDepth, value)) SetVerticesDirty(); }
}
/// <summary>
/// Whether to exchange the x and y axes.
/// ||是否交换x和y轴。
/// </summary>
public bool xyExchanged
{
get { return m_XYExchanged; }
set { if (PropertyUtil.SetStruct(ref m_XYExchanged, value)) SetVerticesDirty(); }
}
/// <summary>
/// View control component in 3D coordinate system.
/// ||3D视角控制组件。
/// </summary>
public ViewControl viewControl
{
get { return m_ViewControl; }
//set { if (PropertyUtil.SetClass(ref m_ViewControl, value)) SetVerticesDirty(); }
}
public void UpdateRuntimeData(BaseChart chart)
{
var chartX = chart.chartX;
var chartY = chart.chartY;
var chartWidth = chart.chartWidth;
var chartHeight = chart.chartHeight;
var actualLeft = left <= 1 ? left * chartWidth : left;
var actualBottom = bottom <= 1 ? bottom * chartHeight : bottom;
var actualBoxWidth = m_BoxWidth <= 1 ? m_BoxWidth * chartWidth : m_BoxWidth;
var actualBoxHeight = m_BoxHeight <= 1 ? m_BoxHeight * chartHeight : m_BoxHeight;
var actualBoxDepth = m_BoxDepth <= 1 ? m_BoxDepth * chartWidth : m_BoxDepth;
context.x = chartX + actualLeft;
context.y = chartY + actualBottom;
context.pointA.x = context.x;
context.pointA.y = context.y;
var angle = m_ViewControl.alpha * Mathf.Deg2Rad;
context.pointD.x = context.x + actualBoxWidth * Mathf.Sin(angle);
context.pointD.y = context.y - actualBoxWidth * Mathf.Cos(angle);
angle = (90 - m_ViewControl.beta) * Mathf.Deg2Rad;
context.pointB.x = context.x + actualBoxDepth * Mathf.Cos(angle);
context.pointB.y = context.y + actualBoxDepth * Mathf.Sin(angle);
context.pointC = context.pointB + (context.pointD - context.pointA);
context.pointE.x = context.pointA.x;
context.pointE.y = context.pointA.y + actualBoxHeight;
var diff = context.pointE - context.pointA;
context.pointF = context.pointB + diff;
context.pointG = context.pointC + diff;
context.pointH = context.pointD + diff;
var minX = Mathf.Min(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
var minY = Mathf.Min(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
var maxX = Mathf.Max(context.pointA.x, context.pointB.x, context.pointC.x, context.pointD.x, context.pointE.x, context.pointF.x, context.pointG.x, context.pointH.x);
var maxY = Mathf.Max(context.pointA.y, context.pointB.y, context.pointC.y, context.pointD.y, context.pointE.y, context.pointF.y, context.pointG.y, context.pointH.y);
context.maxRect.x = minX;
context.maxRect.y = minY;
context.maxRect.width = maxX - minX;
context.maxRect.height = maxY - minY;
}
/// <summary>
/// The opening of the coordinate system faces to the left.
/// 坐标系开口朝向左边。
/// </summary>
/// <returns></returns>
public bool IsLeft()
{
return context.pointB.x < context.pointA.x;
}
/// <summary>
/// Whether the pointer is in the grid.
/// ||指针是否在网格内。
/// </summary>
/// <returns></returns>
public bool IsPointerEnter()
{
return context.isPointerEnter;
}
/// <summary>
/// Whether the given position is in the grid.
/// ||给定的位置是否在网格内。
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public bool Contains(Vector3 pos)
{
if (!context.maxRect.Contains(pos)) return false;
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointB, context.pointC, context.pointD)) return true;
if (UGLHelper.IsPointInPolygon(pos, context.pointB, context.pointF, context.pointG, context.pointC)) return true;
if (IsLeft())
if (UGLHelper.IsPointInPolygon(pos, context.pointC, context.pointG, context.pointH, context.pointD)) return true;
else
if (UGLHelper.IsPointInPolygon(pos, context.pointA, context.pointE, context.pointF, context.pointB)) return true;
return false;
}
/// <summary>
/// Clamp the position of pos to the grid.
/// ||将位置限制在网格内。
/// </summary>
/// <param name="pos"></param>
public void Clamp(ref Vector3 pos)
{
//TODO:
}
/// <summary>
/// Determines whether a given line segment will not intersect the Grid boundary at all.
/// ||判断给定的线段是否与Grid边界是否完全不会相交。
/// </summary>
/// <param name="sp"></param>
/// <param name="ep"></param>
/// <returns></returns>
public bool NotAnyIntersect(Vector3 sp, Vector3 ep)
{
//TODO:
return false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 95f8c8c3492e54987af59175d94f8761
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using System.Collections.Generic;
using UnityEngine;
namespace XCharts.Runtime
{
public class GridCoord3DContext : MainComponentContext
{
public float x;
public float y;
public Rect maxRect = new Rect(0, 0, 0, 0);
public bool isPointerEnter;
public List<ChartLabel> endLabelList = new List<ChartLabel>();
//public Vector3 position = Vector3.zero;
public Vector3 pointA = Vector3.zero;
public Vector3 pointB = Vector3.zero;
public Vector3 pointC = Vector3.zero;
public Vector3 pointD = Vector3.zero;
public Vector3 pointE = Vector3.zero;
public Vector3 pointF = Vector3.zero;
public Vector3 pointG = Vector3.zero;
public Vector3 pointH = Vector3.zero;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a4a0f1dda078b4877bfabe3c16815498
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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<GridCoord3D>
{
public override void InitComponent()
{
var grid = component;
grid.painter = chart.painter;
grid.refreshComponent = delegate()
{
grid.UpdateRuntimeData(chart);
chart.OnCoordinateChanged();
};
grid.refreshComponent();
}
public override void CheckComponent(StringBuilder sb)
{
var grid = component;
if (grid.left >= chart.chartWidth)
sb.Append("warning:grid->left > chartWidth\n");
if (grid.right >= chart.chartWidth)
sb.Append("warning:grid->right > chartWidth\n");
if (grid.top >= chart.chartHeight)
sb.Append("warning:grid->top > chartHeight\n");
if (grid.bottom >= chart.chartHeight)
sb.Append("warning:grid->bottom > chartHeight\n");
if (grid.left + grid.right >= chart.chartWidth)
sb.Append("warning:grid.left + grid.right > chartWidth\n");
if (grid.top + grid.bottom >= chart.chartHeight)
sb.Append("warning:grid.top + grid.bottom > chartHeight\n");
}
public override void Update()
{
if (chart.isPointerInChart)
{
component.context.isPointerEnter = component.Contains(chart.pointerPos);
}
else
{
component.context.isPointerEnter = false;
}
}
public override void 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);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 92481e92b90724f46b3a7e8c585e12e7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);

View File

@@ -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<Vector3> points = new List<Vector3>();
public float width;
public float distance;
public bool highlight;
public bool expand = true;

View File

@@ -3,7 +3,7 @@ using UnityEngine;
namespace XCharts.Runtime
{
internal static class DataHelper
public static class DataHelper
{
public static double DataAverage(ref List<SerieData> showData, SampleType sampleType,
int minCount, int maxCount, int rate)

View File

@@ -16,7 +16,6 @@ namespace XCharts.Runtime
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
{
var serie = chart.AddSerie<Candlestick>(serieName);
var defaultDataCount = 5;
var lastValue = 50d;
for (int i = 0; i < 5; i++)
{

View File

@@ -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);

View File

@@ -5,17 +5,16 @@ using XUGL;
namespace XCharts.Runtime
{
internal static class LineHelper
public static class LineHelper
{
private static List<Vector3> s_CurvesPosList = new List<Vector3>();
public static int GetDataAverageRate(Serie serie, GridCoord grid, int maxCount, bool isYAxis)
public static int GetDataAverageRate(Serie serie, float axisLength, int maxCount, bool isYAxis)
{
var sampleDist = serie.sampleDist;
var rate = 0;
var width = isYAxis ? grid.context.height : grid.context.width;
if (sampleDist > 0)
rate = (int)((maxCount - serie.minShow) / (width / sampleDist));
rate = (int)((maxCount - serie.minShow) / (axisLength / sampleDist));
if (rate < 1)
rate = 1;
return rate;

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -311,7 +311,7 @@ namespace XCharts.Runtime
public static void GetXMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
{
GetMinMaxValue(chart, axisIndex, inverse, false, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
GetMinMaxValue(chart, axisIndex, inverse, 0, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
}
/// <summary>
@@ -324,13 +324,26 @@ namespace XCharts.Runtime
public static void GetYMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
{
GetMinMaxValue(chart, axisIndex, inverse, true, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
GetMinMaxValue(chart, axisIndex, inverse, 1, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
}
/// <summary>
/// 获得维度Z的最大最小值
/// </summary>
/// <param name="dataZoom"></param>
/// <param name="axisIndex"></param>
/// <param name="minValue"></param>
/// <param name="maxValue"></param>
public static void GetZMinMaxValue(BaseChart chart, int axisIndex, bool inverse, out double minValue,
out double maxValue, bool isPolar = false, bool filterByDataZoom = true, bool needAnimation = false)
{
GetMinMaxValue(chart, axisIndex, inverse, 2, out minValue, out maxValue, isPolar, filterByDataZoom, needAnimation);
}
private static Dictionary<int, List<Serie>> _stackSeriesForMinMax = new Dictionary<int, List<Serie>>();
private static Dictionary<int, double> _serieTotalValueForMinMax = new Dictionary<int, double>();
public static void GetMinMaxValue(BaseChart chart, int axisIndex,
bool inverse, bool yValue, out double minValue, out double maxValue, bool isPolar = false,
bool inverse, int dimension, out double minValue, out double maxValue, bool isPolar = false,
bool filterByDataZoom = true, bool needAnimation = false)
{
double min = double.MaxValue;
@@ -371,8 +384,8 @@ namespace XCharts.Runtime
var performanceMode = serie.IsPerformanceMode();
foreach (var data in showData)
{
var currData = performanceMode ? data.GetData(yValue ? 1 : 0, inverse) :
data.GetCurrData(yValue ? 1 : 0, dataAddDuration, updateDuration, unscaledTime, inverse);
var currData = performanceMode ? data.GetData(dimension, inverse) :
data.GetCurrData(dimension, dataAddDuration, updateDuration, unscaledTime, inverse);
if (!serie.IsIgnoreValue(data, currData))
{
if (currData > max) max = currData;
@@ -419,7 +432,7 @@ namespace XCharts.Runtime
}
else
{
currData = showData[j].GetCurrData(yValue ? 1 : 0, dataAddDuration, updateDuration, unscaledTime, inverse);
currData = showData[j].GetCurrData(dimension, dataAddDuration, updateDuration, unscaledTime, inverse);
}
if (!serie.IsIgnoreValue(showData[j], currData))
_serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + currData;

View File

@@ -310,7 +310,7 @@ namespace XUGL
/// <param name="nbp">下一个点的下角点</param>
/// <param name="itp">交汇点的上角点</param>
/// <param name="ibp">交汇点的下角点</param>
internal static void GetLinePoints(Vector3 lp, Vector3 cp, Vector3 np, float width,
public static void GetLinePoints(Vector3 lp, Vector3 cp, Vector3 np, float width,
ref Vector3 ltp, ref Vector3 lbp,
ref Vector3 ntp, ref Vector3 nbp,
ref Vector3 itp, ref Vector3 ibp,
@@ -397,6 +397,23 @@ namespace XUGL
}
return inside;
}
public static bool IsPointInPolygon(Vector3 p, params Vector3[] polyons)
{
if (polyons.Length == 0) return false;
var inside = false;
var j = polyons.Length - 1;
for (int i = 0; i < polyons.Length; j = i++)
{
var pi = polyons[i];
var pj = polyons[j];
if (((pi.y <= p.y && p.y < pj.y) || (pj.y <= p.y && p.y < pi.y)) &&
(p.x < (pj.x - pi.x) * (p.y - pi.y) / (pj.y - pi.y) + pi.x))
inside = !inside;
}
return inside;
}
public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)
{
if (polyons.Count == 0) return false;