mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
增加GridLayout网格布局组件
This commit is contained in:
@@ -34,6 +34,7 @@ slug: /api
|
||||
- [DefineSymbolsUtil](#definesymbolsutil)
|
||||
- [FormatterHelper](#formatterhelper)
|
||||
- [GridCoordContext](#gridcoordcontext)
|
||||
- [GridLayoutContext](#gridlayoutcontext)
|
||||
- [HeatmapChart](#heatmapchart)
|
||||
- [IgnoreDoc](#ignoredoc)
|
||||
- [INeedSerieContainer](#ineedseriecontainer)
|
||||
@@ -500,7 +501,7 @@ slug: /api
|
||||
|GetTextHeight()||public float GetTextHeight()|
|
||||
|GetTextWidth()||public float GetTextWidth()|
|
||||
|GetWidth()||public float GetWidth()|
|
||||
|IsActive()||public override bool IsActive()|
|
||||
|IsActiveByScale()||public bool IsActiveByScale()|
|
||||
|SetActive()||public void SetActive(bool flag)|
|
||||
|SetIcon()||public void SetIcon(Image image)|
|
||||
|SetIconActive()||public void SetIconActive(bool flag)|
|
||||
@@ -516,7 +517,7 @@ slug: /api
|
||||
|SetTextColor()||public void SetTextColor(Color color)|
|
||||
|SetTextPadding()||public void SetTextPadding(TextPadding padding)|
|
||||
|SetTextRotate()||public void SetTextRotate(float rotate)|
|
||||
|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)|
|
||||
|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null, Color color = default(Color))|
|
||||
|
||||
## ChartObject
|
||||
|
||||
@@ -633,6 +634,10 @@ slug: /api
|
||||
|
||||
> XCharts.Runtime.GridCoordContext : [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## GridLayoutContext
|
||||
|
||||
> XCharts.Runtime.GridLayoutContext : [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## HeatmapChart
|
||||
|
||||
> XCharts.Runtime.HeatmapChart : [BaseChart](#basechart)
|
||||
@@ -668,9 +673,8 @@ slug: /api
|
||||
|SetColor()||public void SetColor(ref bool needInteract, Color32 color)|
|
||||
|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)|
|
||||
|SetPosition()||public void SetPosition(ref bool needInteract, Vector3 pos)|
|
||||
|SetValue()||public void SetValue(float value)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value, bool highlight, float rate = 1.3f)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value, bool previousValueZero = false)|
|
||||
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)|
|
||||
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)|
|
||||
|ToString()||public override string ToString()|
|
||||
@@ -707,7 +711,7 @@ The interface for serie data component.
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord)
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[ParallelCoord](#parallelcoord)
|
||||
|
||||
## LayerHelper
|
||||
|
||||
@@ -790,7 +794,7 @@ The interface for serie data component.
|
||||
|
||||
## MainComponentContext
|
||||
|
||||
> XCharts.Runtime.MainComponentContext / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
> XCharts.Runtime.MainComponentContext / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
|
||||
## MainComponentHandler
|
||||
|
||||
@@ -1149,11 +1153,11 @@ the data of serie event.
|
||||
|GetSerieState()||public static SerieState GetSerieState(SerieData serieData)|
|
||||
|GetSerieSymbol()||public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)|
|
||||
|GetStateStyle()||public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)|
|
||||
|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, float defaultSize, SerieState state = SerieState.Auto)|
|
||||
|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, float defaultSize, SerieState state = SerieState.Auto, bool checkAnimation = false)|
|
||||
|GetTitleStyle()||public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)|
|
||||
|IsAllZeroValue()||public static bool IsAllZeroValue(Serie serie, int dimension = 1)<br/>Whether the data for the specified dimension of serie are all 0. |
|
||||
|IsDownPoint()||public static bool IsDownPoint(Serie serie, int index)|
|
||||
|UpdateCenter()||public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)<br/>更新运行时中心点和半径 |
|
||||
|UpdateCenter()||public static void UpdateCenter(Serie serie, BaseChart chart)<br/>更新运行时中心点和半径 |
|
||||
|UpdateFilterData()||public static void UpdateFilterData(Serie serie, DataZoom dataZoom)<br/>根据dataZoom更新数据列表缓存 |
|
||||
|UpdateMinMaxData()||public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)<br/>获得指定维数的最大最小值 |
|
||||
|UpdateRect()||public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)|
|
||||
@@ -1165,12 +1169,9 @@ the data of serie event.
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|AvoidLabelOverlap()||public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)|
|
||||
|CanShowLabel()||public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)|
|
||||
|GetLabelColor()||public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)|
|
||||
|GetRealLabelPosition()||public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)|
|
||||
|SetGaugeLabelText()||public static void SetGaugeLabelText(Serie serie)|
|
||||
|UpdatePieLabelPosition()||public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)|
|
||||
|
||||
## SerieLabelPool
|
||||
|
||||
@@ -1306,6 +1307,10 @@ UGUI Graphics Library.
|
||||
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) |
|
||||
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, Color32 color, Color32 toColor)|
|
||||
|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)|
|
||||
|DrawEmptyDiamond()||public static void DrawEmptyDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, float tickness, Color32 color)|
|
||||
|DrawEmptyDiamond()||public static void DrawEmptyDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, float tickness, Color32 color, Color32 emptyColor)|
|
||||
|DrawEmptyTriangle()||public static void DrawEmptyTriangle(VertexHelper vh, Vector3 pos, float size, float tickness, Color32 color)|
|
||||
|DrawEmptyTriangle()||public static void DrawEmptyTriangle(VertexHelper vh, Vector3 pos, float size, float tickness, Color32 color, Color32 backgroundColor)|
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)|
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 |
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 |
|
||||
|
||||
@@ -56,6 +56,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataZoom](#datazoom)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [Legend](#legend)
|
||||
- [MarkArea](#markarea)
|
||||
- [MarkLine](#markline)
|
||||
@@ -952,6 +953,7 @@ Grid component.
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||Whether to show the grid in rectangular coordinate.
|
||||
|layoutIndex|-1|v3.8.0|
|
||||
|left|0.1f||Distance between grid component and the left side of the container.
|
||||
|right|0.08f||Distance between grid component and the right side of the container.
|
||||
|top|0.22f||Distance between grid component and the top side of the container.
|
||||
@@ -965,6 +967,34 @@ Grid component.
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridLayout
|
||||
|
||||
> XCharts.Runtime.GridLayout : [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
|
||||
> Since `v3.8.0`
|
||||
|
||||
Grid layout component. Used to manage the layout of multiple `GridCoord`, and the number of rows and columns of the grid can be controlled by `row` and `column`.
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="GridLayout">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||Whether to show the grid in rectangular coordinate.
|
||||
|left|0.1f||Distance between grid component and the left side of the container.
|
||||
|right|0.08f||Distance between grid component and the right side of the container.
|
||||
|top|0.22f||Distance between grid component and the top side of the container.
|
||||
|bottom|0.12f||Distance between grid component and the bottom side of the container.
|
||||
|row|2||the row count of grid layout.
|
||||
|column|2||the column count of grid layout.
|
||||
|spacing|Vector2.zero||the spacing of grid layout.
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## Heatmap
|
||||
|
||||
> XCharts.Runtime.Heatmap : [Serie](#serie), [INeedSerieContainer](#ineedseriecontainer)
|
||||
@@ -1142,7 +1172,7 @@ The interface for serie data component.
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord)
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [ParallelCoord](#parallelcoord)
|
||||
|
||||
## LabelLine
|
||||
|
||||
@@ -1160,7 +1190,7 @@ The interface for serie data component.
|
||||
|show|true||Whether the label line is showed.
|
||||
|lineType|||the type of visual guide line.<br/>`LabelLine.LineType`:<br/>- `BrokenLine`: 折线<br/>- `Curves`: 曲线<br/>- `HorizontalLine`: 水平线<br/>|
|
||||
|lineColor|Color32(0,0,0,0)||the color of visual guild line.
|
||||
|lineAngle|60||the angle of visual guild line.
|
||||
|lineAngle|60||the angle of visual guild line. Valid for broken line and curve line. Invalid in Pie.
|
||||
|lineWidth|1.0f||the width of visual guild line.
|
||||
|lineGap|1.0f||the gap of container and guild line.
|
||||
|lineLength1|25f||The length of the first segment of visual guide line.
|
||||
@@ -1385,7 +1415,7 @@ Location type. Quick to set the general location.
|
||||
|
||||
## MainComponent
|
||||
|
||||
> XCharts.Runtime.MainComponent : [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / Subclasses: [Axis](#axis), [Background](#background), [Comment](#comment), [DataZoom](#datazoom), [Legend](#legend), [MarkArea](#markarea), [MarkLine](#markline), [Settings](#settings), [Title](#title), [Tooltip](#tooltip), [VisualMap](#visualmap), [CoordSystem](#coordsystem)
|
||||
> XCharts.Runtime.MainComponent : [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / Subclasses: [Axis](#axis), [Background](#background), [Comment](#comment), [DataZoom](#datazoom), [Legend](#legend), [MarkArea](#markarea), [MarkLine](#markline), [Settings](#settings), [Title](#title), [Tooltip](#tooltip), [VisualMap](#visualmap), [GridLayout](#gridlayout), [CoordSystem](#coordsystem)
|
||||
|
||||
## MarkArea
|
||||
|
||||
@@ -1704,6 +1734,7 @@ Configurations of select state.
|
||||
|polarIndex|0||Index of polar component that serie uses.
|
||||
|singleAxisIndex|0||Index of single axis component that serie uses.
|
||||
|parallelIndex|0||Index of parallel coord component that serie uses.
|
||||
|gridIndex|-1|v3.8.0|Index of layout component that serie uses.
|
||||
|minShow|||The min number of data to show in chart.
|
||||
|maxShow|||The max number of data to show in chart.
|
||||
|maxCache|||The max number of serie data cache. The first data will be remove when the size of serie data is larger then maxCache.
|
||||
|
||||
@@ -34,6 +34,7 @@ slug: /api
|
||||
- [DefineSymbolsUtil](#definesymbolsutil)
|
||||
- [FormatterHelper](#formatterhelper)
|
||||
- [GridCoordContext](#gridcoordcontext)
|
||||
- [GridLayoutContext](#gridlayoutcontext)
|
||||
- [HeatmapChart](#heatmapchart)
|
||||
- [IgnoreDoc](#ignoredoc)
|
||||
- [INeedSerieContainer](#ineedseriecontainer)
|
||||
@@ -500,7 +501,7 @@ slug: /api
|
||||
|GetTextHeight()||public float GetTextHeight()|
|
||||
|GetTextWidth()||public float GetTextWidth()|
|
||||
|GetWidth()||public float GetWidth()|
|
||||
|IsActive()||public override bool IsActive()|
|
||||
|IsActiveByScale()||public bool IsActiveByScale()|
|
||||
|SetActive()||public void SetActive(bool flag)|
|
||||
|SetIcon()||public void SetIcon(Image image)|
|
||||
|SetIconActive()||public void SetIconActive(bool flag)|
|
||||
@@ -516,7 +517,7 @@ slug: /api
|
||||
|SetTextColor()||public void SetTextColor(Color color)|
|
||||
|SetTextPadding()||public void SetTextPadding(TextPadding padding)|
|
||||
|SetTextRotate()||public void SetTextRotate(float rotate)|
|
||||
|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)|
|
||||
|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null, Color color = default(Color))|
|
||||
|
||||
## ChartObject
|
||||
|
||||
@@ -633,6 +634,10 @@ slug: /api
|
||||
|
||||
> XCharts.Runtime.GridCoordContext : [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## GridLayoutContext
|
||||
|
||||
> XCharts.Runtime.GridLayoutContext : [MainComponentContext](#maincomponentcontext)
|
||||
|
||||
## HeatmapChart
|
||||
|
||||
> XCharts.Runtime.HeatmapChart : [BaseChart](#basechart)
|
||||
@@ -668,9 +673,8 @@ slug: /api
|
||||
|SetColor()||public void SetColor(ref bool needInteract, Color32 color)|
|
||||
|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)|
|
||||
|SetPosition()||public void SetPosition(ref bool needInteract, Vector3 pos)|
|
||||
|SetValue()||public void SetValue(float value)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value, bool highlight, float rate = 1.3f)|
|
||||
|SetValue()||public void SetValue(ref bool needInteract, float value, bool previousValueZero = false)|
|
||||
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)|
|
||||
|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)|
|
||||
|ToString()||public override string ToString()|
|
||||
@@ -707,7 +711,7 @@ slug: /api
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[ParallelCoord](#parallelcoord)
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis),[DataZoom](#datazoom),[CalendarCoord](#calendarcoord),[GridCoord](#gridcoord),[GridLayout](#gridlayout),[ParallelCoord](#parallelcoord)
|
||||
|
||||
## LayerHelper
|
||||
|
||||
@@ -790,7 +794,7 @@ slug: /api
|
||||
|
||||
## MainComponentContext
|
||||
|
||||
> XCharts.Runtime.MainComponentContext / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
> XCharts.Runtime.MainComponentContext / Subclasses: [AxisContext](#axiscontext),[DataZoomContext](#datazoomcontext),[LegendContext](#legendcontext),[RadarCoordContext](#radarcoordcontext),[VisualMapContext](#visualmapcontext),[GridCoordContext](#gridcoordcontext),[GridLayoutContext](#gridlayoutcontext),[ParallelCoordContext](#parallelcoordcontext),[PolarCoordContext](#polarcoordcontext)
|
||||
|
||||
## MainComponentHandler
|
||||
|
||||
@@ -1149,11 +1153,11 @@ serie事件的数据。
|
||||
|GetSerieState()||public static SerieState GetSerieState(SerieData serieData)|
|
||||
|GetSerieSymbol()||public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)|
|
||||
|GetStateStyle()||public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)|
|
||||
|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, float defaultSize, SerieState state = SerieState.Auto)|
|
||||
|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, float defaultSize, SerieState state = SerieState.Auto, bool checkAnimation = false)|
|
||||
|GetTitleStyle()||public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)|
|
||||
|IsAllZeroValue()||public static bool IsAllZeroValue(Serie serie, int dimension = 1)<br/>系列指定维数的数据是否全部为0。 |
|
||||
|IsDownPoint()||public static bool IsDownPoint(Serie serie, int index)|
|
||||
|UpdateCenter()||public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)<br/>更新运行时中心点和半径 |
|
||||
|UpdateCenter()||public static void UpdateCenter(Serie serie, BaseChart chart)<br/>更新运行时中心点和半径 |
|
||||
|UpdateFilterData()||public static void UpdateFilterData(Serie serie, DataZoom dataZoom)<br/>根据dataZoom更新数据列表缓存 |
|
||||
|UpdateMinMaxData()||public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)<br/>获得指定维数的最大最小值 |
|
||||
|UpdateRect()||public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)|
|
||||
@@ -1165,12 +1169,9 @@ serie事件的数据。
|
||||
|
||||
|public method|since|description|
|
||||
|--|--|--|
|
||||
|AvoidLabelOverlap()||public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)|
|
||||
|CanShowLabel()||public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)|
|
||||
|GetLabelColor()||public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)|
|
||||
|GetRealLabelPosition()||public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)|
|
||||
|SetGaugeLabelText()||public static void SetGaugeLabelText(Serie serie)|
|
||||
|UpdatePieLabelPosition()||public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)|
|
||||
|
||||
## SerieLabelPool
|
||||
|
||||
@@ -1306,6 +1307,10 @@ UGUI 图形库
|
||||
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) |
|
||||
|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, Color32 color, Color32 toColor)|
|
||||
|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)|
|
||||
|DrawEmptyDiamond()||public static void DrawEmptyDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, float tickness, Color32 color)|
|
||||
|DrawEmptyDiamond()||public static void DrawEmptyDiamond(VertexHelper vh, Vector3 center, float xRadius, float yRadius, float tickness, Color32 color, Color32 emptyColor)|
|
||||
|DrawEmptyTriangle()||public static void DrawEmptyTriangle(VertexHelper vh, Vector3 pos, float size, float tickness, Color32 color)|
|
||||
|DrawEmptyTriangle()||public static void DrawEmptyTriangle(VertexHelper vh, Vector3 pos, float size, float tickness, Color32 color, Color32 backgroundColor)|
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)|
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 |
|
||||
|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 |
|
||||
|
||||
@@ -78,6 +78,7 @@ slug: /changelog
|
||||
|
||||
日志详情:
|
||||
|
||||
* (2023.08.29) 增加`GridLayout`网格布局组件用于管理多个`GridCoord`的布局
|
||||
* (2023.08.25) 修复`MarkLine`多个时只显示一个`Label`的问题
|
||||
* (2023.08.25) 修复`MarkLine`在开启`Clip`后还绘制在坐标系外的问题
|
||||
* (2023.08.24) 优化`YAxis`在数据全为0时默认设置0-1的范围
|
||||
|
||||
@@ -56,6 +56,7 @@ import APITable from '@site/src/components/APITable';
|
||||
- [CoordSystem](#coordsystem)
|
||||
- [DataZoom](#datazoom)
|
||||
- [GridCoord](#gridcoord)
|
||||
- [GridLayout](#gridlayout)
|
||||
- [Legend](#legend)
|
||||
- [MarkArea](#markarea)
|
||||
- [MarkLine](#markline)
|
||||
@@ -952,6 +953,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||是否显示直角坐标系网格。
|
||||
|layoutIndex|-1|v3.8.0|
|
||||
|left|0.1f||grid 组件离容器左侧的距离。
|
||||
|right|0.08f||grid 组件离容器右侧的距离。
|
||||
|top|0.22f||grid 组件离容器上侧的距离。
|
||||
@@ -965,6 +967,34 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## GridLayout
|
||||
|
||||
> XCharts.Runtime.GridLayout : [MainComponent](#maincomponent), [IUpdateRuntimeData](#iupdateruntimedata)
|
||||
|
||||
> 从 `v3.8.0` 开始支持
|
||||
|
||||
网格布局组件。用于管理多个`GridCoord`的布局,可以通过`row`和`column`来控制网格的行列数。
|
||||
|
||||
```mdx-code-block
|
||||
<APITable name="GridLayout">
|
||||
```
|
||||
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|show|true||是否显示直角坐标系网格。
|
||||
|left|0.1f||grid 组件离容器左侧的距离。
|
||||
|right|0.08f||grid 组件离容器右侧的距离。
|
||||
|top|0.22f||grid 组件离容器上侧的距离。
|
||||
|bottom|0.12f||grid 组件离容器下侧的距离。
|
||||
|row|2||网格布局的行数。
|
||||
|column|2||网格布局的列数。
|
||||
|spacing|Vector2.zero||网格布局的间距。
|
||||
|
||||
```mdx-code-block
|
||||
</APITable>
|
||||
```
|
||||
|
||||
## Heatmap
|
||||
|
||||
> XCharts.Runtime.Heatmap : [Serie](#serie), [INeedSerieContainer](#ineedseriecontainer)
|
||||
@@ -1142,7 +1172,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## IUpdateRuntimeData
|
||||
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [ParallelCoord](#parallelcoord)
|
||||
> XCharts.Runtime.IUpdateRuntimeData / Subclasses: [SingleAxis](#singleaxis), [DataZoom](#datazoom), [CalendarCoord](#calendarcoord), [GridCoord](#gridcoord), [GridLayout](#gridlayout), [ParallelCoord](#parallelcoord)
|
||||
|
||||
## LabelLine
|
||||
|
||||
@@ -1160,7 +1190,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|show|true||是否显示视觉引导线。
|
||||
|lineType|||视觉引导线类型。<br/>`LabelLine.LineType`:<br/>- `BrokenLine`: 折线<br/>- `Curves`: 曲线<br/>- `HorizontalLine`: 水平线<br/>|
|
||||
|lineColor|Color32(0,0,0,0)||视觉引导线颜色。默认和serie一致取自调色板。
|
||||
|lineAngle|60||视觉引导线的固定角度。对折线和曲线有效。
|
||||
|lineAngle|60||视觉引导线的固定角度。对折线和曲线有效。在Pie中无效。
|
||||
|lineWidth|1.0f||视觉引导线的宽度。
|
||||
|lineGap|1.0f||视觉引导线和容器的间距。
|
||||
|lineLength1|25f||视觉引导线第一段的长度。
|
||||
@@ -1385,7 +1415,7 @@ Drawing grid in rectangular coordinate. Line chart, bar chart, and scatter chart
|
||||
|
||||
## MainComponent
|
||||
|
||||
> XCharts.Runtime.MainComponent : [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / Subclasses: [Axis](#axis), [Background](#background), [Comment](#comment), [DataZoom](#datazoom), [Legend](#legend), [MarkArea](#markarea), [MarkLine](#markline), [Settings](#settings), [Title](#title), [Tooltip](#tooltip), [VisualMap](#visualmap), [CoordSystem](#coordsystem)
|
||||
> XCharts.Runtime.MainComponent : [IComparable](https://docs.unity3d.com/ScriptReference/30_search.html?q=IComparable) / Subclasses: [Axis](#axis), [Background](#background), [Comment](#comment), [DataZoom](#datazoom), [Legend](#legend), [MarkArea](#markarea), [MarkLine](#markline), [Settings](#settings), [Title](#title), [Tooltip](#tooltip), [VisualMap](#visualmap), [GridLayout](#gridlayout), [CoordSystem](#coordsystem)
|
||||
|
||||
## MarkArea
|
||||
|
||||
@@ -1704,6 +1734,7 @@ Radar coordinate conponnet for radar charts. 雷达图坐标系组件,只适
|
||||
|polarIndex|0||所使用的 polar 组件的 index。
|
||||
|singleAxisIndex|0||所使用的 singleAxis 组件的 index。
|
||||
|parallelIndex|0||所使用的 parallel coord 组件的 index。
|
||||
|gridIndex|-1|v3.8.0|所使用的 layout 组件的 index。 默认为-1不指定index, 当为大于或等于0时, 为第一个layout组件的第index个格子。
|
||||
|minShow|||系列所显示数据的最小索引
|
||||
|maxShow|||系列所显示数据的最大索引
|
||||
|maxCache|||系列中可缓存的最大数据量。默认为0没有限制,大于0时超过指定值会移除旧数据再插入新数据。
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace XCharts.Editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_LayoutIndex");
|
||||
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
|
||||
22
Editor/MainComponents/GridCoordLayoutEditor.cs
Normal file
22
Editor/MainComponents/GridCoordLayoutEditor.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEditor;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[ComponentEditor(typeof(GridLayout))]
|
||||
public class GridLayoutEditor : MainComponentEditor<GridLayout>
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField("m_Left");
|
||||
PropertyField("m_Right");
|
||||
PropertyField("m_Top");
|
||||
PropertyField("m_Bottom");
|
||||
PropertyField("m_Row");
|
||||
PropertyField("m_Column");
|
||||
PropertyField("m_Spacing");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/MainComponents/GridCoordLayoutEditor.cs.meta
Normal file
11
Editor/MainComponents/GridCoordLayoutEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97c3db8110ca44c3bb088f8af9c56aa6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,6 +7,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override void OnCustomInspectorGUI()
|
||||
{
|
||||
PropertyField("m_GridIndex");
|
||||
PropertyField("m_RoseType");
|
||||
PropertyField("m_Gap");
|
||||
PropertyTwoFiled("m_Center");
|
||||
|
||||
@@ -83,8 +83,12 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
context.left = left <= 1 ? left * chartWidth : left;
|
||||
context.bottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
context.top = top <= 1 ? top * chartHeight : top;
|
||||
|
||||
@@ -33,10 +33,7 @@ namespace XCharts.Runtime
|
||||
axis.painter = chart.painter;
|
||||
axis.refreshComponent = delegate()
|
||||
{
|
||||
axis.UpdateRuntimeData(chart.chartX,
|
||||
chart.chartY,
|
||||
chart.chartWidth,
|
||||
chart.chartHeight);
|
||||
axis.UpdateRuntimeData(chart);
|
||||
|
||||
InitAxis(null,
|
||||
axis.orient,
|
||||
|
||||
@@ -662,8 +662,12 @@ namespace XCharts.Runtime
|
||||
if (m_EndLabel != null) m_EndLabel.SetPosition(pos);
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
var runtimeLeft = left <= 1 ? left * chartWidth : left;
|
||||
var runtimeBottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
var runtimeTop = top <= 1 ? top * chartHeight : top;
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace XCharts.Runtime
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
{ }
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ namespace XCharts.Runtime
|
||||
public class GridCoord : CoordSystem, IUpdateRuntimeData, ISerieContainer
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField][Since("v3.8.0")] private int m_LayoutIndex = -1;
|
||||
[SerializeField] private float m_Left = 0.1f;
|
||||
[SerializeField] private float m_Right = 0.08f;
|
||||
[SerializeField] private float m_Top = 0.22f;
|
||||
@@ -36,6 +37,11 @@ namespace XCharts.Runtime
|
||||
get { return m_Show; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetVerticesDirty(); }
|
||||
}
|
||||
public int layoutIndex
|
||||
{
|
||||
get { return m_LayoutIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_LayoutIndex, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Distance between grid component and the left side of the container.
|
||||
/// |grid 组件离容器左侧的距离。
|
||||
@@ -114,8 +120,22 @@ namespace XCharts.Runtime
|
||||
return context.isPointerEnter;
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
if (layoutIndex >= 0)
|
||||
{
|
||||
var layout = chart.GetChartComponent<GridLayout>(layoutIndex);
|
||||
if (layout != null)
|
||||
{
|
||||
layout.UpdateRuntimeData(chart);
|
||||
layout.UpdateGridContext(index, ref context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
context.left = left <= 1 ? left * chartWidth : left;
|
||||
context.bottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
context.top = top <= 1 ? top * chartHeight : top;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
@@ -15,7 +14,7 @@ namespace XCharts.Runtime
|
||||
grid.painter = chart.painter;
|
||||
grid.refreshComponent = delegate()
|
||||
{
|
||||
grid.UpdateRuntimeData(chart.chartX, chart.chartY, chart.chartWidth, chart.chartHeight);
|
||||
grid.UpdateRuntimeData(chart);
|
||||
chart.OnCoordinateChanged();
|
||||
};
|
||||
grid.refreshComponent();
|
||||
|
||||
130
Runtime/Coord/Grid/GridLayout.cs
Normal file
130
Runtime/Coord/Grid/GridLayout.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Grid layout component. Used to manage the layout of multiple `GridCoord`, and the number of rows and columns of the grid can be controlled by `row` and `column`.
|
||||
/// |网格布局组件。用于管理多个`GridCoord`的布局,可以通过`row`和`column`来控制网格的行列数。
|
||||
/// </summary>
|
||||
[Since("v3.8.0")]
|
||||
[Serializable]
|
||||
[ComponentHandler(typeof(GridLayoutHandler), true)]
|
||||
public class GridLayout : MainComponent, IUpdateRuntimeData
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private float m_Left = 0.1f;
|
||||
[SerializeField] private float m_Right = 0.08f;
|
||||
[SerializeField] private float m_Top = 0.22f;
|
||||
[SerializeField] private float m_Bottom = 0.12f;
|
||||
[SerializeField] private int m_Row = 2;
|
||||
[SerializeField] private int m_Column = 2;
|
||||
[SerializeField] private Vector2 m_Spacing = Vector2.zero;
|
||||
|
||||
public GridLayoutContext context = new GridLayoutContext();
|
||||
|
||||
/// <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>
|
||||
/// the row count of grid layout.
|
||||
/// |网格布局的行数。
|
||||
/// </summary>
|
||||
public int row
|
||||
{
|
||||
get { return m_Row; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Row, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the column count of grid layout.
|
||||
/// |网格布局的列数。
|
||||
/// </summary>
|
||||
public int column
|
||||
{
|
||||
get { return m_Column; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Column, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the spacing of grid layout.
|
||||
/// |网格布局的间距。
|
||||
/// </summary>
|
||||
public Vector2 spacing
|
||||
{
|
||||
get { return m_Spacing; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Spacing, value)) SetAllDirty(); }
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
context.left = left <= 1 ? left * chartWidth : left;
|
||||
context.bottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
context.top = top <= 1 ? top * chartHeight : top;
|
||||
context.right = right <= 1 ? right * chartWidth : right;
|
||||
context.x = chartX + context.left;
|
||||
context.y = chartY + context.bottom;
|
||||
context.width = chartWidth - context.left - context.right;
|
||||
context.height = chartHeight - context.top - context.bottom;
|
||||
context.eachWidth = (context.width - spacing.x * (column - 1)) / column;
|
||||
context.eachHeight = (context.height - spacing.y * (row - 1)) / row;
|
||||
}
|
||||
|
||||
internal void UpdateGridContext(int index, ref GridCoordContext gridContext)
|
||||
{
|
||||
var row = index / m_Column;
|
||||
var column = index % m_Column;
|
||||
|
||||
gridContext.x = context.x + column * (context.eachWidth + spacing.x);
|
||||
gridContext.y = context.y + row * (context.eachHeight + spacing.y);
|
||||
gridContext.width = context.eachWidth;
|
||||
gridContext.height = context.eachHeight;
|
||||
gridContext.position = new Vector3(gridContext.x, gridContext.y);
|
||||
gridContext.center = new Vector3(gridContext.x + gridContext.width / 2, gridContext.y + gridContext.height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid/GridLayout.cs.meta
Normal file
11
Runtime/Coord/Grid/GridLayout.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9abc8e277fa0f41c1a0b13133bb736c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Runtime/Coord/Grid/GridLayoutContext.cs
Normal file
16
Runtime/Coord/Grid/GridLayoutContext.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
public class GridLayoutContext : MainComponentContext
|
||||
{
|
||||
public float x;
|
||||
public float y;
|
||||
public float width;
|
||||
public float height;
|
||||
public float left;
|
||||
public float right;
|
||||
public float bottom;
|
||||
public float top;
|
||||
public float eachWidth;
|
||||
public float eachHeight;
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid/GridLayoutContext.cs.meta
Normal file
11
Runtime/Coord/Grid/GridLayoutContext.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7265c042ebd33458eb12c112d46d9a60
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Runtime/Coord/Grid/GridLayoutHandler.cs
Normal file
7
Runtime/Coord/Grid/GridLayoutHandler.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
internal sealed class GridLayoutHandler : MainComponentHandler<GridLayout>
|
||||
{
|
||||
}
|
||||
}
|
||||
11
Runtime/Coord/Grid/GridLayoutHandler.cs.meta
Normal file
11
Runtime/Coord/Grid/GridLayoutHandler.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b1c1f0fa475b484286b0b2c688dc3c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -92,8 +92,12 @@ namespace XCharts.Runtime
|
||||
return context.runtimeIsPointerEnter;
|
||||
}
|
||||
|
||||
public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight)
|
||||
public void UpdateRuntimeData(BaseChart chart)
|
||||
{
|
||||
var chartX = chart.chartX;
|
||||
var chartY = chart.chartY;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
context.left = left <= 1 ? left * chartWidth : left;
|
||||
context.bottom = bottom <= 1 ? bottom * chartHeight : bottom;
|
||||
context.top = top <= 1 ? top * chartHeight : top;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace XCharts.Runtime
|
||||
grid.painter = chart.painter;
|
||||
grid.refreshComponent = delegate()
|
||||
{
|
||||
grid.UpdateRuntimeData(chart.chartX, chart.chartY, chart.chartWidth, chart.chartHeight);
|
||||
grid.UpdateRuntimeData(chart);
|
||||
chart.OnCoordinateChanged();
|
||||
};
|
||||
grid.refreshComponent();
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
component.SetDefaultValue();
|
||||
if (component is IUpdateRuntimeData)
|
||||
(component as IUpdateRuntimeData).UpdateRuntimeData(chartX, chartY, chartWidth, chartHeight);
|
||||
(component as IUpdateRuntimeData).UpdateRuntimeData(this);
|
||||
AddComponent(component);
|
||||
m_Components.Sort();
|
||||
CreateComponentHandler(component);
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField][ListForComponent(typeof(Background))] private List<Background> m_Backgrounds = new List<Background>();
|
||||
[SerializeField][ListForComponent(typeof(DataZoom))] private List<DataZoom> m_DataZooms = new List<DataZoom>();
|
||||
[SerializeField][ListForComponent(typeof(GridCoord))] private List<GridCoord> m_Grids = new List<GridCoord>();
|
||||
[SerializeField][ListForComponent(typeof(GridLayout))] private List<GridLayout> m_GridsLayout = new List<GridLayout>();
|
||||
|
||||
[SerializeField][ListForComponent(typeof(Legend))] private List<Legend> m_Legends = new List<Legend>();
|
||||
[SerializeField][ListForComponent(typeof(MarkLine))] private List<MarkLine> m_MarkLines = new List<MarkLine>();
|
||||
[SerializeField][ListForComponent(typeof(MarkArea))] private List<MarkArea> m_MarkAreas = new List<MarkArea>();
|
||||
@@ -460,7 +462,7 @@ namespace XCharts.Runtime
|
||||
if (component is Axis)
|
||||
component.SetAllDirty();
|
||||
if (component is IUpdateRuntimeData)
|
||||
(component as IUpdateRuntimeData).UpdateRuntimeData(m_ChartX, m_ChartY, m_ChartWidth, m_ChartHeight);
|
||||
(component as IUpdateRuntimeData).UpdateRuntimeData(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public interface IUpdateRuntimeData
|
||||
{
|
||||
void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight);
|
||||
void UpdateRuntimeData(BaseChart chart);
|
||||
}
|
||||
}
|
||||
@@ -189,8 +189,7 @@ namespace XCharts.Runtime
|
||||
serie.context.dataMax = serie.yMax;
|
||||
serie.context.startAngle = GetStartAngle(serie);
|
||||
var runtimePieDataTotal = serie.yTotal;
|
||||
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
SerieHelper.UpdateCenter(serie, chart);
|
||||
float startDegree = serie.context.startAngle;
|
||||
float totalDegree = 0;
|
||||
float zeroReplaceValue = 0;
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace XCharts.Runtime
|
||||
private void UpdateRuntimeData()
|
||||
{
|
||||
var data = serie.data;
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
SerieHelper.UpdateCenter(serie, chart);
|
||||
var ringWidth = serie.context.outsideRadius - serie.context.insideRadius;
|
||||
for (int j = 0; j < data.Count; j++)
|
||||
{
|
||||
|
||||
@@ -246,6 +246,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private int m_PolarIndex = 0;
|
||||
[SerializeField] private int m_SingleAxisIndex = 0;
|
||||
[SerializeField] private int m_ParallelIndex = 0;
|
||||
[SerializeField][Since("v3.8.0")] private int m_GridIndex = -1;
|
||||
[SerializeField] protected int m_MinShow;
|
||||
[SerializeField] protected int m_MaxShow;
|
||||
[SerializeField] protected int m_MaxCache;
|
||||
@@ -477,6 +478,15 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_ParallelIndex, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Index of layout component that serie uses.
|
||||
/// |所使用的 layout 组件的 index。 默认为-1不指定index, 当为大于或等于0时, 为第一个layout组件的第index个格子。
|
||||
/// </summary>
|
||||
public int gridIndex
|
||||
{
|
||||
get { return m_GridIndex; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_GridIndex, value)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The min number of data to show in chart.
|
||||
/// |系列所显示数据的最小索引
|
||||
/// </summary>
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace XCharts.Runtime
|
||||
m_SerieLabelRoot.hideFlags = chart.chartHideFlags;
|
||||
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||
int count = 0;
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
SerieHelper.UpdateCenter(serie, chart);
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
{
|
||||
var serieData = serie.data[j];
|
||||
@@ -402,7 +402,7 @@ namespace XCharts.Runtime
|
||||
SerieLabelPool.ReleaseAll(serieTitleRoot.transform);
|
||||
ChartHelper.RemoveComponent<Text>(serieTitleRoot);
|
||||
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
SerieHelper.UpdateCenter(serie, chart);
|
||||
|
||||
if (serie.titleJustForSerie)
|
||||
{
|
||||
|
||||
@@ -213,9 +213,22 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
/// <param name="chartWidth"></param>
|
||||
/// <param name="chartHeight"></param>
|
||||
public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)
|
||||
public static void UpdateCenter(Serie serie, BaseChart chart)
|
||||
{
|
||||
if (serie.center.Length < 2) return;
|
||||
var chartPosition = chart.chartPosition;
|
||||
var chartWidth = chart.chartWidth;
|
||||
var chartHeight = chart.chartHeight;
|
||||
if (serie.gridIndex >= 0)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(serie.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
chartPosition = grid.context.position;
|
||||
chartWidth = grid.context.width;
|
||||
chartHeight = grid.context.height;
|
||||
}
|
||||
}
|
||||
var centerX = serie.center[0] <= 1 ? chartWidth * serie.center[0] : serie.center[0];
|
||||
var centerY = serie.center[1] <= 1 ? chartHeight * serie.center[1] : serie.center[1];
|
||||
serie.context.center = chartPosition + new Vector3(centerX, centerY);
|
||||
@@ -820,7 +833,7 @@ namespace XCharts.Runtime
|
||||
serie.m_FilterMinShow = dataZoom.minShowNum;
|
||||
serie.m_NeedUpdateFilterData = false;
|
||||
|
||||
if(ReferenceEquals(serie.m_FilterData,data))
|
||||
if (ReferenceEquals(serie.m_FilterData, data))
|
||||
{
|
||||
serie.m_FilterData = new List<SerieData>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user