mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-18 22:40:10 +00:00
Merge branch 'master' into 3.0
This commit is contained in:
58
CHANGELOG.md
58
CHANGELOG.md
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.2.0](#v3.2.0)
|
||||
[v3.1.0](#v3.1.0)
|
||||
[v3.0.1](#v3.0.1)
|
||||
[v3.0.0](#v3.0.0)
|
||||
@@ -57,7 +58,60 @@
|
||||
|
||||
## master
|
||||
|
||||
## 3.1.0
|
||||
## v3.2.0
|
||||
|
||||
### 版本要点
|
||||
|
||||
* `Serie`支持高亮,淡出和选中三状态配置:`EmphasisStyle`,`BlurStyle`和`SelectStyle`
|
||||
* `Axis`支持坐标轴次刻度和次分割线:`MinorTick`和`MinorSplitLine`
|
||||
* `Serie`支持不同的取色策略:`colorBy`
|
||||
* `Radar`支持平滑曲线:`smooth`
|
||||
* `Line`支持当作凸多边形填充:`AreaStyle`的`innerFill`
|
||||
* `DataZoom`支持时间轴
|
||||
* 其他优化和修复
|
||||
|
||||
### 日志详情
|
||||
|
||||
* (2022.08.16) 发布`v3.2.0`版本
|
||||
* (2022.08.15) 优化`Smooth`贝塞尔曲线算法
|
||||
* (2022.08.13) 修复`DataZoom`组件开启时图表显示效果可能不正确的问题
|
||||
* (2022.08.11) 优化`Tooltip`支持`ignoreDataDefaultContent`
|
||||
* (2022.08.10) 修复`Chart`在3D相机下部分组件显示异常的问题
|
||||
* (2022.08.10) 修复`RemoveSerie()`接口不生效的问题 (#219)
|
||||
* (2022.08.10) 优化`Theme`的字体同步操作
|
||||
* (2022.08.10) 优化`Chart`的默认`layer`设置为`UI`
|
||||
* (2022.08.09) 优化`Axis`的`Time`时间轴的次分割线
|
||||
* (2022.08.09) 增加`AreaStyle`的`innerFill`参数支持填充凸多边形
|
||||
* (2022.08.08) 优化`Serie`的数据项索引维护,增加检测和修复功能,修复相关问题
|
||||
* (2022.07.29) 修复`Unity`版本兼容:在某些版本导入后图表创建异常的问题
|
||||
* (2022.07.29) 增加`Axis`为`Time`时间轴时,支持次刻度和次分割线
|
||||
* (2022.07.28) 优化`Radar`雷达图效果
|
||||
* (2022.07.28) 增加`Serie`的`colorBy`参数配置取色策略
|
||||
* (2022.07.27) 增加`StateStyle`的`Symbol`用于配置状态下的标记样式
|
||||
* (2022.07.27) 去掉`SerieSymbol`的`selectedSize`参数
|
||||
* (2022.07.24) 增加`Serie`和`SerieData`的`state`设置默认状态
|
||||
* (2022.07.22) 增加`Serie`的三种状态`EmphasisStyle`,`BlurStyle`,`SelectStyle`
|
||||
* (2022.07.22) 去掉`AreaStyle`的`highlightColor`和`highlightToColor`参数
|
||||
* (2022.07.22) 去掉`Emphasis`,`EmphasisItemStyle`,`EmphasisLabelStyle`,`EmphasisLabelLine`组件
|
||||
* (2022.07.20) 增加`Since`特性对类的支持
|
||||
* (2022.07.20) 修复`Axis`在`Value`轴时,`AxisLabel`的`showStartLabel`和`showEndLabel`参数设置不生效的问题
|
||||
* (2022.07.19) 增加`Axis`的`MinorSplitLine`设置坐标轴次分割线
|
||||
* (2022.07.19) 增加`Axis`的`MinorTick`设置坐标轴次刻度
|
||||
* (2022.07.17) 增加`Radar`的`smooth`参数设置平滑曲线
|
||||
* (2022.07.15) 增加`DataZoom`对`Time`时间轴的支持
|
||||
|
||||
## v3.1.0
|
||||
|
||||
### 版本要点
|
||||
|
||||
* 优化`Axis`
|
||||
* 优化`Tooltip`
|
||||
* 优化平滑曲线算法
|
||||
* 优化代码动态创建图表
|
||||
* 完善配置项手册
|
||||
* 修复若干问题
|
||||
|
||||
### 日志详情
|
||||
|
||||
* (2022.07.12) 发布`v3.1.0`版本
|
||||
* (2022.07.12) 修复`Serie`的`ignoreLineBreak`不生效的问题
|
||||
@@ -77,7 +131,7 @@
|
||||
* (2022.06.25) 修复`DataZoom`开启时`Tooltip`显示数据不一致的问题 (#203)
|
||||
* (2022.06.25) 修复`Toolip`在类目轴无数据时绘制异常的问题 (#204)
|
||||
* (2022.06.25) 优化`Serie`设置`PlaceHolder`时的`Tooltip`表现
|
||||
* (2022.06.25) 增加`Since`标识配置参数从哪个版本开始支持
|
||||
* (2022.06.25) 增加`Since`特效用于标识配置参数从哪个版本开始支持
|
||||
* (2022.06.24) 优化`Painter`绘制层,`Top`层细分为`Upper`和`Top`层
|
||||
* (2022.06.24) 增加`Legend`对`Background`和`Padding`的支持
|
||||
* (2022.06.21) 增加`TextStyle`对`TextMeshPro`的`Sprite Asset`支持 (#201)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# 更新日志
|
||||
|
||||
[master](#master)
|
||||
[v3.2.0](#v3.2.0)
|
||||
[v3.1.0](#v3.1.0)
|
||||
[v3.0.1](#v3.0.1)
|
||||
[v3.0.0](#v3.0.0)
|
||||
@@ -57,7 +58,49 @@
|
||||
|
||||
## master
|
||||
|
||||
## 3.1.0
|
||||
## v3.2.0
|
||||
|
||||
### Main points
|
||||
|
||||
* `Serie` supports highlighting, EmphasisStyle, EmphasisStyle, BlurStyle, and SelectStyle
|
||||
* `Axis` supports sub-scale and sub-partition of coordinate axes:`MinorTick` and `MinorSplitLine`
|
||||
* `Serie` supports different color selection strategies: `colorBy`
|
||||
* `Radar` supports smooth curves: `smooth`
|
||||
* `Line` supports filling as a convex polygon: `AreaStyle` `innerFill`
|
||||
* `DataZoom` supports timeline
|
||||
* Other optimizations and issue fixes
|
||||
|
||||
### Log details
|
||||
|
||||
* (2022.08.16) Release `v3.2.0` version
|
||||
* (2022.08.15) optimized `Smooth` Bezier curve algorithm
|
||||
* (2022.08.13) Fixed an issue where the `DataZoom` component might not display correctly when opened
|
||||
* (2022.08.11) Optimized Tooltip supports `ignoreDataDefaultContent`
|
||||
* (2022.08.10) fixed abnormal display of some components of `Chart` under 3D camera
|
||||
* (2022.08.10) Fix `RemoveSerie()` interface not working (#219)
|
||||
* (2022.08.10) Optimized font synchronization for Theme
|
||||
* (2022.08.10) optimizes the default `layer` of Chart to `UI`
|
||||
* (2022.08.09) optimizes the `Time` timeline of `Axis`
|
||||
* (2022.08.09) added AreaStyle `innerFill` parameter to support filling convex polygons
|
||||
* (2022.08.08) Optimized the maintenance of data item indexes in `Serie`, added detection and repair functions, and fixed related problems
|
||||
* (2022.07.29) Fixed `Unity` version compatibility: Chart creation exception after some versions import
|
||||
* (2022.07.29) Add `Axis` to` Time `timeline, support sub-scale and sub-divider
|
||||
* (2022.07.28) optimizes the `Radar` image
|
||||
* (2022.07.28) increase `Serie` `colorBy` parameter configuration color taking strategy
|
||||
* (2022.07.27) Adds StateStyle `Symbol` to configure the Symbol style in the state
|
||||
* (2022.07.27) remove selectedSize from SerieSymbol
|
||||
* (2022.07.24) adds default state Settings for `Serie` and `SerieData`
|
||||
* (2022.07.22) add three states` EmphasisStyle `, `EmphasisStyle`, `SelectStyle` of `Serie`
|
||||
* (2022.07.22) remove `highlightColor` and `highlightToColor` arguments from `AreaStyle`
|
||||
* (2022.07.22) Omit the `Emphasis`,` EmphasisItemStyle `, `EmphasisLabelStyle`, `EmphasisLabelLine` component
|
||||
* (2022.07.20) Added `Since` feature support for classes
|
||||
* (2022.07.20) fixed the `showStartLabel` and `showEndLabel` parameter Settings for `AxisLabel` not taking effect when `Axis` is on the` Value `Axis
|
||||
* (2022.07.19) added `Axis` to` MinorSplitLine `to set the Axis degree divider
|
||||
* (2022.07.19) added `Axis` `MinorTick` to set the Axis sub-scale
|
||||
* (2022.07.17) Add the `smooth` parameter for Radar to set the smooth curve
|
||||
* (2022.07.15) added DataZoom support for the `Time` timeline
|
||||
|
||||
## v3.1.0
|
||||
|
||||
* (2022.07.12) Release `v3.1.0` version
|
||||
* (2022.07.12) Fixed `Serie` `ignoreLineBreak` not working
|
||||
|
||||
@@ -130,11 +130,14 @@ Inherits or Implemented: [MainComponentHandler](#MainComponentHandler)
|
||||
| `GetAxisValueDistance()` |public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上相对起点的距离 |
|
||||
| `GetAxisValueLength()` |public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上对应的长度 |
|
||||
| `GetAxisValuePosition()` |public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上的坐标位置 |
|
||||
| `GetAxisXOrY()` |public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)</br> |
|
||||
| `GetDataWidth()` |public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)</br>获得一个类目数据在坐标系中代表的宽度 |
|
||||
| `GetEachWidth()` |public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)</br> |
|
||||
| `GetScaleNumber()` |public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)</br>获得分割线条数 |
|
||||
| `GetScaleWidth()` |public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)</br>获得分割段宽度 |
|
||||
| `GetSplitNumber()` |public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)</br>获得分割段数 |
|
||||
| `GetXAxisXOrY()` |public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)</br> |
|
||||
| `GetYAxisXOrY()` |public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)</br> |
|
||||
| `NeedShowSplit()` |public static bool NeedShowSplit(Axis axis)</br> |
|
||||
|
||||
## `BarChart`
|
||||
@@ -173,7 +176,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `CanMultipleComponent()` |public bool CanMultipleComponent(Type type)</br> |
|
||||
| `ClampInChart()` |public void ClampInChart(ref Vector3 pos)</br> |
|
||||
| `ClampInGrid()` |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)</br> |
|
||||
| `ClearData()` |public virtual void ClearData()</br>Remove all series and legend data. |
|
||||
| `ClearData()` |public virtual void ClearData()</br>Clear all components and series data. Note: serie only empties the data and does not remove serie. |
|
||||
| `ClickLegendButton()` |public void ClickLegendButton(int legendIndex, string legendName, bool show)</br>点击图例按钮 |
|
||||
| `CovertSerie()` |public bool CovertSerie(Serie serie, Type type)</br> |
|
||||
| `CovertXYAxis()` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
|
||||
@@ -187,8 +190,9 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `GetDataZoomOfSerie()` |public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)</br> |
|
||||
| `GetGrid()` |public GridCoord GetGrid(Vector2 local)</br> |
|
||||
| `GetGridOfDataZoom()` |public GridCoord GetGridOfDataZoom(DataZoom dataZoom)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, bool highlight = false)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)</br> |
|
||||
| `GetLegendRealShowNameColor()` |public Color32 GetLegendRealShowNameColor(string name)</br> |
|
||||
| `GetLegendRealShowNameIndex()` |public int GetLegendRealShowNameIndex(string name)</br> |
|
||||
| `GetPainter()` |public Painter GetPainter(int index)</br> |
|
||||
@@ -240,17 +244,19 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
|
||||
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
|
||||
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
|
||||
| `RemoveAllSerie()` |public virtual void RemoveAllSerie()</br>Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases. |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
|
||||
| `RemoveChartComponent<T>()` |public bool RemoveChartComponent<T>(int index = 0)</br> |
|
||||
| `RemoveChartComponents()` |public int RemoveChartComponents(Type type)</br> |
|
||||
| `RemoveChartComponents<T>()` |public int RemoveChartComponents<T>()</br> |
|
||||
| `RemoveData()` |public virtual void RemoveData()</br>Remove all data from series and legend. |
|
||||
| `RemoveData()` |public virtual void RemoveData()</br>Empty all component data and remove all series. Use the chart again and again to tell the truth. Note: The component only clears the data part, and the parameters are retained and not reset. |
|
||||
| `RemoveData()` |public virtual void RemoveData(string serieName)</br>Remove legend and serie by name. |
|
||||
| `RemoveSerie()` |public void RemoveSerie(int serieIndex)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(string serieName)</br> |
|
||||
| `ReplaceSerie()` |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `ResetDataIndex()` |public bool ResetDataIndex(int serieIndex)</br>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
| `SetBasePainterMaterial()` |public void SetBasePainterMaterial(Material material)</br>设置Base Painter的材质球 |
|
||||
| `SetMaxCache()` |public void SetMaxCache(int maxCache)</br>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
| `SetPainterActive()` |public void SetPainterActive(int index, bool flag)</br> |
|
||||
@@ -337,6 +343,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `DestroyAllChildren()` |public static void DestroyAllChildren(Transform parent)</br> |
|
||||
| `GetActualValue()` |public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)</br> |
|
||||
| `GetAngle360()` |public static float GetAngle360(Vector2 from, Vector2 to)</br>获得0-360的角度(12点钟方向为0度) |
|
||||
| `GetBlurColor()` |public static Color32 GetBlurColor(Color32 color, float a = 0.3f)</br> |
|
||||
| `GetColor()` |public static Color32 GetColor(string hexColorStr)</br> |
|
||||
| `GetDire()` |public static Vector3 GetDire(float angle, bool isDegree = false)</br> |
|
||||
| `GetFloatAccuracy()` |public static int GetFloatAccuracy(double value)</br> |
|
||||
@@ -350,6 +357,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `GetPointList()` |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)</br> |
|
||||
| `GetPos()` |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)</br> |
|
||||
| `GetPosition()` |public static Vector3 GetPosition(Vector3 center, float angle, float radius)</br> |
|
||||
| `GetSelectColor()` |public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)</br> |
|
||||
| `GetVertialDire()` |public static Vector3 GetVertialDire(Vector3 dire)</br> |
|
||||
| `HideAllObject()` |public static void HideAllObject(GameObject obj, string match = null)</br> |
|
||||
| `HideAllObject()` |public static void HideAllObject(Transform parent, string match = null)</br> |
|
||||
@@ -825,18 +833,15 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|--|--|
|
||||
| `CopySerie()` |public static void CopySerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAreaColor()` |public static Color32 GetAreaColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAreaStyle()` |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetAreaToColor()` |public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAverageData()` |public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetItemColor()` |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)</br> |
|
||||
| `GetItemColor0()` |public static Color32 GetItemColor0(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, Color32 defaultColor)</br> |
|
||||
| `GetBlurStyle()` |public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetEmphasisStyle()` |public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemColor()` |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)</br> |
|
||||
| `GetItemFormatter()` |public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)</br> |
|
||||
| `GetItemMarker()` |public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)</br> |
|
||||
| `GetItemStyle()` |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetItemStyleEmphasis()` |public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemToColor()` |public static Color32 GetItemToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetItemStyle()` |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetLineStyle()` |public static LineStyle GetLineStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetMaxData()` |public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetMaxSerieData()` |public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
@@ -845,14 +850,15 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetMinMaxData()` |public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)</br>Gets the maximum and minimum values of all data in the serie. |
|
||||
| `GetMinSerieData()` |public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetNumericFormatter()` |public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)</br> |
|
||||
| `GetSerieEmphasisLabel()` |public static LabelStyle GetSerieEmphasisLabel(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSerieLabel()` |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetSerieLabelLine()` |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetSerieSymbol()` |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)</br> |
|
||||
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, float defaultWidth)</br> |
|
||||
| `GetSymbolBorderColor()` |public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)</br> |
|
||||
| `GetSymbolCornerRadius()` |public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)</br> |
|
||||
| `GetSelectStyle()` |public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSerieLabel()` |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetSerieLabelLine()` |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(Serie serie)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(SerieData serieData)</br> |
|
||||
| `GetSerieSymbol()` |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetStateStyle()` |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)</br> |
|
||||
| `GetSysmbolSize()` |public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetTitleStyle()` |public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `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)</br> |
|
||||
@@ -981,6 +987,7 @@ Inherits or Implemented: [MaskableGraphic](#MaskableGraphic)
|
||||
| `DrawLine()` |public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)</br> |
|
||||
| `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. 画直线 |
|
||||
| `DrawPolygon()` |public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)</br>填充任意多边形(目前只支持凸多边形) |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)</br> |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)</br> |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)</br> |
|
||||
|
||||
@@ -130,11 +130,14 @@ Inherits or Implemented: [MainComponentHandler](#MainComponentHandler)
|
||||
| `GetAxisValueDistance()` |public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上相对起点的距离 |
|
||||
| `GetAxisValueLength()` |public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上对应的长度 |
|
||||
| `GetAxisValuePosition()` |public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)</br>获得数值value在坐标轴上的坐标位置 |
|
||||
| `GetAxisXOrY()` |public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)</br> |
|
||||
| `GetDataWidth()` |public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)</br>获得一个类目数据在坐标系中代表的宽度 |
|
||||
| `GetEachWidth()` |public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)</br> |
|
||||
| `GetScaleNumber()` |public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)</br>获得分割线条数 |
|
||||
| `GetScaleWidth()` |public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)</br>获得分割段宽度 |
|
||||
| `GetSplitNumber()` |public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)</br>获得分割段数 |
|
||||
| `GetXAxisXOrY()` |public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)</br> |
|
||||
| `GetYAxisXOrY()` |public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)</br> |
|
||||
| `NeedShowSplit()` |public static bool NeedShowSplit(Axis axis)</br> |
|
||||
|
||||
## `BarChart`
|
||||
@@ -173,7 +176,7 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `CanMultipleComponent()` |public bool CanMultipleComponent(Type type)</br> |
|
||||
| `ClampInChart()` |public void ClampInChart(ref Vector3 pos)</br> |
|
||||
| `ClampInGrid()` |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)</br> |
|
||||
| `ClearData()` |public virtual void ClearData()</br>It just emptying all of serie's data without emptying the list of series. |
|
||||
| `ClearData()` |public virtual void ClearData()</br>清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。 |
|
||||
| `ClickLegendButton()` |public void ClickLegendButton(int legendIndex, string legendName, bool show)</br>点击图例按钮 |
|
||||
| `CovertSerie()` |public bool CovertSerie(Serie serie, Type type)</br> |
|
||||
| `CovertXYAxis()` |public void CovertXYAxis(int index)</br>转换X轴和Y轴的配置 |
|
||||
@@ -187,8 +190,9 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `GetDataZoomOfSerie()` |public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)</br> |
|
||||
| `GetGrid()` |public GridCoord GetGrid(Vector2 local)</br> |
|
||||
| `GetGridOfDataZoom()` |public GridCoord GetGridOfDataZoom(DataZoom dataZoom)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, bool highlight = false)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemColor()` |public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)</br> |
|
||||
| `GetLegendRealShowNameColor()` |public Color32 GetLegendRealShowNameColor(string name)</br> |
|
||||
| `GetLegendRealShowNameIndex()` |public int GetLegendRealShowNameIndex(string name)</br> |
|
||||
| `GetPainter()` |public Painter GetPainter(int index)</br> |
|
||||
@@ -240,17 +244,19 @@ Inherits or Implemented: [BaseGraph](#BaseGraph),[ISerializationCallbackReceiver
|
||||
| `RefreshTopPainter()` |public void RefreshTopPainter()</br> |
|
||||
| `RefreshUpperPainter()` |public void RefreshUpperPainter()</br> |
|
||||
| `RemoveAllChartComponent()` |public void RemoveAllChartComponent()</br> |
|
||||
| `RemoveAllSerie()` |public virtual void RemoveAllSerie()</br>移除所有的Serie。当确认只需要移除Serie时使用该接口,其他情况下一般用RemoveData()。 |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(MainComponent component)</br> |
|
||||
| `RemoveChartComponent()` |public bool RemoveChartComponent(Type type, int index = 0)</br> |
|
||||
| `RemoveChartComponent<T>()` |public bool RemoveChartComponent<T>(int index = 0)</br> |
|
||||
| `RemoveChartComponents()` |public int RemoveChartComponents(Type type)</br> |
|
||||
| `RemoveChartComponents<T>()` |public int RemoveChartComponents<T>()</br> |
|
||||
| `RemoveData()` |public virtual void RemoveData()</br>The series list is also cleared. |
|
||||
| `RemoveData()` |public virtual void RemoveData()</br>清空所有组件数据,并移除所有Serie。一般在图表重新初始化时使用。 注意:组件只清空数据部分,参数会保留不会被重置。 |
|
||||
| `RemoveData()` |public virtual void RemoveData(string serieName)</br>清除指定系列名称的数据。 |
|
||||
| `RemoveSerie()` |public void RemoveSerie(int serieIndex)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(Serie serie)</br> |
|
||||
| `RemoveSerie()` |public void RemoveSerie(string serieName)</br> |
|
||||
| `ReplaceSerie()` |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `ResetDataIndex()` |public bool ResetDataIndex(int serieIndex)</br>重置serie的数据项索引。避免数据项索引异常。 |
|
||||
| `SetBasePainterMaterial()` |public void SetBasePainterMaterial(Material material)</br>设置Base Painter的材质球 |
|
||||
| `SetMaxCache()` |public void SetMaxCache(int maxCache)</br>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 |
|
||||
| `SetPainterActive()` |public void SetPainterActive(int index, bool flag)</br> |
|
||||
@@ -337,6 +343,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `DestroyAllChildren()` |public static void DestroyAllChildren(Transform parent)</br> |
|
||||
| `GetActualValue()` |public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)</br> |
|
||||
| `GetAngle360()` |public static float GetAngle360(Vector2 from, Vector2 to)</br>获得0-360的角度(12点钟方向为0度) |
|
||||
| `GetBlurColor()` |public static Color32 GetBlurColor(Color32 color, float a = 0.3f)</br> |
|
||||
| `GetColor()` |public static Color32 GetColor(string hexColorStr)</br> |
|
||||
| `GetDire()` |public static Vector3 GetDire(float angle, bool isDegree = false)</br> |
|
||||
| `GetFloatAccuracy()` |public static int GetFloatAccuracy(double value)</br> |
|
||||
@@ -350,6 +357,7 @@ Inherits or Implemented: [BaseChart](#BaseChart)
|
||||
| `GetPointList()` |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)</br> |
|
||||
| `GetPos()` |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)</br> |
|
||||
| `GetPosition()` |public static Vector3 GetPosition(Vector3 center, float angle, float radius)</br> |
|
||||
| `GetSelectColor()` |public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)</br> |
|
||||
| `GetVertialDire()` |public static Vector3 GetVertialDire(Vector3 dire)</br> |
|
||||
| `HideAllObject()` |public static void HideAllObject(GameObject obj, string match = null)</br> |
|
||||
| `HideAllObject()` |public static void HideAllObject(Transform parent, string match = null)</br> |
|
||||
@@ -825,18 +833,15 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
|--|--|
|
||||
| `CopySerie()` |public static void CopySerie(Serie oldSerie, Serie newSerie)</br> |
|
||||
| `GetAllMinMaxData()` |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)</br> |
|
||||
| `GetAreaColor()` |public static Color32 GetAreaColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAreaStyle()` |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetAreaToColor()` |public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetAverageData()` |public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetItemColor()` |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)</br> |
|
||||
| `GetItemColor0()` |public static Color32 GetItemColor0(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, Color32 defaultColor)</br> |
|
||||
| `GetBlurStyle()` |public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetEmphasisStyle()` |public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemColor()` |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)</br> |
|
||||
| `GetItemFormatter()` |public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)</br> |
|
||||
| `GetItemMarker()` |public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)</br> |
|
||||
| `GetItemStyle()` |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetItemStyleEmphasis()` |public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)</br> |
|
||||
| `GetItemToColor()` |public static Color32 GetItemToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)</br> |
|
||||
| `GetItemStyle()` |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetLineColor()` |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetLineStyle()` |public static LineStyle GetLineStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetMaxData()` |public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetMaxSerieData()` |public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
@@ -845,14 +850,15 @@ Inherits or Implemented: [Attribute](#Attribute)
|
||||
| `GetMinMaxData()` |public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)</br>获得系列所有数据的最大最小值。 |
|
||||
| `GetMinSerieData()` |public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)</br> |
|
||||
| `GetNumericFormatter()` |public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)</br> |
|
||||
| `GetSerieEmphasisLabel()` |public static LabelStyle GetSerieEmphasisLabel(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSerieLabel()` |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetSerieLabelLine()` |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, bool highlight = false)</br> |
|
||||
| `GetSerieSymbol()` |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)</br> |
|
||||
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, float defaultWidth)</br> |
|
||||
| `GetSymbolBorderColor()` |public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)</br> |
|
||||
| `GetSymbolCornerRadius()` |public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)</br> |
|
||||
| `GetSelectStyle()` |public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `GetSerieLabel()` |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetSerieLabelLine()` |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(Serie serie)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)</br> |
|
||||
| `GetSerieState()` |public static SerieState GetSerieState(SerieData serieData)</br> |
|
||||
| `GetSerieSymbol()` |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetStateStyle()` |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)</br> |
|
||||
| `GetSysmbolSize()` |public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)</br> |
|
||||
| `GetTitleStyle()` |public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)</br> |
|
||||
| `IsAllZeroValue()` |public static bool IsAllZeroValue(Serie serie, int dimension = 1)</br>系列指定维数的数据是否全部为0。 |
|
||||
| `IsDownPoint()` |public static bool IsDownPoint(Serie serie, int index)</br> |
|
||||
@@ -981,6 +987,7 @@ Inherits or Implemented: [MaskableGraphic](#MaskableGraphic)
|
||||
| `DrawLine()` |public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)</br> |
|
||||
| `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. 画直线 |
|
||||
| `DrawPolygon()` |public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)</br>填充任意多边形(目前只支持凸多边形) |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)</br> |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)</br> |
|
||||
| `DrawRectangle()` |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)</br> |
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
- [ArrowStyle](#ArrowStyle)
|
||||
- [AxisLabel](#AxisLabel)
|
||||
- [AxisLine](#AxisLine)
|
||||
- [AxisMinorSplitLine](#AxisMinorSplitLine)
|
||||
- [AxisMinorTick](#AxisMinorTick)
|
||||
- [AxisName](#AxisName)
|
||||
- [AxisSplitArea](#AxisSplitArea)
|
||||
- [AxisSplitLine](#AxisSplitLine)
|
||||
@@ -83,14 +85,12 @@
|
||||
- [AxisTick](#AxisTick)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [BaseLine](#BaseLine)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [CommentItem](#CommentItem)
|
||||
- [CommentMarkStyle](#CommentMarkStyle)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [EndLabelStyle](#EndLabelStyle)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
@@ -109,10 +109,12 @@
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [SerieData](#SerieData)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [StageColor](#StageColor)
|
||||
- [StateStyle](#StateStyle)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [TextLimit](#TextLimit)
|
||||
@@ -128,28 +130,26 @@
|
||||
## ISerieExtraComponent
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
## ISerieDataComponent
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
@@ -215,8 +215,7 @@ The style of area.
|
||||
|`color`|||the color of area,default use serie color.
|
||||
|`toColor`|||Gradient color, start color to toColor.
|
||||
|`opacity`|0.6f||Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0.
|
||||
|`highlightColor`|||the color of area,default use serie color.
|
||||
|`highlightToColor`|||Gradient color, start highlightColor to highlightToColor.
|
||||
|`innerFill`||v3.2.0|Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
|
||||
## `ArrowStyle`
|
||||
|
||||
@@ -266,6 +265,8 @@ The axis in rectangular coordinate.
|
||||
|`axisLabel`|||axis label. [AxisLabel](#AxisLabel)|
|
||||
|`splitLine`|||axis split line. [AxisSplitLine](#AxisSplitLine)|
|
||||
|`splitArea`|||axis split area. [AxisSplitArea](#AxisSplitArea)|
|
||||
|`minorTick`||v3.2.0|axis minor tick. [AxisMinorTick](#AxisMinorTick)|
|
||||
|`minorSplitLine`||v3.2.0|axis minor split line. [AxisMinorSplitLine](#AxisMinorSplitLine)|
|
||||
|
||||
## `AxisLabel`
|
||||
|
||||
@@ -295,6 +296,32 @@ Settings related to axis line.
|
||||
|`showArrow`|||Whether to show the arrow symbol of axis.
|
||||
|`arrow`|||the arrow of line. [ArrowStyle](#ArrowStyle)|
|
||||
|
||||
## `AxisMinorSplitLine`
|
||||
|
||||
Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|
||||
> Since `v3.2.0`
|
||||
|
||||
Minor split line of axis in grid area.
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`distance`|||The distance between the split line and axis line.
|
||||
|`autoColor`|||auto color.
|
||||
|
||||
## `AxisMinorTick`
|
||||
|
||||
Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|
||||
> Since `v3.2.0`
|
||||
|
||||
Settings related to axis minor tick.
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`splitNumber`|5||Number of segments that the axis is split into.
|
||||
|`autoColor`|||
|
||||
|
||||
## `AxisName`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -384,7 +411,8 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
|`splitLineType`|||the type of split line.</br>`LineStyle.Type`:</br>- `Solid`: 实线</br>- `Dashed`: 虚线</br>- `Dotted`: 点线</br>- `DashDot`: 点划线</br>- `DashDotDot`: 双点划线</br>- `None`: 双点划线</br>|
|
||||
|`splitLineWidth`|1f||the width of split line.
|
||||
|`splitLineLength`|0f||the length of split line.
|
||||
|`splitLineColor`|||the color of line.
|
||||
|`splitLineColor`|||the color of split line.
|
||||
|`minorSplitLineColor`|||the color of minor split line.
|
||||
|`tickWidth`|1f||the width of tick.
|
||||
|`tickLength`|5f||the length of tick.
|
||||
|`tickColor`|||the color of tick.
|
||||
@@ -409,6 +437,15 @@ Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContai
|
||||
## `BaseSerie`
|
||||
|
||||
|
||||
## `BlurStyle`
|
||||
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
> Since `v3.2.0`
|
||||
|
||||
Configurations of blur state.
|
||||
|
||||
|
||||
## `CalendarCoord`
|
||||
|
||||
Inherits or Implemented: [CoordSystem](#CoordSystem),[IUpdateRuntimeData](#IUpdateRuntimeData),[ISerieContainer](#ISerieContainer)
|
||||
@@ -550,39 +587,19 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
Inherits or Implemented: [BaseScatter](#BaseScatter)
|
||||
|
||||
|
||||
## `Emphasis`
|
||||
## `EmphasisStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的图形样式和文本标签样式。
|
||||
> Since `v3.2.0`
|
||||
|
||||
Configurations of emphasis state.
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`show`|||是否启用高亮样式。
|
||||
|`label`|||图形文本标签。 [LabelStyle](#LabelStyle)|
|
||||
|`labelLine`|||图形文本引导线样式。 [LabelLine](#LabelLine)|
|
||||
|`itemStyle`|||图形样式。 [ItemStyle](#ItemStyle)|
|
||||
|
||||
## `EmphasisItemStyle`
|
||||
|
||||
Inherits or Implemented: [ItemStyle](#ItemStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的图形样式
|
||||
|
||||
|
||||
## `EmphasisLabelLine`
|
||||
|
||||
Inherits or Implemented: [LabelLine](#LabelLine),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的标签引导线样式
|
||||
|
||||
|
||||
## `EmphasisLabelStyle`
|
||||
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的标签样式
|
||||
|
||||
|`scale`|1.1f||Whether to scale to highlight the data in emphasis state.
|
||||
|`focus`|||When the data is highlighted, whether to fade out of other data to focus the highlighted.</br>`EmphasisStyle.FocusType`:</br>- `None`: Do not fade out other data, it's by default.</br>- `Self`: Only focus (not fade out) the element of the currently highlighted data.</br>- `Series`: Focus on all elements of the series which the currently highlighted data belongs to.</br>|
|
||||
|`blurScope`|||The range of fade out when focus is enabled.</br>`EmphasisStyle.BlurScope`:</br>- `GridCoord`: coordinate system.</br>- `Series`: series.</br>- `Global`: global.</br>|
|
||||
|
||||
## `EndLabelStyle`
|
||||
|
||||
@@ -994,6 +1011,9 @@ Polar coordinate can be used in scatter and line chart. Every polar coordinate h
|
||||
|
||||
Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContainer)
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`smooth`|false|3.2.0|Whether use smooth curve.
|
||||
|
||||
## `RadarAxisTheme`
|
||||
|
||||
@@ -1029,6 +1049,15 @@ Inherits or Implemented: [Serie](#Serie)
|
||||
Inherits or Implemented: [BaseScatter](#BaseScatter)
|
||||
|
||||
|
||||
## `SelectStyle`
|
||||
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
> Since `v3.2.0`
|
||||
|
||||
Configurations of select state.
|
||||
|
||||
|
||||
## `Serie`
|
||||
|
||||
Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
@@ -1042,6 +1071,8 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
|`coordSystem`|||the chart coord system of serie.
|
||||
|`serieType`|||the type of serie.
|
||||
|`serieName`|||Series name used for displaying in tooltip and filtering with legend.
|
||||
|`state`||v3.2.0|The default state of a serie.</br>`SerieState`:</br>- `Normal`: Normal state.</br>- `Emphasis`: Emphasis state.</br>- `Blur`: Blur state.</br>- `Select`: Select state.</br>- `Auto`: Auto state.</br>|
|
||||
|`colorBy`||v3.2.0|The policy to take color from theme.</br>`SerieColorBy`:</br>- `Default`: Select state.</br>- `Serie`: assigns the colors in the palette by serie, so that all data in the same series are in the same color;.</br>- `Data`: assigns colors in the palette according to data items, with each data item using a different color..</br>|
|
||||
|`stack`|||If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
|
||||
|`xAxisIndex`|0||the index of XAxis.
|
||||
|`yAxisIndex`|0||the index of YAxis.
|
||||
@@ -1119,6 +1150,7 @@ A data item of serie.
|
||||
|`ignore`|||是否忽略数据。当为 true 时,数据不进行绘制。
|
||||
|`selected`|||Whether the data item is selected.
|
||||
|`radius`|||自定义半径。可用在饼图中自定义某个数据项的半径。
|
||||
|`state`||v3.2.0|the state of serie data.</br>`SerieState`:</br>- `Normal`: Normal state.</br>- `Emphasis`: Emphasis state.</br>- `Blur`: Blur state.</br>- `Select`: Select state.</br>- `Auto`: Auto state.</br>|
|
||||
|`data`|||An arbitrary dimension data list of data item.
|
||||
|
||||
## `SerieSymbol`
|
||||
@@ -1130,12 +1162,9 @@ Inherits or Implemented: [SymbolStyle](#SymbolStyle),[ISerieDataComponent](#ISer
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`sizeType`|||the type of symbol size.</br>`SymbolSizeType`:</br>- `Custom`: Specify constant for symbol size.</br>- `FromData`: Specify the dataIndex and dataScale to calculate symbol size.</br>- `Function`: Specify function for symbol size.</br>|
|
||||
|`selectedSize`|0f||the size of selected symbol.
|
||||
|`dataIndex`|1||whitch data index is when the sizeType assined as FromData.
|
||||
|`dataScale`|1||the scale of data when sizeType assined as FromData.
|
||||
|`selectedDataScale`|1.5f||the scale of selected data when sizeType assined as FromData.
|
||||
|`sizeFunction`|||the function of size when sizeType assined as Function.
|
||||
|`selectedSizeFunction`|||the function of size when sizeType assined as Function.
|
||||
|`startIndex`|||the index start to show symbol.
|
||||
|`interval`|||the interval of show symbol.
|
||||
|`forceShowLast`|false||whether to show the last symbol.
|
||||
@@ -1227,6 +1256,24 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|`percent`|||结束位置百分比。
|
||||
|`color`|||颜色。
|
||||
|
||||
## `StateStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
> Since `v3.2.0`
|
||||
|
||||
the state style of serie.
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`show`|true||是否启用高亮样式。
|
||||
|`label`|||图形文本标签。 [LabelStyle](#LabelStyle)|
|
||||
|`labelLine`|||图形文本引导线样式。 [LabelLine](#LabelLine)|
|
||||
|`itemStyle`|||图形样式。 [ItemStyle](#ItemStyle)|
|
||||
|`lineStyle`|||折线样式。 [LineStyle](#LineStyle)|
|
||||
|`areaStyle`|||区域样式。 [AreaStyle](#AreaStyle)|
|
||||
|`symbol`|||标记样式。 [SerieSymbol](#SerieSymbol)|
|
||||
|
||||
## `SubTitleTheme`
|
||||
|
||||
Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
- [ArrowStyle](#ArrowStyle)
|
||||
- [AxisLabel](#AxisLabel)
|
||||
- [AxisLine](#AxisLine)
|
||||
- [AxisMinorSplitLine](#AxisMinorSplitLine)
|
||||
- [AxisMinorTick](#AxisMinorTick)
|
||||
- [AxisName](#AxisName)
|
||||
- [AxisSplitArea](#AxisSplitArea)
|
||||
- [AxisSplitLine](#AxisSplitLine)
|
||||
@@ -83,14 +85,12 @@
|
||||
- [AxisTick](#AxisTick)
|
||||
- [BaseAxisTheme](#BaseAxisTheme)
|
||||
- [BaseLine](#BaseLine)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [CommentItem](#CommentItem)
|
||||
- [CommentMarkStyle](#CommentMarkStyle)
|
||||
- [ComponentTheme](#ComponentTheme)
|
||||
- [DataZoomTheme](#DataZoomTheme)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [EndLabelStyle](#EndLabelStyle)
|
||||
- [IconStyle](#IconStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
@@ -109,10 +109,12 @@
|
||||
- [PolarAxisTheme](#PolarAxisTheme)
|
||||
- [RadarAxisTheme](#RadarAxisTheme)
|
||||
- [RadiusAxisTheme](#RadiusAxisTheme)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [SerieData](#SerieData)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [SerieTheme](#SerieTheme)
|
||||
- [StageColor](#StageColor)
|
||||
- [StateStyle](#StateStyle)
|
||||
- [SubTitleTheme](#SubTitleTheme)
|
||||
- [SymbolStyle](#SymbolStyle)
|
||||
- [TextLimit](#TextLimit)
|
||||
@@ -128,28 +130,26 @@
|
||||
## ISerieExtraComponent Serie额外组件
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineArrow](#LineArrow)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
## ISerieDataComponent SerieData额外组件
|
||||
|
||||
- [AreaStyle](#AreaStyle)
|
||||
- [Emphasis](#Emphasis)
|
||||
- [EmphasisItemStyle](#EmphasisItemStyle)
|
||||
- [EmphasisLabelLine](#EmphasisLabelLine)
|
||||
- [EmphasisLabelStyle](#EmphasisLabelStyle)
|
||||
- [BlurStyle](#BlurStyle)
|
||||
- [EmphasisStyle](#EmphasisStyle)
|
||||
- [ImageStyle](#ImageStyle)
|
||||
- [ItemStyle](#ItemStyle)
|
||||
- [LabelLine](#LabelLine)
|
||||
- [LabelStyle](#LabelStyle)
|
||||
- [LineStyle](#LineStyle)
|
||||
- [SelectStyle](#SelectStyle)
|
||||
- [SerieSymbol](#SerieSymbol)
|
||||
- [TitleStyle](#TitleStyle)
|
||||
|
||||
@@ -215,8 +215,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|
||||
|`color`|||区域填充的颜色,如果toColor不是默认值,则表示渐变色的起点颜色。
|
||||
|`toColor`|||渐变色的终点颜色。
|
||||
|`opacity`|0.6f||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|
||||
|`highlightColor`|||高亮时区域填充的颜色,如果highlightToColor不是默认值,则表示渐变色的起点颜色。
|
||||
|`highlightToColor`|||高亮时渐变色的终点颜色。
|
||||
|`innerFill`||v3.2.0|是否只填充多边形区域。目前只支持凸多边形。
|
||||
|
||||
## `ArrowStyle`
|
||||
|
||||
@@ -266,6 +265,8 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|`axisLabel`|||坐标轴刻度标签。 [AxisLabel](#AxisLabel)|
|
||||
|`splitLine`|||坐标轴分割线。 [AxisSplitLine](#AxisSplitLine)|
|
||||
|`splitArea`|||坐标轴分割区域。 [AxisSplitArea](#AxisSplitArea)|
|
||||
|`minorTick`||v3.2.0|坐标轴次刻度。 [AxisMinorTick](#AxisMinorTick)|
|
||||
|`minorSplitLine`||v3.2.0|坐标轴次分割线。 [AxisMinorSplitLine](#AxisMinorSplitLine)|
|
||||
|
||||
## `AxisLabel`
|
||||
|
||||
@@ -295,6 +296,32 @@ Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|`showArrow`|||是否显示箭头。
|
||||
|`arrow`|||轴线箭头。 [ArrowStyle](#ArrowStyle)|
|
||||
|
||||
## `AxisMinorSplitLine`
|
||||
|
||||
Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
坐标轴在 grid 区域中的次分隔线。次分割线会对齐次刻度线 minorTick。
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`distance`|||刻度线与轴线的距离。
|
||||
|`autoColor`|||自动设置颜色。
|
||||
|
||||
## `AxisMinorTick`
|
||||
|
||||
Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
坐标轴次刻度相关设置。注意:次刻度无法在类目轴中使用。
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`splitNumber`|5||分隔线之间分割的刻度数。
|
||||
|`autoColor`|||
|
||||
|
||||
## `AxisName`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
@@ -385,6 +412,7 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
|`splitLineWidth`|1f||分割线线宽。
|
||||
|`splitLineLength`|0f||分割线线长。
|
||||
|`splitLineColor`|||分割线线颜色。
|
||||
|`minorSplitLineColor`|||次分割线线颜色。
|
||||
|`tickWidth`|1f||刻度线线宽。
|
||||
|`tickLength`|5f||刻度线线长。
|
||||
|`tickColor`|||坐标轴线颜色。
|
||||
@@ -409,6 +437,15 @@ Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContai
|
||||
## `BaseSerie`
|
||||
|
||||
|
||||
## `BlurStyle`
|
||||
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
淡出状态样式。
|
||||
|
||||
|
||||
## `CalendarCoord`
|
||||
|
||||
Inherits or Implemented: [CoordSystem](#CoordSystem),[IUpdateRuntimeData](#IUpdateRuntimeData),[ISerieContainer](#ISerieContainer)
|
||||
@@ -550,39 +587,19 @@ Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
Inherits or Implemented: [BaseScatter](#BaseScatter)
|
||||
|
||||
|
||||
## `Emphasis`
|
||||
## `EmphasisStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的图形样式和文本标签样式。
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
高亮状态样式。
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`show`|||是否启用高亮样式。
|
||||
|`label`|||图形文本标签。 [LabelStyle](#LabelStyle)|
|
||||
|`labelLine`|||图形文本引导线样式。 [LabelLine](#LabelLine)|
|
||||
|`itemStyle`|||图形样式。 [ItemStyle](#ItemStyle)|
|
||||
|
||||
## `EmphasisItemStyle`
|
||||
|
||||
Inherits or Implemented: [ItemStyle](#ItemStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的图形样式
|
||||
|
||||
|
||||
## `EmphasisLabelLine`
|
||||
|
||||
Inherits or Implemented: [LabelLine](#LabelLine),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的标签引导线样式
|
||||
|
||||
|
||||
## `EmphasisLabelStyle`
|
||||
|
||||
Inherits or Implemented: [LabelStyle](#LabelStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
高亮的标签样式
|
||||
|
||||
|`scale`|1.1f||高亮时的缩放倍数。
|
||||
|`focus`|||在高亮图形时,是否淡出其它数据的图形已达到聚焦的效果。</br>`EmphasisStyle.FocusType`:</br>- `None`: 不淡出其它图形,默认使用该配置。</br>- `Self`: 只聚焦(不淡出)当前高亮的数据的图形。</br>- `Series`: 聚焦当前高亮的数据所在的系列的所有图形。</br>|
|
||||
|`blurScope`|||在开启focus的时候,可以通过blurScope配置淡出的范围。</br>`EmphasisStyle.BlurScope`:</br>- `GridCoord`: 淡出范围为坐标系,默认使用该配置。</br>- `Series`: 淡出范围为系列。</br>- `Global`: 淡出范围为全局。</br>|
|
||||
|
||||
## `EndLabelStyle`
|
||||
|
||||
@@ -994,6 +1011,9 @@ Inherits or Implemented: [CoordSystem](#CoordSystem),[ISerieContainer](#ISerieCo
|
||||
|
||||
Inherits or Implemented: [Serie](#Serie),[INeedSerieContainer](#INeedSerieContainer)
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`smooth`|false|3.2.0|是否平滑曲线。平滑曲线时不支持区域填充颜色。
|
||||
|
||||
## `RadarAxisTheme`
|
||||
|
||||
@@ -1029,6 +1049,15 @@ Inherits or Implemented: [Serie](#Serie)
|
||||
Inherits or Implemented: [BaseScatter](#BaseScatter)
|
||||
|
||||
|
||||
## `SelectStyle`
|
||||
|
||||
Inherits or Implemented: [StateStyle](#StateStyle),[ISerieExtraComponent](#ISerieExtraComponent),[ISerieDataComponent](#ISerieDataComponent)
|
||||
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
选中状态样式。
|
||||
|
||||
|
||||
## `Serie`
|
||||
|
||||
Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
@@ -1042,6 +1071,8 @@ Inherits or Implemented: [BaseSerie](#BaseSerie),[IComparable](#IComparable)
|
||||
|`coordSystem`|||使用的坐标系。
|
||||
|`serieType`|||系列类型。
|
||||
|`serieName`|||系列名称,用于 tooltip 的显示,legend 的图例筛选。
|
||||
|`state`||v3.2.0|系列的默认状态。</br>`SerieState`:</br>- `Normal`: 正常状态。</br>- `Emphasis`: 高亮状态。</br>- `Blur`: 淡出状态。</br>- `Select`: 选中状态。</br>- `Auto`: 自动保持和父节点一致。一般用在SerieData。</br>|
|
||||
|`colorBy`||v3.2.0|从主题中取色的策略。</br>`SerieColorBy`:</br>- `Default`: 默认策略。每种Serie都有自己的默认的取颜色策略。比如Line默认是Series策略,Pie默认是Data策略</br>- `Serie`: 按照系列分配调色盘中的颜色,同一系列中的所有数据都是用相同的颜色。</br>- `Data`: 按照数据项分配调色盘中的颜色,每个数据项都使用不同的颜色。</br>|
|
||||
|`stack`|||数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。
|
||||
|`xAxisIndex`|0||使用X轴的index。
|
||||
|`yAxisIndex`|0||使用Y轴的index。
|
||||
@@ -1119,6 +1150,7 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|`ignore`|||是否忽略数据。当为 true 时,数据不进行绘制。
|
||||
|`selected`|||该数据项是否被选中。
|
||||
|`radius`|||自定义半径。可用在饼图中自定义某个数据项的半径。
|
||||
|`state`||v3.2.0|数据项的默认状态。</br>`SerieState`:</br>- `Normal`: 正常状态。</br>- `Emphasis`: 高亮状态。</br>- `Blur`: 淡出状态。</br>- `Select`: 选中状态。</br>- `Auto`: 自动保持和父节点一致。一般用在SerieData。</br>|
|
||||
|`data`|||可指定任意维数的数值列表。
|
||||
|
||||
## `SerieSymbol`
|
||||
@@ -1130,12 +1162,9 @@ Inherits or Implemented: [SymbolStyle](#SymbolStyle),[ISerieDataComponent](#ISer
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`sizeType`|||标记图形的大小获取方式。</br>`SymbolSizeType`:</br>- `Custom`: 自定义大小。</br>- `FromData`: 通过 dataIndex 从数据中获取,再乘以一个比例系数 dataScale 。</br>- `Function`: 通过委托函数获取。</br>|
|
||||
|`selectedSize`|0f||被选中的标记的大小。
|
||||
|`dataIndex`|1||当sizeType指定为FromData时,指定的数据源索引。
|
||||
|`dataScale`|1||当sizeType指定为FromData时,指定的倍数系数。
|
||||
|`selectedDataScale`|1.5f||当sizeType指定为FromData时,指定的高亮倍数系数。
|
||||
|`sizeFunction`|||当sizeType指定为Function时,指定的委托函数。
|
||||
|`selectedSizeFunction`|||当sizeType指定为Function时,指定的高亮委托函数。
|
||||
|`startIndex`|||开始显示图形标记的索引。
|
||||
|`interval`|||显示图形标记的间隔。0表示显示所有标签,1表示隔一个隔显示一个标签,以此类推。
|
||||
|`forceShowLast`|false||是否强制显示最后一个图形标记。
|
||||
@@ -1227,6 +1256,24 @@ Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|`percent`|||结束位置百分比。
|
||||
|`color`|||颜色。
|
||||
|
||||
## `StateStyle`
|
||||
|
||||
Inherits or Implemented: [ChildComponent](#ChildComponent)
|
||||
|
||||
> 从 `v3.2.0` 开始支持
|
||||
|
||||
Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种状态。
|
||||
|
||||
|field|default|since|comment|
|
||||
|--|--|--|--|
|
||||
|`show`|true||是否启用高亮样式。
|
||||
|`label`|||图形文本标签。 [LabelStyle](#LabelStyle)|
|
||||
|`labelLine`|||图形文本引导线样式。 [LabelLine](#LabelLine)|
|
||||
|`itemStyle`|||图形样式。 [ItemStyle](#ItemStyle)|
|
||||
|`lineStyle`|||折线样式。 [LineStyle](#LineStyle)|
|
||||
|`areaStyle`|||区域样式。 [AreaStyle](#AreaStyle)|
|
||||
|`symbol`|||标记样式。 [SerieSymbol](#SerieSymbol)|
|
||||
|
||||
## `SubTitleTheme`
|
||||
|
||||
Inherits or Implemented: [ComponentTheme](#ComponentTheme)
|
||||
@@ -1386,7 +1433,7 @@ Inherits or Implemented: [MainComponent](#MainComponent)
|
||||
|`paddingLeftRight`|10||左右边距。
|
||||
|`paddingTopBottom`|10||上下边距。
|
||||
|`ignoreDataShow`|false||是否显示忽略数据在tooltip上。
|
||||
|`ignoreDataDefaultContent`|||被忽略数据的默认显示字符信息。
|
||||
|`ignoreDataDefaultContent`|||被忽略数据的默认显示字符信息。如果设置为空,则表示完全不显示忽略数据。
|
||||
|`showContent`|true||是否显示提示框浮层,默认显示。只需tooltip触发事件或显示axisPointer而不需要显示内容时可配置该项为false。
|
||||
|`alwayShowContent`|false||是否触发后一直显示提示框浮层。
|
||||
|`offset`|Vector2(18f, -25f)||提示框相对于鼠标位置的偏移。
|
||||
|
||||
@@ -17,9 +17,8 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Origin");
|
||||
PropertyField(prop, "m_Color");
|
||||
PropertyField(prop, "m_ToColor");
|
||||
PropertyField(prop, "m_HighlightColor");
|
||||
PropertyField(prop, "m_HighlightToColor");
|
||||
PropertyField(prop, "m_Opacity");
|
||||
PropertyField(prop, "m_InnerFill");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Emphasis), true)]
|
||||
public class EmphasisDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "Emphasis"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_LabelLine");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisItemStyle), true)]
|
||||
public class EmphasisItemStyleDrawer : ItemStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisItemStyle"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisLabelStyle), true)]
|
||||
public class EmphasisLabelStyleDrawer : LabelStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisLabel"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisLabelLine), true)]
|
||||
public class EmphasisLabelLineDrawer : LabelLineDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisLabelLine"; } }
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,18 @@ namespace XCharts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisMinorSplitLine), true)]
|
||||
public class AxisMinorSplitLineDrawer : BaseLineDrawer
|
||||
{
|
||||
public override string ClassName { get { return "MinorSplitLine"; } }
|
||||
protected override void DrawExtendeds(SerializedProperty prop)
|
||||
{
|
||||
base.DrawExtendeds(prop);
|
||||
//PropertyField(prop, "m_Distance");
|
||||
//PropertyField(prop, "m_AutoColor");
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisTick), true)]
|
||||
public class AxisTickDrawer : BaseLineDrawer
|
||||
{
|
||||
@@ -63,4 +75,16 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisMinorTick), true)]
|
||||
public class AxisMinorTickDrawer : BaseLineDrawer
|
||||
{
|
||||
public override string ClassName { get { return "MinorTick"; } }
|
||||
protected override void DrawExtendeds(SerializedProperty prop)
|
||||
{
|
||||
base.DrawExtendeds(prop);
|
||||
PropertyField(prop, "m_SplitNumber");
|
||||
//PropertyField(prop, "m_AutoColor");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,12 +31,10 @@ namespace XCharts.Editor
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
PropertyField(prop, "m_Size");
|
||||
PropertyField(prop, "m_SelectedSize");
|
||||
break;
|
||||
case SymbolSizeType.FromData:
|
||||
PropertyField(prop, "m_DataIndex");
|
||||
PropertyField(prop, "m_DataScale");
|
||||
PropertyField(prop, "m_SelectedDataScale");
|
||||
break;
|
||||
case SymbolSizeType.Function:
|
||||
break;
|
||||
|
||||
55
Editor/ChildComponents/StateStyleDrawer.cs
Normal file
55
Editor/ChildComponents/StateStyleDrawer.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StateStyle), true)]
|
||||
public class StateStyleDrawer : BasePropertyDrawer
|
||||
{
|
||||
public override string ClassName { get { return "StateStyle"; } }
|
||||
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
base.OnGUI(pos, prop, label);
|
||||
if (MakeComponentFoldout(prop, "m_Show", true))
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
OnCustomGUI(prop);
|
||||
PropertyField(prop, "m_Symbol");
|
||||
PropertyField(prop, "m_ItemStyle");
|
||||
PropertyField(prop, "m_Label");
|
||||
PropertyField(prop, "m_LabelLine");
|
||||
PropertyField(prop, "m_LineStyle");
|
||||
PropertyField(prop, "m_AreaStyle");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnCustomGUI(SerializedProperty prop) { }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(EmphasisStyle), true)]
|
||||
public class EmphasisStyleDrawer : StateStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "EmphasisStyle"; } }
|
||||
protected override void OnCustomGUI(SerializedProperty prop)
|
||||
{
|
||||
PropertyField(prop, "m_Scale");
|
||||
PropertyField(prop, "m_Focus");
|
||||
PropertyField(prop, "m_BlurScope");
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(BlurStyle), true)]
|
||||
public class BlurStyleDrawer : StateStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "BlurStyle"; } }
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(SelectStyle), true)]
|
||||
public class SelectStyleDrawer : StateStyleDrawer
|
||||
{
|
||||
public override string ClassName { get { return "SelectStyle"; } }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e0b1690532674b24952a87e0aead6fa
|
||||
guid: 3aad8ee99115742729ec5a963274fae0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -70,7 +70,6 @@ namespace XCharts.Editor
|
||||
else
|
||||
{
|
||||
PropertyField("m_Interval");
|
||||
PropertyField("m_BoundaryGap");
|
||||
}
|
||||
DrawExtendeds();
|
||||
PropertyField("m_AxisLine");
|
||||
@@ -79,6 +78,11 @@ namespace XCharts.Editor
|
||||
PropertyField("m_AxisLabel");
|
||||
PropertyField("m_SplitLine");
|
||||
PropertyField("m_SplitArea");
|
||||
if (type != Axis.AxisType.Category)
|
||||
{
|
||||
PropertyField("m_MinorTick");
|
||||
PropertyField("m_MinorSplitLine");
|
||||
}
|
||||
PropertyListField("m_Icons", true);
|
||||
if (type == Axis.AxisType.Category)
|
||||
{
|
||||
@@ -93,12 +97,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[ComponentEditor(typeof(XAxis))]
|
||||
public class XAxisEditor : AxisEditor
|
||||
{ }
|
||||
public class XAxisEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(YAxis))]
|
||||
public class YAxisEditor : AxisEditor
|
||||
{ }
|
||||
public class YAxisEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(SingleAxis))]
|
||||
public class SingleAxisEditor : AxisEditor
|
||||
@@ -128,12 +130,10 @@ namespace XCharts.Editor
|
||||
}
|
||||
|
||||
[ComponentEditor(typeof(RadiusAxis))]
|
||||
public class RadiusAxisEditor : AxisEditor
|
||||
{ }
|
||||
public class RadiusAxisEditor : AxisEditor { }
|
||||
|
||||
[ComponentEditor(typeof(ParallelAxis))]
|
||||
public class ParallelAxisEditor : AxisEditor
|
||||
{ }
|
||||
public class ParallelAxisEditor : AxisEditor { }
|
||||
|
||||
[CustomPropertyDrawer(typeof(AxisLabel), true)]
|
||||
public class AxisLabelDrawer : BasePropertyDrawer
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace XCharts.Editor
|
||||
PropertyField("m_AxisName");
|
||||
PropertyField("m_SplitLine");
|
||||
PropertyField("m_SplitArea");
|
||||
PropertyField("m_IndicatorList");
|
||||
PropertyListField("m_IndicatorList");
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@ namespace XCharts.Editor
|
||||
{
|
||||
static class Styles
|
||||
{
|
||||
internal static GUIContent btnReset = new GUIContent("Reset", "Reset to default theme");
|
||||
internal static GUIContent btnSync = new GUIContent("Sync Font", "Sync main theme font to sub theme font");
|
||||
internal static GUIContent btnReset = new GUIContent("Reset to Default", "Reset to default theme");
|
||||
internal static GUIContent btnSyncFontToSubTheme = new GUIContent("Sync Font to Sub Theme", "Sync main theme font to sub theme font");
|
||||
internal static GUIContent btnSyncFontFromSetting = new GUIContent("Sync Font from Setting", "Sync main theme font and sub theme font from XCSetting font");
|
||||
}
|
||||
|
||||
private Theme m_Theme;
|
||||
@@ -28,11 +29,35 @@ namespace XCharts.Editor
|
||||
base.OnInspectorGUI();
|
||||
if (GUILayout.Button(Styles.btnReset))
|
||||
{
|
||||
m_Theme.ResetTheme();
|
||||
if (EditorUtility.DisplayDialog(Styles.btnReset.text, Styles.btnReset.tooltip, "Yes", "Cancel"))
|
||||
{
|
||||
m_Theme.ResetTheme();
|
||||
Debug.Log("XCharts: Reset Finish.");
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button(Styles.btnSync))
|
||||
if (GUILayout.Button(Styles.btnSyncFontFromSetting))
|
||||
{
|
||||
m_Theme.SyncFontToSubComponent();
|
||||
if (EditorUtility.DisplayDialog(Styles.btnSyncFontFromSetting.text, Styles.btnSyncFontFromSetting.tooltip, "Yes", "Cancel"))
|
||||
{
|
||||
m_Theme.common.font = XCSettings.font;
|
||||
m_Theme.SyncFontToSubComponent();
|
||||
#if dUI_TextMeshPro
|
||||
m_Theme.common.tmpFont = XCSettings.tmpFont;
|
||||
m_Theme.SyncTMPFontToSubComponent();
|
||||
#endif
|
||||
Debug.Log("XCharts: Sync Finish.");
|
||||
}
|
||||
}
|
||||
if (GUILayout.Button(Styles.btnSyncFontToSubTheme))
|
||||
{
|
||||
if (EditorUtility.DisplayDialog(Styles.btnSyncFontToSubTheme.text, Styles.btnSyncFontToSubTheme.tooltip, "Yes", "Cancel"))
|
||||
{
|
||||
m_Theme.SyncFontToSubComponent();
|
||||
#if dUI_TextMeshPro
|
||||
m_Theme.SyncTMPFontToSubComponent();
|
||||
#endif
|
||||
Debug.Log("XCharts: Sync Finish.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override void OnCustomInspectorGUI()
|
||||
{
|
||||
PropertyField("m_ColorBy");
|
||||
PropertyField("m_Stack");
|
||||
if (serie.IsUseCoord<PolarCoord>())
|
||||
{
|
||||
|
||||
@@ -7,8 +7,10 @@ namespace XCharts.Editor
|
||||
{
|
||||
public override void OnCustomInspectorGUI()
|
||||
{
|
||||
PropertyField("m_ColorBy");
|
||||
PropertyField("m_RadarType");
|
||||
PropertyField("m_RadarIndex");
|
||||
PropertyField("m_Smooth");
|
||||
|
||||
PropertyField("m_Symbol");
|
||||
PropertyField("m_LineStyle");
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace XCharts.Editor
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
//PropertyField("m_InsertDataToHead");
|
||||
PropertyField("m_SerieName");
|
||||
if (m_CoordOptionsNames != null && m_CoordOptionsNames.Count > 1)
|
||||
{
|
||||
@@ -28,6 +27,7 @@ namespace XCharts.Editor
|
||||
serie.coordSystem = m_CoordOptionsDic[typeName].Name;
|
||||
}
|
||||
}
|
||||
PropertyField("m_State");
|
||||
OnCustomInspectorGUI();
|
||||
OnExtraInspectorGUI();
|
||||
PropertyFieldData();
|
||||
@@ -72,6 +72,7 @@ namespace XCharts.Editor
|
||||
{
|
||||
while (listSize > m_Datas.arraySize) m_Datas.arraySize++;
|
||||
while (listSize < m_Datas.arraySize) m_Datas.arraySize--;
|
||||
serie.ResetDataIndex();
|
||||
}
|
||||
if (listSize > 30) // && !XCSettings.editorShowAllListData)
|
||||
{
|
||||
@@ -114,7 +115,9 @@ namespace XCharts.Editor
|
||||
m_DataElementFoldout[index] = false;
|
||||
}
|
||||
var fieldCount = dimension + (showName ? 1 : 0);
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + index, flag, false, null,
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var dataIndex = serieData.FindPropertyRelative("m_Index").intValue;
|
||||
m_DataElementFoldout[index] = ChartEditorHelper.DrawHeader("SerieData " + dataIndex, flag, false, null,
|
||||
delegate(Rect drawRect)
|
||||
{
|
||||
//drawRect.width -= 2f;
|
||||
@@ -124,7 +127,7 @@ namespace XCharts.Editor
|
||||
var lastWid = drawRect.width;
|
||||
var lastFieldWid = EditorGUIUtility.fieldWidth;
|
||||
var lastLabelWid = EditorGUIUtility.labelWidth;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
//var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var sereName = serieData.FindPropertyRelative("m_Name");
|
||||
var data = serieData.FindPropertyRelative("m_Data");
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
@@ -153,7 +156,7 @@ namespace XCharts.Editor
|
||||
var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15 + gap;
|
||||
var dataWidTotal = (currentWidth - (startX + 20.5f + 1));
|
||||
var dataWid = dataWidTotal / fieldCount;
|
||||
var xWid = dataWid - 2;
|
||||
var xWid = dataWid - 0;
|
||||
for (int i = 0; i < dimension; i++)
|
||||
{
|
||||
var dataCount = i < 1 ? 2 : i + 1;
|
||||
@@ -189,9 +192,8 @@ namespace XCharts.Editor
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
var serieData = m_Datas.GetArrayElementAtIndex(index);
|
||||
var m_Name = serieData.FindPropertyRelative("m_Name");
|
||||
|
||||
PropertyField(m_Name);
|
||||
PropertyField(serieData.FindPropertyRelative("m_Name"));
|
||||
//PropertyField(serieData.FindPropertyRelative("m_State"));
|
||||
if (serie.GetType().IsDefined(typeof(SerieDataExtraFieldAttribute), false))
|
||||
{
|
||||
var attribute = serie.GetType().GetAttribute<SerieDataExtraFieldAttribute>();
|
||||
|
||||
@@ -162,6 +162,13 @@ namespace XCharts.Editor
|
||||
RefreshEditors();
|
||||
}
|
||||
}));
|
||||
editor.menus.Add(new HeaderMenuInfo("Reset Data Index", () =>
|
||||
{
|
||||
if (chart.ResetDataIndex(id))
|
||||
{
|
||||
RefreshEditors();
|
||||
}
|
||||
}));
|
||||
foreach (var type in GetCovertToSerie(editor.serie.GetType()))
|
||||
{
|
||||
editor.menus.Add(new HeaderMenuInfo("Covert to " + type.Name, () =>
|
||||
|
||||
@@ -62,10 +62,12 @@ namespace XCharts.Editor
|
||||
XCThemeMgr.CheckReloadTheme();
|
||||
var chart = new GameObject();
|
||||
chart.name = GetName(parent, chartName);
|
||||
chart.layer = LayerMask.NameToLayer("UI");
|
||||
var t = chart.AddComponent<T>();
|
||||
chart.transform.SetParent(parent);
|
||||
chart.transform.localScale = Vector3.one;
|
||||
chart.transform.localPosition = Vector3.zero;
|
||||
chart.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
var rect = chart.GetComponent<RectTransform>();
|
||||
rect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
rect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace XCharts.Example
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
serie.symbol.sizeFunction = SymbolSize;
|
||||
serie.symbol.selectedSizeFunction = SymbolSelectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +25,5 @@ namespace XCharts.Example
|
||||
{
|
||||
return (float) (Math.Sqrt(data[2]) / 6e2);
|
||||
}
|
||||
|
||||
float SymbolSelectedSize(List<double> data)
|
||||
{
|
||||
return (float) (Math.Sqrt(data[2]) / 5e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,10 +47,10 @@ namespace XCharts.Example
|
||||
serie.itemStyle.borderColor = Color.clear;
|
||||
|
||||
//设置高亮样式
|
||||
serie.AddExtraComponent<EmphasisItemStyle>();
|
||||
serie.emphasisItemStyle.show = true;
|
||||
serie.emphasisItemStyle.borderWidth = 1;
|
||||
serie.emphasisItemStyle.borderColor = Color.black;
|
||||
var emphasisStyle = serie.AddExtraComponent<EmphasisStyle>();
|
||||
emphasisStyle.itemStyle.show = true;
|
||||
emphasisStyle.itemStyle.borderWidth = 1;
|
||||
emphasisStyle.itemStyle.borderColor = Color.black;
|
||||
|
||||
//设置视觉映射组件
|
||||
var visualMap = chart.GetChartComponent<VisualMap>();
|
||||
|
||||
@@ -101,6 +101,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField] protected AxisLabel m_AxisLabel = AxisLabel.defaultAxisLabel;
|
||||
[SerializeField] protected AxisSplitLine m_SplitLine = AxisSplitLine.defaultSplitLine;
|
||||
[SerializeField] protected AxisSplitArea m_SplitArea = AxisSplitArea.defaultSplitArea;
|
||||
[SerializeField][Since("v3.2.0")] protected AxisMinorTick m_MinorTick = AxisMinorTick.defaultMinorTick;
|
||||
[SerializeField][Since("v3.2.0")] protected AxisMinorSplitLine m_MinorSplitLine = AxisMinorSplitLine.defaultMinorSplitLine;
|
||||
|
||||
public AxisContext context = new AxisContext();
|
||||
|
||||
@@ -352,6 +354,24 @@ namespace XCharts.Runtime
|
||||
set { if (value != null) { m_SplitArea = value; SetVerticesDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// axis minor tick.
|
||||
/// |坐标轴次刻度。
|
||||
/// </summary>
|
||||
public AxisMinorTick minorTick
|
||||
{
|
||||
get { return m_MinorTick; }
|
||||
set { if (value != null) { m_MinorTick = value; SetVerticesDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// axis minor split line.
|
||||
/// |坐标轴次分割线。
|
||||
/// </summary>
|
||||
public AxisMinorSplitLine minorSplitLine
|
||||
{
|
||||
get { return m_MinorSplitLine; }
|
||||
set { if (value != null) { m_MinorSplitLine = value; SetVerticesDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to add new data at the head or at the end of the list.
|
||||
/// |添加新数据时是在列表的头部还是尾部加入。
|
||||
/// </summary>
|
||||
@@ -369,7 +389,9 @@ namespace XCharts.Runtime
|
||||
axisLine.anyDirty ||
|
||||
axisTick.anyDirty ||
|
||||
splitLine.anyDirty ||
|
||||
splitArea.anyDirty;
|
||||
splitArea.anyDirty ||
|
||||
minorTick.anyDirty ||
|
||||
minorSplitLine.anyDirty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,6 +420,8 @@ namespace XCharts.Runtime
|
||||
axisTick.ClearVerticesDirty();
|
||||
splitLine.ClearVerticesDirty();
|
||||
splitArea.ClearVerticesDirty();
|
||||
minorTick.ClearVerticesDirty();
|
||||
minorSplitLine.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void SetComponentDirty()
|
||||
@@ -429,6 +453,8 @@ namespace XCharts.Runtime
|
||||
axis.axisLabel = axisLabel.Clone();
|
||||
axis.splitLine = splitLine.Clone();
|
||||
axis.splitArea = splitArea.Clone();
|
||||
axis.minorTick = minorTick.Clone();
|
||||
axis.minorSplitLine = minorSplitLine.Clone();
|
||||
axis.icons = new List<Sprite>();
|
||||
axis.data = new List<string>();
|
||||
ChartHelper.CopyList(axis.data, data);
|
||||
@@ -457,6 +483,8 @@ namespace XCharts.Runtime
|
||||
axisLabel.Copy(axis.axisLabel);
|
||||
splitLine.Copy(axis.splitLine);
|
||||
splitArea.Copy(axis.splitArea);
|
||||
minorTick.Copy(axis.minorTick);
|
||||
minorSplitLine.Copy(axis.minorSplitLine);
|
||||
ChartHelper.CopyList(data, axis.data);
|
||||
ChartHelper.CopyList<Sprite>(icons, axis.icons);
|
||||
}
|
||||
@@ -527,6 +555,21 @@ namespace XCharts.Runtime
|
||||
return m_Position == AxisPosition.Bottom;
|
||||
}
|
||||
|
||||
public bool IsNeedShowLabel(int index, int total = 0)
|
||||
{
|
||||
if (total == 0)
|
||||
{
|
||||
total = context.labelValueList.Count;
|
||||
}
|
||||
var labelShow = axisLabel.show && (axisLabel.interval == 0 || index % (axisLabel.interval + 1) == 0);
|
||||
if (labelShow)
|
||||
{
|
||||
if (!axisLabel.showStartLabel && index == 0) labelShow = false;
|
||||
else if (!axisLabel.showEndLabel && index == total - 1) labelShow = false;
|
||||
}
|
||||
return labelShow;
|
||||
}
|
||||
|
||||
public void SetNeedUpdateFilterData()
|
||||
{
|
||||
context.isNeedUpdateFilterData = true;
|
||||
@@ -664,6 +707,18 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public float GetValueLength(double value, float axisLength)
|
||||
{
|
||||
if (context.minMaxRange > 0)
|
||||
{
|
||||
return axisLength * ((float) (value / context.minMaxRange));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定区域缩放的类目数据列表
|
||||
/// </summary>
|
||||
@@ -788,5 +843,16 @@ namespace XCharts.Runtime
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void UpdateZeroOffset(float axisLength)
|
||||
{
|
||||
context.offset = context.minValue > 0 || context.minMaxRange == 0 ?
|
||||
0 :
|
||||
(context.maxValue < 0 ?
|
||||
axisLength :
|
||||
(float) (Math.Abs(context.minValue) * (axisLength /
|
||||
(Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,21 @@ namespace XCharts.Runtime
|
||||
public class AxisContext : MainComponentContext
|
||||
{
|
||||
public Orient orient;
|
||||
/// <summary>
|
||||
/// 坐标轴的起点X
|
||||
/// </summary>
|
||||
public float x;
|
||||
/// <summary>
|
||||
/// 坐标轴的起点Y
|
||||
/// </summary>
|
||||
public float y;
|
||||
/// <summary>
|
||||
/// 坐标轴原点X
|
||||
/// </summary>
|
||||
public float zeroX;
|
||||
/// <summary>
|
||||
/// 坐标轴原点Y
|
||||
/// </summary>
|
||||
public float zeroY;
|
||||
public float width;
|
||||
public float height;
|
||||
@@ -34,6 +46,11 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public float offset;
|
||||
public double minMaxRange;
|
||||
/// <summary>
|
||||
/// the tick value of value axis.
|
||||
/// |数值轴时每个tick的数值。
|
||||
/// </summary>
|
||||
public double tickValue;
|
||||
public float scaleWidth;
|
||||
public float startAngle;
|
||||
public double pointerValue;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace XCharts
|
||||
return Vector3.zero;
|
||||
}
|
||||
|
||||
protected virtual float GetAxisLineXOrY()
|
||||
internal virtual float GetAxisLineXOrY()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace XCharts
|
||||
return;
|
||||
if (!grid.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
axis.context.pointerValue = double.NaN;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,6 +144,15 @@ namespace XCharts
|
||||
double tempMaxValue = 0;
|
||||
chart.GetSeriesMinMaxValue(axis, axisIndex, out tempMinValue, out tempMaxValue);
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
if (axis is XAxis)
|
||||
dataZoom.SetXAxisIndexValueInfo(axisIndex, ref tempMinValue, ref tempMaxValue);
|
||||
else
|
||||
dataZoom.SetYAxisIndexValueInfo(axisIndex, ref tempMinValue, ref tempMaxValue);
|
||||
}
|
||||
|
||||
if (tempMinValue != axis.context.minValue ||
|
||||
tempMaxValue != axis.context.maxValue ||
|
||||
m_LastInterval != axis.interval ||
|
||||
@@ -162,41 +171,14 @@ namespace XCharts
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
if (grid != null && axis is XAxis && axis.IsValue())
|
||||
{
|
||||
axis.context.offset = axis.context.minValue > 0 ?
|
||||
0 :
|
||||
(axis.context.maxValue < 0 ?
|
||||
grid.context.width :
|
||||
(float) (Math.Abs(axis.context.minValue) * (grid.context.width /
|
||||
(Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
|
||||
);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = GetAxisLineXOrY();
|
||||
axis.context.zeroY = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x - (float) (axis.context.minValue * grid.context.width / axis.context.minMaxRange);
|
||||
axis.UpdateZeroOffset(grid.context.width);
|
||||
}
|
||||
if (grid != null && axis is YAxis && axis.IsValue())
|
||||
{
|
||||
axis.context.offset = axis.context.minValue > 0 ?
|
||||
0 :
|
||||
(axis.context.maxValue < 0 ?
|
||||
grid.context.height :
|
||||
(float) (Math.Abs(axis.context.minValue) * (grid.context.height /
|
||||
(Math.Abs(axis.context.minValue) + Math.Abs(axis.context.maxValue))))
|
||||
);
|
||||
axis.context.x = GetAxisLineXOrY();
|
||||
axis.context.y = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x;
|
||||
axis.context.zeroY = grid.context.y - (float) (axis.context.minValue * grid.context.height / axis.context.minMaxRange);
|
||||
axis.UpdateZeroOffset(grid.context.height);
|
||||
}
|
||||
}
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
if (dataZoom != null && dataZoom.enable)
|
||||
{
|
||||
if (axis is XAxis)
|
||||
dataZoom.SetXAxisIndexValueInfo(axisIndex, tempMinValue, tempMaxValue);
|
||||
else
|
||||
dataZoom.SetYAxisIndexValueInfo(axisIndex, tempMinValue, tempMaxValue);
|
||||
}
|
||||
|
||||
if (updateChart)
|
||||
{
|
||||
UpdateAxisLabelText(axis);
|
||||
@@ -223,8 +205,8 @@ namespace XCharts
|
||||
if (axis.IsTime())
|
||||
{
|
||||
var lastCount = axis.context.labelValueList.Count;
|
||||
DateTimeUtil.UpdateTimeAxisDateTimeList(axis.context.labelValueList, (int) axis.context.minValue,
|
||||
(int) axis.context.maxValue, axis.splitNumber);
|
||||
axis.context.tickValue = DateTimeUtil.UpdateTimeAxisDateTimeList(axis.context.labelValueList,
|
||||
(int) axis.context.minValue, (int) axis.context.maxValue, axis.splitNumber);
|
||||
|
||||
if (axis.context.labelValueList.Count != lastCount)
|
||||
axis.SetAllDirty();
|
||||
@@ -258,6 +240,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
var value = 0d;
|
||||
axis.context.tickValue = tick;
|
||||
if (Mathf.Approximately((float) (axis.context.minValue % tick), 0))
|
||||
{
|
||||
value = axis.context.minValue;
|
||||
@@ -313,12 +296,12 @@ namespace XCharts
|
||||
if (i == 0)
|
||||
{
|
||||
var dist = GetLabelPosition(0, 1).x - pos.x;
|
||||
label.SetTextActive(dist > label.text.GetPreferredWidth());
|
||||
label.SetTextActive(axis.IsNeedShowLabel(i) && dist > label.text.GetPreferredWidth());
|
||||
}
|
||||
else if (i == axis.context.labelValueList.Count - 1)
|
||||
{
|
||||
var dist = pos.x - GetLabelPosition(0, i - 1).x;
|
||||
label.SetTextActive(dist > label.text.GetPreferredWidth());
|
||||
label.SetTextActive(axis.IsNeedShowLabel(i) && dist > label.text.GetPreferredWidth());
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -326,12 +309,12 @@ namespace XCharts
|
||||
if (i == 0)
|
||||
{
|
||||
var dist = GetLabelPosition(0, 1).y - pos.y;
|
||||
label.SetTextActive(dist > label.text.GetPreferredHeight());
|
||||
label.SetTextActive(axis.IsNeedShowLabel(i) && dist > label.text.GetPreferredHeight());
|
||||
}
|
||||
else if (i == axis.context.labelValueList.Count - 1)
|
||||
{
|
||||
var dist = pos.y - GetLabelPosition(0, i - 1).y;
|
||||
label.SetTextActive(dist > label.text.GetPreferredHeight());
|
||||
label.SetTextActive(axis.IsNeedShowLabel(i) && dist > label.text.GetPreferredHeight());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -579,24 +562,29 @@ namespace XCharts
|
||||
if (AxisHelper.NeedShowSplit(axis))
|
||||
{
|
||||
var size = AxisHelper.GetScaleNumber(axis, axisLength, dataZoom);
|
||||
|
||||
var current = orient == Orient.Horizonal ?
|
||||
startX :
|
||||
startY;
|
||||
|
||||
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 = orient == Orient.Horizonal ? startX : startY;
|
||||
var maxAxisXY = current + axisLength;
|
||||
var lastTickX = current;
|
||||
var lastTickY = current;
|
||||
var minorTickSplitNumber = axis.minorTick.splitNumber <= 0 ? 5 : axis.minorTick.splitNumber;
|
||||
var minorTickDistance = axis.GetValueLength(axis.context.tickValue / minorTickSplitNumber, axisLength);
|
||||
var minorTickColor = axis.minorTick.GetColor(theme.tickColor);
|
||||
var minorTickWidth = axis.minorTick.GetWidth(theme.tickWidth);
|
||||
var minorTickLength = axis.minorTick.GetLength(theme.tickLength * 0.6f);
|
||||
var minorStartIndex = axis.IsTime() ? 0 : 1;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);
|
||||
if (i == 0 && (!axis.axisTick.showStartTick || axis.axisTick.alignWithLabel))
|
||||
{
|
||||
current += scaleWidth;
|
||||
continue;
|
||||
}
|
||||
if (i == size - 1 && !axis.axisTick.showEndTick)
|
||||
{
|
||||
current += scaleWidth;
|
||||
continue;
|
||||
}
|
||||
var hideTick = (i == 0 && (!axis.axisTick.showStartTick || axis.axisTick.alignWithLabel)) ||
|
||||
(i == size - 1 && !axis.axisTick.showEndTick);
|
||||
if (axis.axisTick.show)
|
||||
{
|
||||
if (orient == Orient.Horizonal)
|
||||
@@ -610,21 +598,53 @@ namespace XCharts
|
||||
|
||||
var sY = 0f;
|
||||
var eY = 0f;
|
||||
var mY = 0f;
|
||||
if ((axis.axisTick.inside && axis.IsBottom()) ||
|
||||
(!axis.axisTick.inside && axis.IsTop()))
|
||||
{
|
||||
sY = startY + lineWidth;
|
||||
eY = sY + tickLength;
|
||||
mY = sY + minorTickLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
sY = startY - lineWidth;
|
||||
eY = sY - tickLength;
|
||||
mY = sY - minorTickLength;
|
||||
}
|
||||
|
||||
UGL.DrawLine(vh, new Vector3(pX, sY), new Vector3(pX, eY),
|
||||
axis.axisTick.GetWidth(theme.tickWidth),
|
||||
axis.axisTick.GetColor(theme.tickColor));
|
||||
if (!hideTick)
|
||||
UGL.DrawLine(vh, new Vector3(pX, sY), new Vector3(pX, eY), tickWidth, tickColor);
|
||||
if (axis.minorTick.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
{
|
||||
if (lastTickX <= axis.context.zeroX || (i == minorStartIndex && pX > axis.context.zeroX))
|
||||
{
|
||||
var tickTotal = pX - minorTickDistance;
|
||||
while (tickTotal > lastTickX)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(tickTotal, sY), new Vector3(tickTotal, mY), minorTickWidth, minorTickColor);
|
||||
tickTotal -= minorTickDistance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var tickTotal = lastTickX + minorTickDistance;
|
||||
while (tickTotal < pX)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(tickTotal, sY), new Vector3(tickTotal, mY), minorTickWidth, minorTickColor);
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
if (i == size - 1)
|
||||
{
|
||||
var tickTotal = pX + minorTickDistance;
|
||||
while (tickTotal < maxAxisXY)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(tickTotal, sY), new Vector3(tickTotal, mY), minorTickWidth, minorTickColor);
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastTickX = pX;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -637,21 +657,55 @@ namespace XCharts
|
||||
|
||||
var sX = 0f;
|
||||
var eX = 0f;
|
||||
var mX = 0f;
|
||||
if ((axis.axisTick.inside && axis.IsLeft()) ||
|
||||
(!axis.axisTick.inside && axis.IsRight()))
|
||||
{
|
||||
sX = startX + lineWidth;
|
||||
eX = sX + tickLength;
|
||||
mX = sX + minorTickLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
sX = startX - lineWidth;
|
||||
eX = sX - tickLength;
|
||||
mX = sX - minorTickLength;
|
||||
}
|
||||
if (!hideTick)
|
||||
UGL.DrawLine(vh, new Vector3(sX, pY), new Vector3(eX, pY), tickWidth, tickColor);
|
||||
if (axis.minorTick.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
{
|
||||
if (lastTickY <= axis.context.zeroY || (i == minorStartIndex && pY > axis.context.zeroY))
|
||||
{
|
||||
var tickTotal = pY - minorTickDistance;
|
||||
while (tickTotal > lastTickY)
|
||||
{
|
||||
|
||||
UGL.DrawLine(vh, new Vector3(sX, pY), new Vector3(eX, pY),
|
||||
axis.axisTick.GetWidth(theme.tickWidth),
|
||||
axis.axisTick.GetColor(theme.tickColor));
|
||||
UGL.DrawLine(vh, new Vector3(sX, tickTotal), new Vector3(mX, tickTotal), minorTickWidth, minorTickColor);
|
||||
tickTotal -= minorTickDistance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var tickTotal = lastTickY + minorTickDistance;
|
||||
while (tickTotal < pY)
|
||||
{
|
||||
|
||||
UGL.DrawLine(vh, new Vector3(sX, tickTotal), new Vector3(mX, tickTotal), minorTickWidth, minorTickColor);
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
if (i == size - 1)
|
||||
{
|
||||
var tickTotal = pY + minorTickDistance;
|
||||
while (tickTotal < maxAxisXY)
|
||||
{
|
||||
UGL.DrawLine(vh, new Vector3(sX, tickTotal), new Vector3(mX, tickTotal), minorTickWidth, minorTickColor);
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastTickY = pY;
|
||||
}
|
||||
}
|
||||
current += scaleWidth;
|
||||
@@ -705,9 +759,12 @@ namespace XCharts
|
||||
}
|
||||
|
||||
protected void DrawAxisSplit(VertexHelper vh, AxisTheme theme, DataZoom dataZoom,
|
||||
Orient orient, float startX, float startY, float axisLength, float splitLength, Axis relativedAxis = null)
|
||||
Orient orient, float startX, float startY, float axisLength, float splitLength,
|
||||
Axis relativedAxis = null)
|
||||
{
|
||||
Axis axis = component;
|
||||
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);
|
||||
@@ -720,9 +777,16 @@ namespace XCharts
|
||||
size += 1;
|
||||
}
|
||||
|
||||
var current = orient == Orient.Horizonal ?
|
||||
startX :
|
||||
startY;
|
||||
var current = orient == Orient.Horizonal ? startX : startY;
|
||||
var maxAxisXY = current + axisLength;
|
||||
var lastSplitX = 0f;
|
||||
var lastSplitY = 0f;
|
||||
var minorTickSplitNumber = axis.minorTick.splitNumber <= 0 ? 5 : axis.minorTick.splitNumber;
|
||||
var minorTickDistance = axis.GetValueLength(axis.context.tickValue / minorTickSplitNumber, axisLength);
|
||||
var minorSplitLineColor = axis.minorSplitLine.GetColor(theme.minorSplitLineColor);
|
||||
var minorLineWidth = axis.minorSplitLine.GetWidth(theme.lineWidth);
|
||||
var minorLineType = axis.minorSplitLine.GetType(theme.splitLineType);
|
||||
var minorStartIndex = axis.IsTime() ? 0 : 1;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
var scaleWidth = AxisHelper.GetScaleWidth(axis, axisLength, axis.IsTime() ? i : i + 1, dataZoom);
|
||||
@@ -750,7 +814,6 @@ namespace XCharts
|
||||
new Vector2(startX, current + scaleWidth),
|
||||
axis.splitArea.GetColor(i, theme));
|
||||
}
|
||||
|
||||
}
|
||||
if (axis.splitLine.show)
|
||||
{
|
||||
@@ -758,23 +821,131 @@ namespace XCharts
|
||||
{
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, GetAxisLineXOrY()))
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.x))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
lineType,
|
||||
lineWidth,
|
||||
new Vector3(current, startY),
|
||||
new Vector3(current, startY + splitLength),
|
||||
lineColor);
|
||||
}
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
{
|
||||
if (lastSplitX <= axis.context.zeroX || (i == minorStartIndex && current > axis.context.zeroX))
|
||||
{
|
||||
var tickTotal = current - minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal > lastSplitX && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(tickTotal, startY),
|
||||
new Vector3(tickTotal, startY + splitLength),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal -= minorTickDistance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var tickTotal = lastSplitX + minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(tickTotal, startY),
|
||||
new Vector3(tickTotal, startY + splitLength),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
if (i == size - 1)
|
||||
{
|
||||
var tickTotal = current + minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal < maxAxisXY && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(tickTotal, startY),
|
||||
new Vector3(tickTotal, startY + splitLength),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastSplitX = current;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, GetAxisLineXOrY()))
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.y))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
lineType,
|
||||
lineWidth,
|
||||
new Vector3(startX, current),
|
||||
new Vector3(startX + splitLength, current),
|
||||
lineColor);
|
||||
}
|
||||
if (axis.minorSplitLine.show && i >= minorStartIndex && minorTickDistance > 0)
|
||||
{
|
||||
if (lastSplitY <= axis.context.zeroY || (i == minorStartIndex && current > axis.context.zeroY))
|
||||
{
|
||||
var tickTotal = current - minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal > lastSplitY && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(startX, tickTotal),
|
||||
new Vector3(startX + splitLength, tickTotal),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal -= minorTickDistance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var tickTotal = lastSplitY + minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal < current && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(startX, tickTotal),
|
||||
new Vector3(startX + splitLength, tickTotal),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
if (i == size - 1)
|
||||
{
|
||||
var tickTotal = current + minorTickDistance;
|
||||
var count = 0;
|
||||
while (tickTotal < maxAxisXY && count < minorTickSplitNumber - 1)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
minorLineType,
|
||||
minorLineWidth,
|
||||
new Vector3(startX, tickTotal),
|
||||
new Vector3(startX + splitLength, tickTotal),
|
||||
minorSplitLineColor);
|
||||
count++;
|
||||
tickTotal += minorTickDistance;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastSplitY = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,8 +338,7 @@ namespace XCharts.Runtime
|
||||
axis.splitNumber = (minSplit > 0 && maxSplit > 0) ? (maxSplit + minSplit - 1) : (maxSplit + minSplit);
|
||||
return;
|
||||
}
|
||||
if (axis.type == Axis.AxisType.Time)
|
||||
{ }
|
||||
if (axis.type == Axis.AxisType.Time) { }
|
||||
else if (axis.minMaxType == Axis.AxisMinMaxType.Custom)
|
||||
{
|
||||
if (axis.min != 0 || axis.max != 0)
|
||||
@@ -363,8 +362,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
case Axis.AxisMinMaxType.Default:
|
||||
|
||||
if (minValue == 0 && maxValue == 0)
|
||||
{ }
|
||||
if (minValue == 0 && maxValue == 0) { }
|
||||
else if (minValue > 0 && maxValue > 0)
|
||||
{
|
||||
minValue = 0;
|
||||
@@ -557,5 +555,43 @@ namespace XCharts.Runtime
|
||||
yDataHig;
|
||||
}
|
||||
}
|
||||
|
||||
public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)
|
||||
{
|
||||
if (axis is XAxis)
|
||||
return GetXAxisXOrY(grid, axis, relativedAxis);
|
||||
else if (axis is YAxis)
|
||||
return GetYAxisXOrY(grid, axis, relativedAxis);
|
||||
else if (axis is SingleAxis)
|
||||
return axis.context.y + axis.offset;
|
||||
else if (axis is ParallelAxis)
|
||||
return axis.context.y;
|
||||
else
|
||||
return axis.context.x;
|
||||
}
|
||||
|
||||
public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)
|
||||
{
|
||||
var startY = grid.context.y + xAxis.offset;
|
||||
if (xAxis.IsTop())
|
||||
startY += grid.context.height;
|
||||
else if (xAxis.axisLine.onZero && relativedAxis.IsValue() && relativedAxis.gridIndex == xAxis.gridIndex)
|
||||
startY += relativedAxis.context.offset;
|
||||
return startY;
|
||||
}
|
||||
|
||||
public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)
|
||||
{
|
||||
var startX = grid.context.x + yAxis.offset;
|
||||
if (yAxis.IsRight())
|
||||
startX += grid.context.width;
|
||||
else if (yAxis.axisLine.onZero && relativedAxis.IsValue() && relativedAxis.gridIndex == yAxis.gridIndex)
|
||||
startX += relativedAxis.context.offset;
|
||||
return startX;
|
||||
}
|
||||
|
||||
public static void UpdateAxisOffset(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Runtime/Component/Axis/AxisMinorSplitLine.cs
Normal file
62
Runtime/Component/Axis/AxisMinorSplitLine.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Minor split line of axis in grid area.
|
||||
/// |坐标轴在 grid 区域中的次分隔线。次分割线会对齐次刻度线 minorTick。
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class AxisMinorSplitLine : BaseLine
|
||||
{
|
||||
[SerializeField] private float m_Distance;
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the split line and axis line.
|
||||
/// |刻度线与轴线的距离。
|
||||
/// </summary>
|
||||
public float distance { get { return m_Distance; } set { m_Distance = value; } }
|
||||
/// <summary>
|
||||
/// auto color.
|
||||
/// |自动设置颜色。
|
||||
/// </summary>
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
m_LineStyle.ClearVerticesDirty();
|
||||
}
|
||||
public static AxisMinorSplitLine defaultMinorSplitLine
|
||||
{
|
||||
get
|
||||
{
|
||||
return new AxisMinorSplitLine()
|
||||
{
|
||||
m_Show = false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public AxisMinorSplitLine Clone()
|
||||
{
|
||||
var axisSplitLine = new AxisMinorSplitLine();
|
||||
axisSplitLine.show = show;
|
||||
axisSplitLine.distance = distance;
|
||||
axisSplitLine.autoColor = autoColor;
|
||||
axisSplitLine.lineStyle = lineStyle.Clone();
|
||||
return axisSplitLine;
|
||||
}
|
||||
|
||||
public void Copy(AxisMinorSplitLine splitLine)
|
||||
{
|
||||
base.Copy(splitLine);
|
||||
distance = splitLine.distance;
|
||||
autoColor = splitLine.autoColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7de9b5e4c5d474fdd88ebb89f0924305
|
||||
guid: 7be5a277811c64887a121d7711929aab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
63
Runtime/Component/Axis/AxisMinorTick.cs
Normal file
63
Runtime/Component/Axis/AxisMinorTick.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Settings related to axis minor tick.
|
||||
/// |坐标轴次刻度相关设置。注意:次刻度无法在类目轴中使用。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class AxisMinorTick : BaseLine
|
||||
{
|
||||
[SerializeField] protected int m_SplitNumber = 5;
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
|
||||
/// <summary>
|
||||
/// Number of segments that the axis is split into.
|
||||
/// |分隔线之间分割的刻度数。
|
||||
/// </summary>
|
||||
public int splitNumber
|
||||
{
|
||||
get { return m_SplitNumber; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SplitNumber, value)) SetAllDirty(); }
|
||||
}
|
||||
public bool autoColor { get { return m_AutoColor; } set { m_AutoColor = value; } }
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
m_LineStyle.ClearVerticesDirty();
|
||||
}
|
||||
public static AxisMinorTick defaultMinorTick
|
||||
{
|
||||
get
|
||||
{
|
||||
var tick = new AxisMinorTick
|
||||
{
|
||||
m_Show = false
|
||||
};
|
||||
return tick;
|
||||
}
|
||||
}
|
||||
|
||||
public AxisMinorTick Clone()
|
||||
{
|
||||
var axisTick = new AxisMinorTick();
|
||||
axisTick.show = show;
|
||||
axisTick.splitNumber = splitNumber;
|
||||
axisTick.autoColor = autoColor;
|
||||
axisTick.lineStyle = lineStyle.Clone();
|
||||
return axisTick;
|
||||
}
|
||||
|
||||
public void Copy(AxisMinorTick axisTick)
|
||||
{
|
||||
show = axisTick.show;
|
||||
splitNumber = axisTick.splitNumber;
|
||||
autoColor = axisTick.autoColor;
|
||||
lineStyle.Copy(axisTick.lineStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0d9ff3b8e09d464e9b5ea996b941314
|
||||
guid: 3bea237f1eccc409ba2635e6f4ca609c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -116,7 +116,6 @@ namespace XCharts.Runtime
|
||||
return;
|
||||
|
||||
var dataZoom = chart.GetDataZoomOfAxis(axis);
|
||||
|
||||
DrawAxisSplit(vh, chart.theme.axis, dataZoom,
|
||||
m_Orient,
|
||||
axis.context.x,
|
||||
@@ -159,7 +158,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected override float GetAxisLineXOrY()
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
return component.context.y;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace XCharts.Runtime
|
||||
|
||||
if (!polar.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
axis.context.pointerValue = double.NaN;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected override float GetAxisLineXOrY()
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
return component.context.y + component.offset;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -21,11 +21,25 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void DrawBase(VertexHelper vh)
|
||||
{
|
||||
UpdatePosition(component);
|
||||
DrawXAxisSplit(vh, component);
|
||||
DrawXAxisLine(vh, component);
|
||||
DrawXAxisTick(vh, component);
|
||||
}
|
||||
|
||||
private void UpdatePosition(XAxis axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<YAxis>(axis.gridIndex);
|
||||
axis.context.x = grid.context.x;
|
||||
axis.context.y = AxisHelper.GetXAxisXOrY(grid, axis, relativedAxis);
|
||||
axis.context.zeroY = grid.context.y;
|
||||
axis.context.zeroX = grid.context.x + axis.context.offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitXAxis(XAxis xAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
@@ -137,16 +151,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected override float GetAxisLineXOrY()
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
var xAxis = component;
|
||||
var grid = chart.GetChartComponent<GridCoord>(xAxis.gridIndex);
|
||||
var startY = grid.context.y + xAxis.offset;
|
||||
if (xAxis.IsTop())
|
||||
startY += grid.context.height;
|
||||
else
|
||||
startY += ComponentHelper.GetXAxisOnZeroOffset(chart.components, xAxis);
|
||||
return startY;
|
||||
return component.context.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,25 @@ namespace XCharts.Runtime
|
||||
|
||||
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(YAxis axis)
|
||||
{
|
||||
var grid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||
if (grid != null)
|
||||
{
|
||||
var relativedAxis = chart.GetChartComponent<XAxis>(axis.gridIndex);
|
||||
axis.context.x = AxisHelper.GetYAxisXOrY(grid, axis, relativedAxis);
|
||||
axis.context.y = grid.context.y;
|
||||
axis.context.zeroX = axis.context.x;
|
||||
axis.context.zeroY = axis.context.y + axis.context.offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitYAxis(YAxis yAxis)
|
||||
{
|
||||
var theme = chart.theme;
|
||||
@@ -135,16 +149,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
protected override float GetAxisLineXOrY()
|
||||
internal override float GetAxisLineXOrY()
|
||||
{
|
||||
var yAxis = component;
|
||||
var grid = chart.GetChartComponent<GridCoord>(yAxis.gridIndex);
|
||||
var startX = grid.context.x + yAxis.offset;
|
||||
if (yAxis.IsRight())
|
||||
startX += grid.context.width;
|
||||
else
|
||||
startX += ComponentHelper.GetYAxisOnZeroOffset(chart.components, yAxis);
|
||||
return startX;
|
||||
return component.context.x;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,8 +37,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private Color32 m_Color;
|
||||
[SerializeField] private Color32 m_ToColor;
|
||||
[SerializeField][Range(0, 1)] private float m_Opacity = 0.6f;
|
||||
[SerializeField] private Color32 m_HighlightColor;
|
||||
[SerializeField] private Color32 m_HighlightToColor;
|
||||
[SerializeField][Since("v3.2.0")] private bool m_InnerFill;
|
||||
|
||||
/// <summary>
|
||||
/// Set this to false to prevent the areafrom showing.
|
||||
@@ -86,22 +85,13 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_Opacity, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the color of area,default use serie color.
|
||||
/// |高亮时区域填充的颜色,如果highlightToColor不是默认值,则表示渐变色的起点颜色。
|
||||
/// Whether to fill only polygonal areas. Currently, only convex polygons are supported.
|
||||
/// |是否只填充多边形区域。目前只支持凸多边形。
|
||||
/// </summary>
|
||||
public Color32 highlightColor
|
||||
public bool innerFill
|
||||
{
|
||||
get { return m_HighlightColor; }
|
||||
set { if (PropertyUtil.SetColor(ref m_HighlightColor, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gradient color, start highlightColor to highlightToColor.
|
||||
/// |高亮时渐变色的终点颜色。
|
||||
/// </summary>
|
||||
public Color32 highlightToColor
|
||||
{
|
||||
get { return m_HighlightToColor; }
|
||||
set { if (PropertyUtil.SetColor(ref m_HighlightToColor, value)) SetVerticesDirty(); }
|
||||
get { return m_InnerFill; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_InnerFill, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public Color32 GetColor()
|
||||
|
||||
@@ -34,12 +34,9 @@ namespace XCharts.Runtime
|
||||
public class SerieSymbol : SymbolStyle, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private SymbolSizeType m_SizeType = SymbolSizeType.Custom;
|
||||
[SerializeField] private float m_SelectedSize = 0f;
|
||||
[SerializeField] private int m_DataIndex = 1;
|
||||
[SerializeField] private float m_DataScale = 1;
|
||||
[SerializeField] private float m_SelectedDataScale = 1.5f;
|
||||
[SerializeField] private SymbolSizeFunction m_SizeFunction;
|
||||
[SerializeField] private SymbolSizeFunction m_SelectedSizeFunction;
|
||||
[SerializeField] private int m_StartIndex;
|
||||
[SerializeField] private int m_Interval;
|
||||
[SerializeField] private bool m_ForceShowLast = false;
|
||||
@@ -49,12 +46,9 @@ namespace XCharts.Runtime
|
||||
{
|
||||
base.Reset();
|
||||
m_SizeType = SymbolSizeType.Custom;
|
||||
m_SelectedSize = 0f;
|
||||
m_DataIndex = 1;
|
||||
m_DataScale = 1;
|
||||
m_SelectedDataScale = 1.5f;
|
||||
m_SizeFunction = null;
|
||||
m_SelectedSizeFunction = null;
|
||||
m_StartIndex = 0;
|
||||
m_Interval = 0;
|
||||
m_ForceShowLast = false;
|
||||
@@ -71,15 +65,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_SizeType, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the size of selected symbol.
|
||||
/// |被选中的标记的大小。
|
||||
/// </summary>
|
||||
public float selectedSize
|
||||
{
|
||||
get { return m_SelectedSize; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedSize, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// whitch data index is when the sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的数据源索引。
|
||||
/// </summary>
|
||||
@@ -98,15 +83,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_DataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the scale of selected data when sizeType assined as FromData.
|
||||
/// |当sizeType指定为FromData时,指定的高亮倍数系数。
|
||||
/// </summary>
|
||||
public float selectedDataScale
|
||||
{
|
||||
get { return m_SelectedDataScale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_SelectedDataScale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的委托函数。
|
||||
/// </summary>
|
||||
@@ -116,15 +92,6 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetClass(ref m_SizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the function of size when sizeType assined as Function.
|
||||
/// |当sizeType指定为Function时,指定的高亮委托函数。
|
||||
/// </summary>
|
||||
public SymbolSizeFunction selectedSizeFunction
|
||||
{
|
||||
get { return m_SelectedSizeFunction; }
|
||||
set { if (PropertyUtil.SetClass(ref m_SelectedSizeFunction, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// the index start to show symbol.
|
||||
/// |开始显示图形标记的索引。
|
||||
/// </summary>
|
||||
@@ -187,42 +154,6 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据sizeType获得高亮时的标记大小
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public float GetSelectedSize(List<double> data, float themeSelectedSize)
|
||||
{
|
||||
switch (m_SizeType)
|
||||
{
|
||||
case SymbolSizeType.Custom:
|
||||
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
case SymbolSizeType.FromData:
|
||||
|
||||
if (data != null && dataIndex >= 0 && dataIndex < data.Count)
|
||||
{
|
||||
return (float) data[dataIndex] * m_SelectedDataScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
|
||||
case SymbolSizeType.Function:
|
||||
|
||||
if (data != null && selectedSizeFunction != null)
|
||||
return selectedSizeFunction(data);
|
||||
else
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
|
||||
default:
|
||||
return selectedSize == 0 ? themeSelectedSize : selectedSize;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSymbol(int dataIndex, int dataCount)
|
||||
{
|
||||
if (!show)
|
||||
|
||||
@@ -366,6 +366,8 @@ namespace XCharts.Runtime
|
||||
|
||||
class AxisIndexValueInfo
|
||||
{
|
||||
public double rawMin;
|
||||
public double rawMax;
|
||||
public double min;
|
||||
public double max;
|
||||
}
|
||||
@@ -617,38 +619,36 @@ namespace XCharts.Runtime
|
||||
context.height = chartHeight - runtimeTop - runtimeBottom;
|
||||
}
|
||||
|
||||
internal void SetXAxisIndexValueInfo(int xAxisIndex, double min, double max)
|
||||
internal void SetXAxisIndexValueInfo(int xAxisIndex, ref double min, ref double max)
|
||||
{
|
||||
if (!m_XAxisIndexInfos.ContainsKey(xAxisIndex))
|
||||
AxisIndexValueInfo info;
|
||||
if (!m_XAxisIndexInfos.TryGetValue(xAxisIndex, out info))
|
||||
{
|
||||
m_XAxisIndexInfos[xAxisIndex] = new AxisIndexValueInfo()
|
||||
{
|
||||
min = min,
|
||||
max = max
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
m_XAxisIndexInfos[xAxisIndex].min = min;
|
||||
m_XAxisIndexInfos[xAxisIndex].max = max;
|
||||
info = new AxisIndexValueInfo();
|
||||
m_XAxisIndexInfos[xAxisIndex] = info;
|
||||
}
|
||||
info.rawMin = min;
|
||||
info.rawMax = max;
|
||||
info.min = min + (max - min) * start / 100;
|
||||
info.max = min + (max - min) * end / 100;
|
||||
min = info.min;
|
||||
max = info.max;
|
||||
}
|
||||
|
||||
internal void SetYAxisIndexValueInfo(int yAxisIndex, double min, double max)
|
||||
internal void SetYAxisIndexValueInfo(int yAxisIndex, ref double min, ref double max)
|
||||
{
|
||||
if (!m_YAxisIndexInfos.ContainsKey(yAxisIndex))
|
||||
AxisIndexValueInfo info;
|
||||
if (!m_YAxisIndexInfos.TryGetValue(yAxisIndex, out info))
|
||||
{
|
||||
m_YAxisIndexInfos[yAxisIndex] = new AxisIndexValueInfo()
|
||||
{
|
||||
min = min,
|
||||
max = max
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
m_YAxisIndexInfos[yAxisIndex].min = min;
|
||||
m_YAxisIndexInfos[yAxisIndex].max = max;
|
||||
info = new AxisIndexValueInfo();
|
||||
m_YAxisIndexInfos[yAxisIndex] = info;
|
||||
}
|
||||
info.rawMin = min;
|
||||
info.rawMax = max;
|
||||
info.min = min + (max - min) * start / 100;
|
||||
info.max = min + (max - min) * end / 100;
|
||||
min = info.min;
|
||||
max = info.max;
|
||||
}
|
||||
|
||||
internal bool IsXAxisIndexValue(int axisIndex)
|
||||
@@ -663,24 +663,32 @@ namespace XCharts.Runtime
|
||||
|
||||
internal void GetXAxisIndexValue(int axisIndex, out double min, out double max)
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
if (m_XAxisIndexInfos.ContainsKey(axisIndex))
|
||||
AxisIndexValueInfo info;
|
||||
if (m_XAxisIndexInfos.TryGetValue(axisIndex, out info))
|
||||
{
|
||||
var info = m_XAxisIndexInfos[axisIndex];
|
||||
min = info.min;
|
||||
max = info.max;
|
||||
var range = info.rawMax - info.rawMin;
|
||||
min = info.rawMin + range * m_Start / 100;
|
||||
max = info.rawMin + range * m_End / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
}
|
||||
}
|
||||
internal void GetYAxisIndexValue(int axisIndex, out double min, out double max)
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
if (m_YAxisIndexInfos.ContainsKey(axisIndex))
|
||||
AxisIndexValueInfo info;
|
||||
if (m_YAxisIndexInfos.TryGetValue(axisIndex, out info))
|
||||
{
|
||||
var info = m_YAxisIndexInfos[axisIndex];
|
||||
min = info.min;
|
||||
max = info.max;
|
||||
var range = info.rawMax - info.rawMin;
|
||||
min = info.rawMin + range * m_Start / 100;
|
||||
max = info.rawMin + range * m_End / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 高亮的图形样式和文本标签样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class Emphasis : ChildComponent, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show;
|
||||
[SerializeField] private LabelStyle m_Label = new LabelStyle();
|
||||
[SerializeField] private LabelLine m_LabelLine = new LabelLine();
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Label.Reset();
|
||||
m_LabelLine.Reset();
|
||||
m_ItemStyle.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用高亮样式。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { m_Show = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形文本标签。
|
||||
/// </summary>
|
||||
public LabelStyle label
|
||||
{
|
||||
get { return m_Label; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Label, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形文本引导线样式。
|
||||
/// </summary>
|
||||
public LabelLine labelLine
|
||||
{
|
||||
get { return m_LabelLine; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelLine, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形样式。
|
||||
/// </summary>
|
||||
public ItemStyle itemStyle
|
||||
{
|
||||
get { return m_ItemStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_ItemStyle, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || label.vertsDirty || itemStyle.vertsDirty; } }
|
||||
|
||||
public override bool componentDirty { get { return m_ComponentDirty || label.componentDirty; } }
|
||||
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
label.ClearVerticesDirty();
|
||||
itemStyle.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
label.ClearComponentDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 高亮的图形样式
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class EmphasisItemStyle : ItemStyle, ISerieExtraComponent, ISerieDataComponent
|
||||
{ }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 高亮的标签引导线样式
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class EmphasisLabelLine : LabelLine, ISerieExtraComponent, ISerieDataComponent
|
||||
{ }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// 高亮的标签样式
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class EmphasisLabelStyle : LabelStyle, ISerieExtraComponent, ISerieDataComponent
|
||||
{ }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e025b0f4be6d4141aa08bdad0102aa7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -62,7 +62,7 @@ namespace XCharts.Runtime
|
||||
UpdateRuntimeData(markArea);
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.legendName);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, SerieState.Normal);
|
||||
var areaColor = markArea.itemStyle.GetColor(serieColor);
|
||||
UGL.DrawRectangle(vh, markArea.runtimeRect, areaColor, areaColor);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace XCharts.Runtime
|
||||
var sp = Vector3.zero;
|
||||
var ep = Vector3.zero;
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serie.serieName);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, false);
|
||||
var serieColor = SerieHelper.GetLineColor(serie, null, chart.theme, colorIndex, SerieState.Normal);
|
||||
animation.InitProgress(0, 1f);
|
||||
ResetTempMarkLineGroupData(markLine);
|
||||
if (m_TempGroupData.Count > 0)
|
||||
@@ -242,9 +242,10 @@ namespace XCharts.Runtime
|
||||
private void DrawMarkLineSymbol(VertexHelper vh, SymbolStyle symbol, Serie serie, GridCoord grid, ThemeStyle theme,
|
||||
Vector3 pos, Vector3 startPos, Color32 lineColor)
|
||||
{
|
||||
var tickness = SerieHelper.GetSymbolBorder(serie, null, theme, false);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, null, theme, false);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, null, false);
|
||||
float tickness = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 borderColor;
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out tickness, out cornerRadius, serie, null, chart.theme);
|
||||
chart.DrawClipSymbol(vh, symbol.type, symbol.size, tickness, pos, lineColor, lineColor,
|
||||
ColorUtil.clearColor32, borderColor, symbol.gap, true, cornerRadius, grid, startPos);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cd4074bb11fc40059363dd78b9ee98d
|
||||
guid: ca1088963feb54117bce8be6bceb64de
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
13
Runtime/Component/State/BlurStyle.cs
Normal file
13
Runtime/Component/State/BlurStyle.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurations of blur state.
|
||||
/// |淡出状态样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class BlurStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
|
||||
{ }
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d1095175540449f99bb9da27a5aaf04
|
||||
guid: 4e3f901db80454f89800a84977289535
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
90
Runtime/Component/State/EmphasisStyle.cs
Normal file
90
Runtime/Component/State/EmphasisStyle.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurations of emphasis state.
|
||||
/// |高亮状态样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class EmphasisStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// focus type.
|
||||
/// |聚焦类型。
|
||||
/// </summary>
|
||||
public enum FocusType
|
||||
{
|
||||
/// <summary>
|
||||
/// Do not fade out other data, it's by default.
|
||||
/// |不淡出其它图形,默认使用该配置。
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Only focus (not fade out) the element of the currently highlighted data.
|
||||
/// |只聚焦(不淡出)当前高亮的数据的图形。
|
||||
/// </summary>
|
||||
Self,
|
||||
/// <summary>
|
||||
/// Focus on all elements of the series which the currently highlighted data belongs to.
|
||||
/// |聚焦当前高亮的数据所在的系列的所有图形。
|
||||
/// </summary>
|
||||
Series
|
||||
}
|
||||
/// <summary>
|
||||
/// blur scope.
|
||||
/// |淡出范围。
|
||||
/// </summary>
|
||||
public enum BlurScope
|
||||
{
|
||||
/// <summary>
|
||||
/// coordinate system.
|
||||
/// |淡出范围为坐标系,默认使用该配置。
|
||||
/// </summary>
|
||||
GridCoord,
|
||||
/// <summary>
|
||||
/// series.
|
||||
/// |淡出范围为系列。
|
||||
/// </summary>
|
||||
Series,
|
||||
/// <summary>
|
||||
/// global.
|
||||
/// |淡出范围为全局。
|
||||
/// </summary>
|
||||
Global
|
||||
}
|
||||
|
||||
[SerializeField] private float m_Scale = 1.1f;
|
||||
[SerializeField] private FocusType m_Focus = FocusType.None;
|
||||
[SerializeField] private BlurScope m_BlurScope = BlurScope.GridCoord;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to scale to highlight the data in emphasis state.
|
||||
/// |高亮时的缩放倍数。
|
||||
/// </summary>
|
||||
public float scale
|
||||
{
|
||||
get { return m_Scale; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Scale, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// When the data is highlighted, whether to fade out of other data to focus the highlighted.
|
||||
/// |在高亮图形时,是否淡出其它数据的图形已达到聚焦的效果。
|
||||
/// </summary>
|
||||
public FocusType focus
|
||||
{
|
||||
get { return m_Focus; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Focus, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The range of fade out when focus is enabled.
|
||||
/// |在开启focus的时候,可以通过blurScope配置淡出的范围。
|
||||
/// </summary>
|
||||
public BlurScope blurScope
|
||||
{
|
||||
get { return m_BlurScope; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_BlurScope, value)) SetVerticesDirty(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/State/EmphasisStyle.cs.meta
Normal file
11
Runtime/Component/State/EmphasisStyle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91a31f424478042418811c32bb8aa2d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
13
Runtime/Component/State/SelectStyle.cs
Normal file
13
Runtime/Component/State/SelectStyle.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurations of select state.
|
||||
/// |选中状态样式。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class SelectStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent
|
||||
{ }
|
||||
}
|
||||
11
Runtime/Component/State/SelectStyle.cs.meta
Normal file
11
Runtime/Component/State/SelectStyle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 986a9b6da6fdd48c49a9b665450dd605
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
126
Runtime/Component/State/StateStyle.cs
Normal file
126
Runtime/Component/State/StateStyle.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// the state style of serie.
|
||||
/// |Serie的状态样式。Serie的状态有正常,高亮,淡出,选中四种状态。
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
[Since("v3.2.0")]
|
||||
public class StateStyle : ChildComponent
|
||||
{
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] private LabelStyle m_Label = new LabelStyle();
|
||||
[SerializeField] private LabelLine m_LabelLine = new LabelLine();
|
||||
[SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle();
|
||||
[SerializeField] private AreaStyle m_AreaStyle = new AreaStyle();
|
||||
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Show = false;
|
||||
m_Label.Reset();
|
||||
m_LabelLine.Reset();
|
||||
m_ItemStyle.Reset();
|
||||
m_Symbol.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用高亮样式。
|
||||
/// </summary>
|
||||
public bool show
|
||||
{
|
||||
get { return m_Show; }
|
||||
set { m_Show = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形文本标签。
|
||||
/// </summary>
|
||||
public LabelStyle label
|
||||
{
|
||||
get { return m_Label; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Label, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形文本引导线样式。
|
||||
/// </summary>
|
||||
public LabelLine labelLine
|
||||
{
|
||||
get { return m_LabelLine; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LabelLine, value, true)) SetAllDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 图形样式。
|
||||
/// </summary>
|
||||
public ItemStyle itemStyle
|
||||
{
|
||||
get { return m_ItemStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_ItemStyle, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 折线样式。
|
||||
/// </summary>
|
||||
public LineStyle lineStyle
|
||||
{
|
||||
get { return m_LineStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_LineStyle, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 区域样式。
|
||||
/// </summary>
|
||||
public AreaStyle areaStyle
|
||||
{
|
||||
get { return m_AreaStyle; }
|
||||
set { if (PropertyUtil.SetClass(ref m_AreaStyle, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 标记样式。
|
||||
/// </summary>
|
||||
public SerieSymbol symbol
|
||||
{
|
||||
get { return m_Symbol; }
|
||||
set { if (PropertyUtil.SetClass(ref m_Symbol, value, true)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_VertsDirty ||
|
||||
m_Label.vertsDirty ||
|
||||
m_ItemStyle.vertsDirty ||
|
||||
m_LineStyle.vertsDirty ||
|
||||
m_AreaStyle.vertsDirty ||
|
||||
m_Symbol.vertsDirty;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool componentDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_ComponentDirty ||
|
||||
m_Label.componentDirty;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
m_Label.ClearVerticesDirty();
|
||||
m_ItemStyle.ClearVerticesDirty();
|
||||
m_LineStyle.ClearVerticesDirty();
|
||||
m_AreaStyle.ClearVerticesDirty();
|
||||
m_Symbol.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
m_Label.ClearComponentDirty();
|
||||
m_Symbol.ClearComponentDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Component/State/StateStyle.cs.meta
Normal file
11
Runtime/Component/State/StateStyle.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 921539f841914493a90f748c6c6662dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -250,7 +250,7 @@ namespace XCharts.Runtime
|
||||
public bool ignoreDataShow { get { return m_IgnoreDataShow; } set { m_IgnoreDataShow = value; } }
|
||||
/// <summary>
|
||||
/// The default display character information for ignored data.
|
||||
/// |被忽略数据的默认显示字符信息。
|
||||
/// |被忽略数据的默认显示字符信息。如果设置为空,则表示完全不显示忽略数据。
|
||||
/// </summary>
|
||||
public string ignoreDataDefaultContent { get { return m_IgnoreDataDefaultContent; } set { m_IgnoreDataDefaultContent = value; } }
|
||||
/// <summary>
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace XCharts.Runtime
|
||||
private void SetTooltipIndicatorLabel(Tooltip tooltip, Axis axis, ChartLabel label)
|
||||
{
|
||||
if (label == null) return;
|
||||
if (double.IsPositiveInfinity(axis.context.pointerValue)) return;
|
||||
if (double.IsNaN(axis.context.pointerValue)) return;
|
||||
label.SetActive(true);
|
||||
label.SetTextActive(true);
|
||||
label.SetPosition(axis.context.pointerLabelPosition);
|
||||
@@ -293,7 +293,6 @@ namespace XCharts.Runtime
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
serieData.index = i;
|
||||
serie.context.sortedData.Add(serieData);
|
||||
}
|
||||
serie.context.sortedData.Sort(delegate(SerieData a, SerieData b)
|
||||
@@ -374,7 +373,7 @@ namespace XCharts.Runtime
|
||||
tooltip.context.pointer = chart.pointerPos;
|
||||
|
||||
serie.handler.UpdateTooltipSerieParams(serie.context.pointerItemDataIndex, false, null,
|
||||
tooltip.marker, tooltip.itemFormatter, tooltip.numericFormatter,
|
||||
tooltip.marker, tooltip.itemFormatter, tooltip.numericFormatter, tooltip.ignoreDataDefaultContent,
|
||||
ref tooltip.context.data.param,
|
||||
ref tooltip.context.data.title);
|
||||
TooltipHelper.ResetTooltipParamsByItemFormatter(tooltip, chart);
|
||||
@@ -423,6 +422,7 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerItemDataIndex = dataIndex;
|
||||
serie.handler.UpdateTooltipSerieParams(dataIndex, showCategory, category,
|
||||
tooltip.marker, tooltip.itemFormatter, tooltip.numericFormatter,
|
||||
tooltip.ignoreDataDefaultContent,
|
||||
ref tooltip.context.data.param,
|
||||
ref tooltip.context.data.title);
|
||||
}
|
||||
@@ -489,7 +489,6 @@ namespace XCharts.Runtime
|
||||
|
||||
private void DrawXAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid)
|
||||
{
|
||||
|
||||
var xAxes = chart.GetChartComponents<XAxis>();
|
||||
var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType);
|
||||
var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth);
|
||||
@@ -511,6 +510,8 @@ namespace XCharts.Runtime
|
||||
pX += xAxis.IsCategory() ?
|
||||
(float) (xAxis.context.pointerValue * splitWidth + (xAxis.boundaryGap ? splitWidth / 2 : 0)) :
|
||||
xAxis.GetDistance(xAxis.context.axisTooltipValue, grid.context.width);
|
||||
if (pX < grid.context.x)
|
||||
break;
|
||||
Vector2 sp = new Vector2(pX, grid.context.y);
|
||||
Vector2 ep = new Vector2(pX, grid.context.y + grid.context.height);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme);
|
||||
@@ -528,6 +529,8 @@ namespace XCharts.Runtime
|
||||
float tooltipSplitWid = splitWidth < 1 ? 1 : splitWidth;
|
||||
pX = (float) (grid.context.x + splitWidth * xAxis.context.pointerValue -
|
||||
(xAxis.boundaryGap ? 0 : splitWidth / 2));
|
||||
if (pX < grid.context.x)
|
||||
break;
|
||||
float pY = grid.context.y + grid.context.height;
|
||||
Vector3 p1 = new Vector3(pX, grid.context.y);
|
||||
Vector3 p2 = new Vector3(pX, pY);
|
||||
@@ -570,6 +573,8 @@ namespace XCharts.Runtime
|
||||
case Tooltip.Type.Line:
|
||||
float pY = (float) (grid.context.y + yAxis.context.pointerValue * splitWidth +
|
||||
(yAxis.boundaryGap ? splitWidth / 2 : 0));
|
||||
if (pY < grid.context.y)
|
||||
break;
|
||||
Vector2 sp = new Vector2(grid.context.x, pY);
|
||||
Vector2 ep = new Vector2(grid.context.x + grid.context.width, pY);
|
||||
var lineColor = TooltipHelper.GetLineColor(tooltip, chart.theme);
|
||||
@@ -588,6 +593,8 @@ namespace XCharts.Runtime
|
||||
float pX = grid.context.x + grid.context.width;
|
||||
pY = (float) (grid.context.y + splitWidth * yAxis.context.pointerValue -
|
||||
(yAxis.boundaryGap ? 0 : splitWidth / 2));
|
||||
if (pY < grid.context.y)
|
||||
break;
|
||||
Vector3 p1 = new Vector3(grid.context.x, pY);
|
||||
Vector3 p2 = new Vector3(grid.context.x, pY + tooltipSplitWid);
|
||||
Vector3 p3 = new Vector3(pX, pY + tooltipSplitWid);
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (tooltip == null) return;
|
||||
var data = tooltip.context.data;
|
||||
var ignoreColumn = string.IsNullOrEmpty(tooltip.ignoreDataDefaultContent);
|
||||
|
||||
var titleActive = !string.IsNullOrEmpty(data.title);
|
||||
if (titleActive != title.gameObject.activeSelf)
|
||||
@@ -80,7 +81,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var item = GetItem(i);
|
||||
var param = data.param[i];
|
||||
if (param.columns.Count <= 0)
|
||||
if (param.columns.Count <= 0 || (ignoreColumn && param.ignore))
|
||||
{
|
||||
item.gameObject.SetActive(false);
|
||||
continue;
|
||||
@@ -112,9 +113,6 @@ namespace XCharts.Runtime
|
||||
m_Items[i].gameObject.SetActive(false);
|
||||
}
|
||||
ResetSize();
|
||||
// border.effectColor = data.param.Count == 1
|
||||
// ? data.param[0].color
|
||||
// : tooltip.borderColor;
|
||||
UpdatePosition(tooltip.context.pointer + tooltip.offset);
|
||||
tooltip.gameObject.transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -67,26 +68,35 @@ namespace XCharts.Runtime
|
||||
// }
|
||||
}
|
||||
|
||||
private static void CheckLegend(BaseChart chart, StringBuilder sb)
|
||||
{ }
|
||||
private static void CheckLegend(BaseChart chart, StringBuilder sb) { }
|
||||
|
||||
private static void CheckGrid(BaseChart chart, StringBuilder sb)
|
||||
{ }
|
||||
private static void CheckGrid(BaseChart chart, StringBuilder sb) { }
|
||||
|
||||
private static void CheckSerie(BaseChart chart, StringBuilder sb)
|
||||
{
|
||||
var allDataIsEmpty = true;
|
||||
var allDataIsZero = true;
|
||||
var allSerieIsHide = true;
|
||||
var set = new HashSet<int>();
|
||||
foreach (var serie in chart.series)
|
||||
{
|
||||
if (serie.show) allSerieIsHide = false;
|
||||
if (serie.dataCount > 0)
|
||||
{
|
||||
allDataIsEmpty = false;
|
||||
var dataIndexError = 0;
|
||||
set.Clear();
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.GetSerieData(i);
|
||||
if (set.Contains(serieData.index))
|
||||
{
|
||||
dataIndexError++;
|
||||
}
|
||||
else
|
||||
{
|
||||
set.Add(serieData.index);
|
||||
}
|
||||
for (int j = 1; j < serieData.data.Count; j++)
|
||||
{
|
||||
if (serieData.GetData(j) != 0)
|
||||
@@ -101,6 +111,10 @@ namespace XCharts.Runtime
|
||||
{
|
||||
sb.AppendFormat("warning:serie {0} serieData.data.count[{1}] not match showDataDimension[{2}]\n", serie.index, dataCount, serie.showDataDimension);
|
||||
}
|
||||
if (dataIndexError > 0)
|
||||
{
|
||||
sb.AppendFormat("error: data index error, count={0}/{1}\n", dataIndexError, serie.dataCount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
|
||||
namespace XCharts.Runtime
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
||||
[AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
|
||||
public class Since : Attribute
|
||||
{
|
||||
public readonly string version;
|
||||
|
||||
@@ -172,9 +172,8 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all series and legend data.
|
||||
/// |It just emptying all of serie's data without emptying the list of series.
|
||||
/// |清除所有数据,系列中只是移除数据,列表会保留。
|
||||
/// Clear all components and series data. Note: serie only empties the data and does not remove serie.
|
||||
/// |清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。
|
||||
/// </summary>
|
||||
public virtual void ClearData()
|
||||
{
|
||||
@@ -187,9 +186,10 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all data from series and legend.
|
||||
/// |The series list is also cleared.
|
||||
/// |清除所有系列和图例数据,系列的列表也会被清除。
|
||||
/// Empty all component data and remove all series. Use the chart again and again to tell the truth.
|
||||
/// Note: The component only clears the data part, and the parameters are retained and not reset.
|
||||
/// |清空所有组件数据,并移除所有Serie。一般在图表重新初始化时使用。
|
||||
/// 注意:组件只清空数据部分,参数会保留不会被重置。
|
||||
/// </summary>
|
||||
public virtual void RemoveData()
|
||||
{
|
||||
@@ -201,6 +201,19 @@ namespace XCharts.Runtime
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases.
|
||||
/// |移除所有的Serie。当确认只需要移除Serie时使用该接口,其他情况下一般用RemoveData()。
|
||||
/// </summary>
|
||||
[Since("v3.2.0")]
|
||||
public virtual void RemoveAllSerie()
|
||||
{
|
||||
m_Series.Clear();
|
||||
m_SerieHandlers.Clear();
|
||||
m_CheckAnimation = false;
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove legend and serie by name.
|
||||
/// |清除指定系列名称的数据。
|
||||
@@ -544,17 +557,25 @@ namespace XCharts.Runtime
|
||||
return theme.GetBackgroundColor(background);
|
||||
}
|
||||
|
||||
public Color32 GetItemColor(Serie serie, SerieData serieData, bool highlight = false)
|
||||
public Color32 GetItemColor(Serie serie, SerieData serieData)
|
||||
{
|
||||
var colorIndex = serieData == null || !serie.useDataNameForColor ?
|
||||
GetLegendRealShowNameIndex(serie.legendName) :
|
||||
GetLegendRealShowNameIndex(serieData.legendName);
|
||||
return SerieHelper.GetItemColor(serie, serieData, m_Theme, colorIndex, highlight);
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme);
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetItemColor(Serie serie, bool highlight = false)
|
||||
public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)
|
||||
{
|
||||
return SerieHelper.GetItemColor(serie, null, m_Theme, serie.context.colorIndex, highlight);
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme, colorIndex);
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetItemColor(Serie serie)
|
||||
{
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, null, m_Theme);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,18 @@ namespace XCharts.Runtime
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置serie的数据项索引。避免数据项索引异常。
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
public bool ResetDataIndex(int serieIndex)
|
||||
{
|
||||
var serie = GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
return serie.ResetDataIndex();
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanAddSerie<T>() where T : Serie
|
||||
{
|
||||
return CanAddSerie(typeof(T));
|
||||
@@ -129,8 +141,15 @@ namespace XCharts.Runtime
|
||||
for (int i = m_Series.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var serie = m_Series[i];
|
||||
if (string.IsNullOrEmpty(serie.serieName) && serie.serieName.Equals(serieName))
|
||||
if (string.IsNullOrEmpty(serieName))
|
||||
{
|
||||
if (string.IsNullOrEmpty(serie.serieName))
|
||||
RemoveSerie(serie);
|
||||
}
|
||||
else if (serieName.Equals(serie.serieName))
|
||||
{
|
||||
RemoveSerie(serie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -575,6 +575,7 @@ namespace XCharts.Runtime
|
||||
var serie = m_Series[i];
|
||||
serie.context.colorIndex = GetLegendRealShowNameIndex(serie.legendName);
|
||||
serie.context.dataPoints.Clear();
|
||||
serie.context.dataIndexs.Clear();
|
||||
serie.context.dataIgnores.Clear();
|
||||
serie.animation.context.isAllItemAnimationEnd = true;
|
||||
if (!serie.context.pointerEnter)
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public virtual bool vertsDirty { get { return m_VertsDirty; } }
|
||||
public virtual bool componentDirty { get { return m_ComponentDirty; } }
|
||||
public virtual bool useDataNameForColor { get { return false; } }
|
||||
|
||||
public virtual SerieColorBy defaultColorBy { get { return SerieColorBy.Serie; } }
|
||||
public virtual bool titleJustForSerie { get { return false; } }
|
||||
public virtual bool useSortData { get { return false; } }
|
||||
public virtual bool multiDimensionLabel { get { return false; } }
|
||||
@@ -27,6 +28,30 @@ namespace XCharts.Runtime
|
||||
|
||||
public SerieHandler handler { get; set; }
|
||||
|
||||
|
||||
|
||||
public static void ClearVerticesDirty(ChildComponent component)
|
||||
{
|
||||
if (component != null)
|
||||
component.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public static void ClearComponentDirty(ChildComponent component)
|
||||
{
|
||||
if (component != null)
|
||||
component.ClearComponentDirty();
|
||||
}
|
||||
|
||||
public static bool IsVertsDirty(ChildComponent component)
|
||||
{
|
||||
return component == null?false : component.vertsDirty;
|
||||
}
|
||||
|
||||
public static bool IsComponentDirty(ChildComponent component)
|
||||
{
|
||||
return component == null?false : component.componentDirty;
|
||||
}
|
||||
|
||||
public virtual void SetVerticesDirty()
|
||||
{
|
||||
m_VertsDirty = true;
|
||||
@@ -47,8 +72,7 @@ namespace XCharts.Runtime
|
||||
m_ComponentDirty = false;
|
||||
}
|
||||
|
||||
public virtual void ClearData()
|
||||
{ }
|
||||
public virtual void ClearData() { }
|
||||
|
||||
public virtual void ClearDirty()
|
||||
{
|
||||
@@ -68,11 +92,9 @@ namespace XCharts.Runtime
|
||||
handler.RemoveComponent();
|
||||
}
|
||||
|
||||
public virtual void OnDataUpdate()
|
||||
{ }
|
||||
public virtual void OnDataUpdate() { }
|
||||
|
||||
public virtual void OnBeforeSerialize()
|
||||
{ }
|
||||
public virtual void OnBeforeSerialize() { }
|
||||
|
||||
public virtual void OnAfterDeserialize()
|
||||
{
|
||||
|
||||
@@ -28,6 +28,28 @@ namespace XCharts.Runtime
|
||||
public Action refreshComponent { get; set; }
|
||||
public GameObject gameObject { get; set; }
|
||||
|
||||
public static void ClearVerticesDirty(ChildComponent component)
|
||||
{
|
||||
if (component != null)
|
||||
component.ClearVerticesDirty();
|
||||
}
|
||||
|
||||
public static void ClearComponentDirty(ChildComponent component)
|
||||
{
|
||||
if (component != null)
|
||||
component.ClearComponentDirty();
|
||||
}
|
||||
|
||||
public static bool IsVertsDirty(ChildComponent component)
|
||||
{
|
||||
return component == null?false : component.vertsDirty;
|
||||
}
|
||||
|
||||
public static bool IsComponentDirty(ChildComponent component)
|
||||
{
|
||||
return component == null?false : component.componentDirty;
|
||||
}
|
||||
|
||||
public virtual void SetVerticesDirty()
|
||||
{
|
||||
m_VertsDirty = true;
|
||||
|
||||
@@ -195,6 +195,7 @@ namespace XCharts.Runtime
|
||||
SetActive(obj, true);
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localScale = Vector3.one;
|
||||
obj.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
}
|
||||
else if (replaceIndex >= 0 && replaceIndex < parent.childCount)
|
||||
{
|
||||
@@ -209,6 +210,8 @@ namespace XCharts.Runtime
|
||||
obj.transform.SetParent(parent);
|
||||
obj.transform.localScale = Vector3.one;
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||
obj.layer = parent.gameObject.layer;
|
||||
}
|
||||
RectTransform rect = GetOrAddComponent<RectTransform>(obj);
|
||||
rect.localPosition = Vector3.zero;
|
||||
@@ -237,6 +240,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
GameObject txtObj = AddObject(objectName, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||
txtObj.transform.localEulerAngles = new Vector3(0, 0, textStyle.rotate);
|
||||
txtObj.layer = parent.gameObject.layer;
|
||||
if (chartText == null)
|
||||
chartText = new ChartText();
|
||||
#if dUI_TextMeshPro
|
||||
@@ -336,12 +340,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var textStyle = axis.axisLabel.textStyle;
|
||||
var label = AddChartLabel(name, parent, axis.axisLabel, theme, content, autoColor, autoAlignment);
|
||||
var labelShow = axis.axisLabel.show && (axis.axisLabel.interval == 0 || index % (axis.axisLabel.interval + 1) == 0);
|
||||
if (labelShow)
|
||||
{
|
||||
if (!axis.axisLabel.showStartLabel && index == 0) labelShow = false;
|
||||
else if (!axis.axisLabel.showEndLabel && index == total - 1) labelShow = false;
|
||||
}
|
||||
var labelShow = axis.IsNeedShowLabel(index, total);
|
||||
label.UpdateIcon(axis.axisLabel.icon, axis.GetIcon(index));
|
||||
label.text.SetActive(labelShow);
|
||||
return label;
|
||||
@@ -850,6 +849,22 @@ namespace XCharts.Runtime
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public static Color32 GetBlurColor(Color32 color, float a = 0.3f)
|
||||
{
|
||||
var newColor = color;
|
||||
newColor.a = (byte) (a * 255);
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)
|
||||
{
|
||||
var newColor = color;
|
||||
newColor.r = (byte) (color.r * rate);
|
||||
newColor.g = (byte) (color.g * rate);
|
||||
newColor.b = (byte) (color.b * rate);
|
||||
return newColor;
|
||||
}
|
||||
|
||||
public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)
|
||||
{
|
||||
Vector3 v0 = Vector3.Cross(A - D, P - D);
|
||||
|
||||
@@ -56,9 +56,16 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!XChartsMgr.themes.ContainsKey(themeName))
|
||||
{
|
||||
return null;
|
||||
ReloadThemeList();
|
||||
if (XChartsMgr.themes.ContainsKey(themeName))
|
||||
return XChartsMgr.themes[themeName];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return XChartsMgr.themes[themeName];
|
||||
}
|
||||
return XChartsMgr.themes[themeName];
|
||||
}
|
||||
|
||||
public static Theme LoadTheme(ThemeType type)
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace XCharts.Runtime
|
||||
[ExecuteInEditMode]
|
||||
public static class XChartsMgr
|
||||
{
|
||||
public static readonly string version = "3.1.0";
|
||||
public static readonly int versionDate = 20220712;
|
||||
public static readonly string version = "3.2.0";
|
||||
public static readonly int versionDate = 20220815;
|
||||
public static string fullVersion { get { return version + "-" + versionDate; } }
|
||||
|
||||
internal static List<BaseChart> chartList = new List<BaseChart>();
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace XCharts.Runtime
|
||||
[SerieConvert(typeof(Line), typeof(Pie))]
|
||||
[RequireChartComponent(typeof(GridCoord))]
|
||||
[DefaultAnimation(AnimationType.BottomToTop)]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_Ignore")]
|
||||
public class Bar : Serie, INeedSerieContainer
|
||||
{
|
||||
|
||||
@@ -20,11 +20,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
UpdateCoordSerieParams(ref paramList, ref title, dataIndex, showCategory, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent);
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
@@ -81,14 +81,14 @@ namespace XCharts.Runtime
|
||||
return;
|
||||
}
|
||||
m_LastCheckContextFlag = needCheck;
|
||||
Color32 color, toColor;
|
||||
if (m_LegendEnter)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -103,18 +103,14 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerItemDataIndex = serieData.index;
|
||||
serie.context.pointerEnter = true;
|
||||
serieData.context.highlight = true;
|
||||
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
}
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, state);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
}
|
||||
if (needInteract)
|
||||
@@ -180,28 +176,28 @@ namespace XCharts.Runtime
|
||||
for (int i = serie.minShow; i < maxCount; i++)
|
||||
{
|
||||
var serieData = showData[i];
|
||||
serieData.index = i;
|
||||
if (!serieData.show || serie.IsIgnoreValue(serieData))
|
||||
{
|
||||
serie.context.dataPoints.Add(Vector3.zero);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (serieData.IsDataChanged())
|
||||
dataChanging = true;
|
||||
|
||||
var highlight = serieData.context.highlight || serie.highlight;
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight);
|
||||
var state = SerieHelper.GetSerieState(serie, serieData);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, state);
|
||||
var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
|
||||
var relativedValue = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue);
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;
|
||||
var borderGap = relativedValue == 0 ? 0 : itemStyle.borderGap;
|
||||
var borderGapAndWidth = borderWidth + borderGap;
|
||||
var backgroundColor = itemStyle.backgroundColor;
|
||||
|
||||
if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting))
|
||||
{
|
||||
areaColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight);
|
||||
areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight);
|
||||
SerieHelper.GetItemColor(out areaColor, out areaToColor, serie, serieData, chart.theme);
|
||||
serieData.interact.SetColor(ref interacting, areaColor, areaToColor);
|
||||
}
|
||||
|
||||
@@ -232,9 +228,14 @@ namespace XCharts.Runtime
|
||||
Rect.MinMaxRect(plb.x, m_SerieGrid.context.y, prb.x, m_SerieGrid.context.y + relativedAxisLength);
|
||||
|
||||
if (!serie.clip || (serie.clip && m_SerieGrid.Contains(top)))
|
||||
{
|
||||
serie.context.dataPoints.Add(top);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (serie.show && currHig != 0 && !serie.placeHolder)
|
||||
{
|
||||
@@ -242,11 +243,11 @@ namespace XCharts.Runtime
|
||||
{
|
||||
case BarType.Normal:
|
||||
case BarType.Capsule:
|
||||
DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
|
||||
DrawNormalBar(vh, serie, serieData, itemStyle, backgroundColor, gap, barWidth,
|
||||
pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor, relativedValue);
|
||||
break;
|
||||
case BarType.Zebra:
|
||||
DrawZebraBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
|
||||
DrawZebraBar(vh, serie, serieData, itemStyle, backgroundColor, gap, barWidth,
|
||||
pX, pY, plb, plt, prt, prb, isY, m_SerieGrid, axis, areaColor, areaToColor);
|
||||
break;
|
||||
}
|
||||
@@ -366,12 +367,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawNormalBar(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, int colorIndex,
|
||||
bool highlight, float gap, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
||||
private void DrawNormalBar(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, Color32 backgroundColor,
|
||||
float gap, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
||||
Vector3 prb, bool isYAxis, GridCoord grid, Axis axis, Color32 areaColor, Color32 areaToColor, double value)
|
||||
{
|
||||
var borderWidth = itemStyle.runtimeBorderWidth;
|
||||
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, colorIndex, highlight, false);
|
||||
var cornerRadius = serie.barType == BarType.Capsule && !itemStyle.IsNeedCorner() ?
|
||||
m_CapusleDefaultCornerRadius :
|
||||
itemStyle.cornerRadius;
|
||||
@@ -395,11 +395,10 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawZebraBar(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, int colorIndex,
|
||||
bool highlight, float gap, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
||||
private void DrawZebraBar(VertexHelper vh, Serie serie, SerieData serieData, ItemStyle itemStyle, Color32 backgroundColor,
|
||||
float gap, float barWidth, float pX, float pY, Vector3 plb, Vector3 plt, Vector3 prt,
|
||||
Vector3 prb, bool isYAxis, GridCoord grid, Axis axis, Color32 barColor, Color32 barToColor)
|
||||
{
|
||||
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, colorIndex, highlight, false);
|
||||
if (!ChartHelper.IsClearColor(backgroundColor))
|
||||
{
|
||||
UGL.DrawRoundRectangle(vh, serieData.context.backgroundRect, backgroundColor, backgroundColor, 0,
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
UpdateCoordSerieParams(ref paramList, ref title, dataIndex, showCategory, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent);
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
@@ -37,6 +37,7 @@ namespace XCharts.Runtime
|
||||
|
||||
var needCheck = (chart.isPointerInChart && m_SerieGrid.IsPointerEnter()) || m_LegendEnter;
|
||||
var needInteract = false;
|
||||
Color32 color, toColor;
|
||||
if (!needCheck)
|
||||
{
|
||||
if (m_LastCheckContextFlag != needCheck)
|
||||
@@ -46,9 +47,8 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerEnter = false;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, SerieState.Normal);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
if (needInteract)
|
||||
{
|
||||
@@ -63,9 +63,8 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerEnter = true;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, SerieState.Emphasis);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -80,16 +79,14 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerEnter = true;
|
||||
serieData.context.highlight = true;
|
||||
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, true);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, SerieState.Emphasis);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
var barColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var barToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
serieData.interact.SetColor(ref needInteract, barColor, barToColor);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, SerieState.Normal);
|
||||
serieData.interact.SetColor(ref needInteract, color, toColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,6 +152,7 @@ namespace XCharts.Runtime
|
||||
if (!serieData.show || serie.IsIgnoreValue(serieData))
|
||||
{
|
||||
serie.context.dataPoints.Add(Vector3.zero);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -162,15 +160,14 @@ namespace XCharts.Runtime
|
||||
dataChanging = true;
|
||||
|
||||
var highlight = serieData.context.highlight || serie.highlight;
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
var value = axis.IsCategory() ? i : serieData.GetData(0, axis.inverse);
|
||||
var relativedValue = serieData.GetCurrData(1, dataChangeDuration, relativedAxis.inverse, yMinValue, yMaxValue);
|
||||
var borderWidth = relativedValue == 0 ? 0 : itemStyle.runtimeBorderWidth;
|
||||
|
||||
if (!serieData.interact.TryGetColor(ref areaColor, ref areaToColor, ref interacting))
|
||||
{
|
||||
areaColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, highlight);
|
||||
areaToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, highlight);
|
||||
SerieHelper.GetItemColor(out areaColor, out areaToColor, serie, serieData, chart.theme);
|
||||
serieData.interact.SetColor(ref interacting, areaColor, areaToColor);
|
||||
}
|
||||
|
||||
@@ -188,6 +185,7 @@ namespace XCharts.Runtime
|
||||
serieData.context.position = top;
|
||||
serieData.context.rect = Rect.MinMaxRect(plb.x, plb.y, prb.x, prt.y);
|
||||
serie.context.dataPoints.Add(top);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
DrawNormalBar(vh, serie, serieData, itemStyle, colorIndex, highlight, gap, barWidth,
|
||||
pX, pY, plb, plt, prt, prb, false, m_SerieGrid, areaColor, areaToColor);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
[SerieHandler(typeof(CandlestickHandler), true)]
|
||||
[DefaultAnimation(AnimationType.LeftToRight)]
|
||||
[SerieExtraComponent()]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(EmphasisItemStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField()]
|
||||
public class Candlestick : Serie, INeedSerieContainer
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
if (dataIndex < 0)
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Runtime
|
||||
|
||||
title = category;
|
||||
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var color = chart.GetItemColor(serie, serieData);
|
||||
var newMarker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
var newItemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
var newNumericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -111,10 +111,11 @@ namespace XCharts.Runtime
|
||||
if (serie.IsIgnoreValue(serieData))
|
||||
{
|
||||
serie.context.dataPoints.Add(Vector3.zero);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
continue;
|
||||
}
|
||||
var highlight = serie.data[i].context.highlight || serie.highlight;
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, highlight);
|
||||
var state = SerieHelper.GetSerieState(serie, serieData);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, state);
|
||||
var open = serieData.GetCurrData(0, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
|
||||
var close = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
|
||||
var lowest = serieData.GetCurrData(2, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
|
||||
@@ -154,6 +155,7 @@ namespace XCharts.Runtime
|
||||
top = chart.ClampInGrid(grid, top);
|
||||
}
|
||||
serie.context.dataPoints.Add(top);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
var areaColor = isRise ?
|
||||
itemStyle.GetColor(theme.serie.candlestickColor) :
|
||||
itemStyle.GetColor0(theme.serie.candlestickColor0);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
if (dataIndex < 0)
|
||||
@@ -29,7 +29,7 @@ namespace XCharts.Runtime
|
||||
|
||||
title = category;
|
||||
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
var color = chart.GetItemColor(serie, serieData);
|
||||
var newMarker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
var newItemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
var newNumericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -113,6 +113,7 @@ namespace XCharts.Runtime
|
||||
if (serie.IsIgnoreValue(serieData))
|
||||
{
|
||||
serie.context.dataPoints.Add(Vector3.zero);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
continue;
|
||||
}
|
||||
var open = serieData.GetCurrData(0, dataChangeDuration, yAxis.inverse, yMinValue, yMaxValue);
|
||||
@@ -154,6 +155,7 @@ namespace XCharts.Runtime
|
||||
// top = chart.ClampInGrid(grid, top);
|
||||
// }
|
||||
serie.context.dataPoints.Add(top);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
var areaColor = isRise ?
|
||||
itemStyle.GetColor(theme.serie.candlestickColor) :
|
||||
itemStyle.GetColor0(theme.serie.candlestickColor0);
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace XCharts.Runtime
|
||||
[SerieHandler(typeof(HeatmapHandler), true)]
|
||||
[DefaultAnimation(AnimationType.LeftToRight)]
|
||||
[RequireChartComponent(typeof(VisualMap))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField()]
|
||||
public class Heatmap : Serie, INeedSerieContainer
|
||||
{
|
||||
@@ -20,10 +20,11 @@ namespace XCharts.Runtime
|
||||
serie.itemStyle.borderWidth = 1;
|
||||
serie.itemStyle.borderColor = Color.clear;
|
||||
|
||||
var emphasis = serie.AddExtraComponent<EmphasisItemStyle>();
|
||||
var emphasis = serie.AddExtraComponent<EmphasisStyle>();
|
||||
emphasis.show = true;
|
||||
emphasis.borderWidth = 1;
|
||||
emphasis.borderColor = Color.black;
|
||||
emphasis.itemStyle.show = true;
|
||||
emphasis.itemStyle.borderWidth = 1;
|
||||
emphasis.itemStyle.borderColor = Color.black;
|
||||
return serie;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
dataIndex = serie.context.pointerItemDataIndex;
|
||||
@@ -130,7 +130,7 @@ namespace XCharts.Runtime
|
||||
xAxis.boundaryGap = true;
|
||||
yAxis.boundaryGap = true;
|
||||
var visualMap = chart.GetVisualMapOfSerie(serie);
|
||||
var emphasisItemStyle = serie.emphasisItemStyle;
|
||||
var emphasisStyle = serie.emphasisStyle;
|
||||
var xCount = xAxis.data.Count;
|
||||
var yCount = yAxis.data.Count;
|
||||
var xWidth = m_SerieGrid.context.width / xCount;
|
||||
@@ -155,7 +155,6 @@ namespace XCharts.Runtime
|
||||
ChartConst.clearColor32;
|
||||
borderToColor.a = (byte) (borderToColor.a * serie.itemStyle.opacity);
|
||||
|
||||
serie.context.dataPoints.Clear();
|
||||
serie.animation.InitProgress(0, xCount);
|
||||
var animationIndex = serie.animation.GetCurrIndex();
|
||||
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||
@@ -165,13 +164,13 @@ namespace XCharts.Runtime
|
||||
for (int n = 0; n < serie.dataCount; n++)
|
||||
{
|
||||
var serieData = serie.data[n];
|
||||
serieData.index = n;
|
||||
var i = (int) serieData.GetData(0);
|
||||
var j = (int) serieData.GetData(1);
|
||||
var dimension = VisualMapHelper.GetDimension(visualMap, serieData.data.Count);
|
||||
if (serie.IsIgnoreValue(serieData, dimension))
|
||||
{
|
||||
serie.context.dataPoints.Add(Vector3.zero);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
continue;
|
||||
}
|
||||
var value = serieData.GetCurrData(dimension, dataChangeDuration, yAxis.inverse,
|
||||
@@ -180,6 +179,7 @@ namespace XCharts.Runtime
|
||||
var pos = new Vector3(zeroX + (i + (xAxis.boundaryGap ? 0.5f : 0)) * xWidth,
|
||||
zeroY + (j + (yAxis.boundaryGap ? 0.5f : 0)) * yWidth);
|
||||
serie.context.dataPoints.Add(pos);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
serieData.context.position = pos;
|
||||
|
||||
serieData.context.canShowLabel = false;
|
||||
@@ -209,9 +209,10 @@ namespace XCharts.Runtime
|
||||
{
|
||||
UGL.DrawBorder(vh, pos, rectWid, rectHig, borderWidth, borderColor, borderToColor);
|
||||
}
|
||||
if (visualMap.hoverLink && highlight && emphasisItemStyle != null &&
|
||||
emphasisItemStyle.borderWidth > 0)
|
||||
if (visualMap.hoverLink && highlight && emphasisStyle != null &&
|
||||
emphasisStyle.itemStyle.borderWidth > 0)
|
||||
{
|
||||
var emphasisItemStyle = emphasisStyle.itemStyle;
|
||||
var emphasisBorderWidth = emphasisItemStyle.borderWidth;
|
||||
var emphasisBorderColor = emphasisItemStyle.opacity > 0 ?
|
||||
emphasisItemStyle.borderColor : ChartConst.clearColor32;
|
||||
|
||||
@@ -12,15 +12,17 @@ namespace XCharts.Runtime
|
||||
typeof(EndLabelStyle),
|
||||
typeof(LineArrow),
|
||||
typeof(AreaStyle),
|
||||
typeof(EmphasisItemStyle),
|
||||
typeof(EmphasisLabelStyle))]
|
||||
typeof(EmphasisStyle),
|
||||
typeof(BlurStyle),
|
||||
typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(
|
||||
typeof(ItemStyle),
|
||||
typeof(LabelStyle),
|
||||
typeof(SerieSymbol),
|
||||
typeof(EmphasisItemStyle),
|
||||
typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraField("m_Ignore")]
|
||||
typeof(EmphasisStyle),
|
||||
typeof(BlurStyle),
|
||||
typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_State", "m_Ignore")]
|
||||
public class Line : Serie, INeedSerieContainer
|
||||
{
|
||||
public int containerIndex { get; internal set; }
|
||||
|
||||
@@ -56,70 +56,69 @@ namespace XCharts.Runtime
|
||||
}
|
||||
m_LastCheckContextFlag = needCheck;
|
||||
var themeSymbolSize = chart.theme.serie.lineSymbolSize;
|
||||
var themeSymbolSelectedSize = chart.theme.serie.lineSymbolSelectedSize;
|
||||
var needInteract = false;
|
||||
serie.ResetDataIndex();
|
||||
if (m_LegendEnter)
|
||||
{
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
}
|
||||
else if (serie.context.isTriggerByAxis)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, themeSymbolSize);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
if (i == serie.context.pointerItemDataIndex)
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, SerieState.Emphasis);
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
}
|
||||
}
|
||||
else if (serie.context.isTriggerByAxis)
|
||||
{
|
||||
serie.context.pointerEnter = false;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var highlight = i == serie.context.pointerItemDataIndex;
|
||||
serieData.context.highlight = highlight;
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, state);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
if (highlight)
|
||||
{
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
needInteract = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastIndex = serie.context.pointerItemDataIndex;
|
||||
serie.context.pointerItemDataIndex = -1;
|
||||
serie.context.pointerEnter = false;
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
serieData.index = i;
|
||||
var dist = Vector3.Distance(chart.pointerPos, serieData.context.position);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, themeSymbolSize);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
if (dist <= symbolSelectedSize)
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize);
|
||||
var highlight = dist <= size;
|
||||
serieData.context.highlight = highlight;
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, state);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
if (highlight)
|
||||
{
|
||||
serie.context.pointerItemDataIndex = serieData.index;
|
||||
serie.context.pointerEnter = true;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true);
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
serie.context.pointerItemDataIndex = serieData.index;
|
||||
}
|
||||
}
|
||||
if (lastIndex != serie.context.pointerItemDataIndex)
|
||||
{
|
||||
needInteract = true;
|
||||
}
|
||||
if (serie.context.pointerItemDataIndex >= 0)
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
else
|
||||
serie.interact.SetValue(ref needInteract, lineWidth);
|
||||
}
|
||||
if (needInteract)
|
||||
{
|
||||
@@ -152,15 +151,16 @@ namespace XCharts.Runtime
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var serieData = serie.GetSerieData(i);
|
||||
var index = serie.context.dataIndexs[i];
|
||||
var serieData = serie.GetSerieData(index);
|
||||
if (serieData == null)
|
||||
continue;
|
||||
if (serieData.context.isClip)
|
||||
continue;
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData, state);
|
||||
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
|
||||
if (!symbol.show || !symbol.ShowSymbol(i, count))
|
||||
if (!symbol.show || !symbol.ShowSymbol(index, count))
|
||||
continue;
|
||||
|
||||
var pos = serie.context.dataPoints[i];
|
||||
@@ -175,30 +175,23 @@ namespace XCharts.Runtime
|
||||
if (ChartHelper.IsIngore(pos))
|
||||
continue;
|
||||
|
||||
var highlight = serie.data[i].context.highlight || serie.highlight;
|
||||
var symbolSize = highlight ?
|
||||
theme.serie.lineSymbolSelectedSize :
|
||||
theme.serie.lineSymbolSize;
|
||||
var symbolSize = 0f;
|
||||
if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
|
||||
{
|
||||
symbolSize = highlight ?
|
||||
symbol.GetSelectedSize(serieData.data, symbolSize) :
|
||||
symbol.GetSize(serieData.data, symbolSize);
|
||||
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.lineSymbolSize, state);
|
||||
serieData.interact.SetValue(ref interacting, symbolSize);
|
||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||
}
|
||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, theme, serie.index, highlight);
|
||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, theme, serie.index, highlight);
|
||||
var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, serie.index, highlight, false);
|
||||
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 symbolColor, symbolToColor, symbolEmptyColor, borderColor;
|
||||
SerieHelper.GetItemColor(out symbolColor, out symbolToColor, out symbolEmptyColor, serie, serieData, theme, serie.index);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, null, chart.theme, state);
|
||||
if (isVisualMapGradient)
|
||||
{
|
||||
symbolColor = VisualMapHelper.GetLineGradientColor(visualMap, pos, m_SerieGrid, axis, relativedAxis, symbolColor);
|
||||
symbolToColor = symbolColor;
|
||||
}
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||
chart.DrawClipSymbol(vh, symbol.type, symbolSize, symbolBorder, pos,
|
||||
symbolColor, symbolToColor, symbolEmptyColor, borderColor, symbol.gap, clip, cornerRadius, m_SerieGrid,
|
||||
i > 0 ? serie.context.dataPoints[i - 1] : m_SerieGrid.context.position);
|
||||
@@ -220,7 +213,7 @@ namespace XCharts.Runtime
|
||||
if (serie.context.dataPoints.Count < 2)
|
||||
return;
|
||||
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.index, false);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.index);
|
||||
var startPos = Vector3.zero;
|
||||
var arrowPos = Vector3.zero;
|
||||
var lineArrow = serie.lineArrow.arrow;
|
||||
@@ -345,6 +338,7 @@ namespace XCharts.Runtime
|
||||
serie.context.dataIgnores.Add(false);
|
||||
serieData.context.position = np;
|
||||
serie.context.dataPoints.Add(np);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
lp = np;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,21 +47,19 @@ namespace XCharts.Runtime
|
||||
}
|
||||
m_LastCheckContextFlag = needCheck;
|
||||
var themeSymbolSize = chart.theme.serie.lineSymbolSize;
|
||||
var themeSymbolSelectedSize = chart.theme.serie.lineSymbolSelectedSize;
|
||||
lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
|
||||
var needInteract = false;
|
||||
if (m_LegendEnter)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, SerieState.Emphasis);
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -120,7 +118,7 @@ namespace XCharts.Runtime
|
||||
var firstSerieData = datas[0];
|
||||
var lp = GetPolarPos(m_SeriePolar, m_AngleAxis, firstSerieData, min, max, radius);
|
||||
var cp = Vector3.zero;
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.index, serie.highlight);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.index);
|
||||
var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
var currDetailProgress = 0f;
|
||||
var totalDetailProgress = datas.Count;
|
||||
@@ -205,28 +203,23 @@ namespace XCharts.Runtime
|
||||
continue;
|
||||
|
||||
var count = serie.dataCount;
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 symbolColor, symbolToColor, symbolEmptyColor, borderColor;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var serieData = serie.GetSerieData(i);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData, state);
|
||||
if (ChartHelper.IsIngore(serieData.context.position))
|
||||
continue;
|
||||
|
||||
bool highlight = serieData.context.highlight || serie.highlight;
|
||||
if ((!symbol.show || !symbol.ShowSymbol(i, count) || serie.IsPerformanceMode()) &&
|
||||
!serieData.context.highlight)
|
||||
if (!symbol.show || !symbol.ShowSymbol(i, count))
|
||||
continue;
|
||||
|
||||
var symbolSize = highlight ?
|
||||
symbol.GetSelectedSize(serieData.data, chart.theme.serie.lineSymbolSize) :
|
||||
symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||
|
||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, n, highlight);
|
||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, n, highlight);
|
||||
var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, n, highlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, highlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, highlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||
var symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.lineSymbolSize, state);
|
||||
SerieHelper.GetItemColor(out symbolColor, out symbolToColor, out symbolEmptyColor, serie, serieData, chart.theme, n);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, null, chart.theme, state);
|
||||
|
||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||
chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serieData.context.position,
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
UpdateCoordSerieParams(ref paramList, ref title, dataIndex, showCategory, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent);
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
|
||||
@@ -24,11 +24,17 @@ namespace XCharts.Runtime
|
||||
public static void DrawSerieLineArea(VertexHelper vh, Serie serie, Serie lastStackSerie,
|
||||
ThemeStyle theme, VisualMap visualMap, bool isY, Axis axis, Axis relativedAxis, GridCoord grid)
|
||||
{
|
||||
if (serie.areaStyle == null || !serie.areaStyle.show)
|
||||
Color32 areaColor, areaToColor;
|
||||
bool innerFill;
|
||||
if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, serie, null, theme, serie.context.colorIndex))
|
||||
{
|
||||
return;
|
||||
|
||||
var srcAreaColor = SerieHelper.GetAreaColor(serie, null, theme, serie.context.colorIndex, false);
|
||||
var srcAreaToColor = SerieHelper.GetAreaToColor(serie, null, theme, serie.context.colorIndex, false);
|
||||
}
|
||||
if (innerFill)
|
||||
{
|
||||
UGL.DrawPolygon(vh, serie.context.dataPoints, areaColor);
|
||||
return;
|
||||
}
|
||||
var gridXY = (isY ? grid.context.x : grid.context.y);
|
||||
if (lastStackSerie == null)
|
||||
{
|
||||
@@ -36,8 +42,8 @@ namespace XCharts.Runtime
|
||||
gridXY + relativedAxis.context.offset,
|
||||
gridXY,
|
||||
gridXY + (isY ? grid.context.width : grid.context.height),
|
||||
srcAreaColor,
|
||||
srcAreaToColor,
|
||||
areaColor,
|
||||
areaToColor,
|
||||
visualMap,
|
||||
axis,
|
||||
relativedAxis,
|
||||
@@ -49,8 +55,8 @@ namespace XCharts.Runtime
|
||||
gridXY + relativedAxis.context.offset,
|
||||
gridXY,
|
||||
gridXY + (isY ? grid.context.width : grid.context.height),
|
||||
srcAreaColor,
|
||||
srcAreaToColor,
|
||||
areaColor,
|
||||
areaToColor,
|
||||
visualMap);
|
||||
}
|
||||
}
|
||||
@@ -261,9 +267,7 @@ namespace XCharts.Runtime
|
||||
var isY = axis is YAxis;
|
||||
var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);
|
||||
var isLineStyleGradient = serie.lineStyle.IsNeedGradient();
|
||||
|
||||
//var highlight = serie.highlight || serie.context.pointerEnter;
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, theme, serie.context.colorIndex, false);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, theme, serie.context.colorIndex);
|
||||
|
||||
var lastDataIsIgnore = datas[0].isIgnoreBreak;
|
||||
var smooth = serie.lineType == LineType.Smooth;
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
UpdateCoordSerieParams(ref paramList, ref title, dataIndex, showCategory, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent);
|
||||
}
|
||||
|
||||
public override void DrawSerie(VertexHelper vh)
|
||||
@@ -73,15 +73,14 @@ namespace XCharts.Runtime
|
||||
var needInteract = false;
|
||||
if (m_LegendEnter)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true, chart.theme.serie.selectedRate);
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, SerieState.Emphasis);
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
}
|
||||
}
|
||||
else if (serie.context.isTriggerByAxis)
|
||||
@@ -91,47 +90,42 @@ namespace XCharts.Runtime
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, themeSymbolSize);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
if (i == serie.context.pointerItemDataIndex)
|
||||
var highlight = i == serie.context.pointerItemDataIndex;
|
||||
serieData.context.highlight = highlight;
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, state);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
if (highlight)
|
||||
{
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var lastIndex = serie.context.pointerItemDataIndex;
|
||||
serie.context.pointerItemDataIndex = -1;
|
||||
serie.context.pointerEnter = false;
|
||||
foreach (var serieData in serie.data)
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var dist = Vector3.Distance(chart.pointerPos, serieData.context.position);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, themeSymbolSize);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
|
||||
if (dist <= symbolSelectedSize)
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize);
|
||||
var highlight = dist <= size;
|
||||
serieData.context.highlight = highlight;
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, state);
|
||||
serieData.interact.SetValue(ref needInteract, size);
|
||||
if (highlight)
|
||||
{
|
||||
serie.context.pointerItemDataIndex = serieData.index;
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = serieData.index;
|
||||
serie.interact.SetValue(ref needInteract, lineWidth, true);
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
}
|
||||
}
|
||||
if (lastIndex != serie.context.pointerItemDataIndex)
|
||||
needInteract = true;
|
||||
}
|
||||
if (needInteract)
|
||||
{
|
||||
@@ -214,6 +208,7 @@ namespace XCharts.Runtime
|
||||
serieData.context.position = np;
|
||||
|
||||
serie.context.dataPoints.Add(np);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
serie.context.dataIgnores.Add(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
[SerieHandler(typeof(ParallelHandler), true)]
|
||||
[RequireChartComponent(typeof(ParallelCoord))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField()]
|
||||
public class Parallel : Serie, INeedSerieContainer
|
||||
{
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace XCharts.Runtime
|
||||
DrawParallelSerie(vh, serie);
|
||||
}
|
||||
|
||||
private void UpdateSerieContext()
|
||||
{ }
|
||||
private void UpdateSerieContext() { }
|
||||
|
||||
private void DrawParallelSerie(VertexHelper vh, Parallel serie)
|
||||
{
|
||||
@@ -39,7 +38,7 @@ namespace XCharts.Runtime
|
||||
|
||||
var animationIndex = serie.animation.GetCurrIndex();
|
||||
var isHorizonal = parallel.orient == Orient.Horizonal;
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.context.colorIndex, false);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.context.colorIndex);
|
||||
var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
|
||||
float currDetailProgress = !isHorizonal ?
|
||||
@@ -52,7 +51,6 @@ namespace XCharts.Runtime
|
||||
|
||||
serie.animation.InitProgress(currDetailProgress, totalDetailProgress);
|
||||
|
||||
serie.context.dataPoints.Clear();
|
||||
serie.containerIndex = parallel.index;
|
||||
serie.containterInstanceId = parallel.instanceId;
|
||||
|
||||
@@ -116,7 +114,10 @@ namespace XCharts.Runtime
|
||||
lp = pos;
|
||||
}
|
||||
if (isSmooth)
|
||||
UGL.DrawCurves(vh, m_Points, lineWidth, lineColor, chart.settings.lineSmoothness, currProgress, isHorizonal);
|
||||
UGL.DrawCurves(vh, m_Points, lineWidth, lineColor,
|
||||
chart.settings.lineSmoothStyle,
|
||||
chart.settings.lineSmoothness,
|
||||
UGL.Direction.XAxis, currProgress, isHorizonal);
|
||||
else
|
||||
UGL.DrawLine(vh, m_Points, lineWidth, lineColor, isSmooth);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ namespace XCharts.Runtime
|
||||
[SerieConvert(typeof(Line), typeof(Bar))]
|
||||
[SerieHandler(typeof(PieHandler), true)]
|
||||
[DefaultAnimation(AnimationType.Clockwise)]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle), typeof(EmphasisLabelLine))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle), typeof(EmphasisLabelLine))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_Ignore", "m_Selected", "m_Radius")]
|
||||
public class Pie : Serie
|
||||
{
|
||||
public override bool useDataNameForColor { get { return true; } }
|
||||
public override SerieColorBy defaultColorBy { get { return SerieColorBy.Data; } }
|
||||
public override bool titleJustForSerie { get { return true; } }
|
||||
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
|
||||
@@ -34,11 +34,11 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
UpdateItemSerieParams(ref paramList, ref title, dataIndex, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent);
|
||||
}
|
||||
|
||||
public override Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)
|
||||
@@ -108,6 +108,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
var needCheck = m_LegendEnter || (chart.isPointerInChart && PointerIsInPieSerie(serie, chart.pointerPos));
|
||||
var needInteract = false;
|
||||
Color32 color, toColor;
|
||||
if (!needCheck)
|
||||
{
|
||||
if (m_LastCheckContextFlag != needCheck)
|
||||
@@ -118,8 +119,7 @@ namespace XCharts.Runtime
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal);
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValueAndColor(ref needInteract, serieData.context.outsideRadius, color, toColor);
|
||||
}
|
||||
@@ -142,8 +142,7 @@ namespace XCharts.Runtime
|
||||
serieData.context.highlight = true;
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, true);
|
||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, true);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Emphasis);
|
||||
var value = serieData.context.outsideRadius + chart.theme.serie.pieTooltipExtraRadius;
|
||||
serieData.interact.SetValueAndColor(ref needInteract, value, color, toColor);
|
||||
}
|
||||
@@ -151,8 +150,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal);
|
||||
serieData.interact.SetValueAndColor(ref needInteract, serieData.context.outsideRadius, color, toColor);
|
||||
}
|
||||
}
|
||||
@@ -197,7 +195,6 @@ namespace XCharts.Runtime
|
||||
for (int n = 0; n < data.Count; n++)
|
||||
{
|
||||
var serieData = data[n];
|
||||
serieData.index = n;
|
||||
var value = isAllZeroValue ? zeroReplaceValue : serieData.GetCurrData(1, dataChangeDuration);
|
||||
serieData.context.startAngle = startDegree;
|
||||
serieData.context.toAngle = startDegree;
|
||||
@@ -322,7 +319,7 @@ namespace XCharts.Runtime
|
||||
if (serieData.IsDataChanged())
|
||||
dataChanging = true;
|
||||
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.context.highlight);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var outsideRadius = 0f;
|
||||
|
||||
@@ -334,8 +331,7 @@ namespace XCharts.Runtime
|
||||
|
||||
//if (!serieData.interact.TryGetValueAndColor(ref outsideRadius, ref color, ref toColor, ref interacting))
|
||||
{
|
||||
color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
toColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex);
|
||||
outsideRadius = serieData.context.outsideRadius * progress;
|
||||
serieData.interact.SetValueAndColor(ref interacting, outsideRadius, color, toColor);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,26 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
[SerieHandler(typeof(RadarHandler), true)]
|
||||
[RequireChartComponent(typeof(RadarCoord))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField()]
|
||||
public class Radar : Serie, INeedSerieContainer
|
||||
{
|
||||
[SerializeField][Since("3.2.0")] private bool m_Smooth = false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether use smooth curve.
|
||||
/// |是否平滑曲线。平滑曲线时不支持区域填充颜色。
|
||||
/// </summary>
|
||||
public bool smooth
|
||||
{
|
||||
get { return m_Smooth; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Smooth, value)) { SetVerticesDirty(); } }
|
||||
}
|
||||
|
||||
public int containerIndex { get; internal set; }
|
||||
public int containterInstanceId { get; internal set; }
|
||||
public override bool useDataNameForColor { get { return true; } }
|
||||
public override SerieColorBy defaultColorBy { get { return radarType == RadarType.Multiple?SerieColorBy.Serie : SerieColorBy.Data; } }
|
||||
public override bool multiDimensionLabel { get { return radarType == RadarType.Multiple; } }
|
||||
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
if (!serie.context.pointerEnter)
|
||||
@@ -41,8 +41,9 @@ namespace XCharts.Runtime
|
||||
|
||||
if (serie.radarType == RadarType.Single)
|
||||
{
|
||||
var colorIndex1 = serie.colorByData ? dataIndex : serie.context.colorIndex;
|
||||
UpdateItemSerieParams(ref paramList, ref title, dataIndex, category,
|
||||
marker, itemFormatter, numericFormatter);
|
||||
marker, itemFormatter, numericFormatter, ignoreDataDefaultContent, 1, colorIndex1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -54,7 +55,9 @@ namespace XCharts.Runtime
|
||||
if (serieData == null)
|
||||
return;
|
||||
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, dataIndex, false);;
|
||||
Color32 color, toColor;
|
||||
var colorIndex = serie.colorByData ? chart.GetLegendRealShowNameIndex(serieData.legendName) : serie.context.colorIndex;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal);
|
||||
title = serieData.name;
|
||||
for (int i = 0; i < serieData.data.Count; i++)
|
||||
{
|
||||
@@ -96,16 +99,17 @@ namespace XCharts.Runtime
|
||||
needHideAll = true;
|
||||
}
|
||||
m_LastCheckContextFlag = needCheck;
|
||||
serie.highlight = false;
|
||||
serie.context.pointerEnter = false;
|
||||
serie.context.pointerItemDataIndex = -1;
|
||||
var areaStyle = serie.areaStyle;
|
||||
var themeSymbolSize = chart.theme.serie.lineSymbolSize;
|
||||
switch (serie.radarType)
|
||||
{
|
||||
case RadarType.Multiple:
|
||||
for (int i = 0; i < serie.data.Count; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
serieData.index = i;
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||
if (needHideAll || m_LegendEnter)
|
||||
@@ -120,6 +124,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (Vector3.Distance(chart.pointerPos, pos) < symbolSize * 2)
|
||||
{
|
||||
serie.highlight = true;
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
serieData.context.highlight = true;
|
||||
@@ -136,6 +141,7 @@ namespace XCharts.Runtime
|
||||
var p2 = n >= dataPoints.Count - 1 ? dataPoints[0] : dataPoints[n + 1];
|
||||
if (UGLHelper.IsPointInTriangle(p1, center, p2, chart.pointerPos))
|
||||
{
|
||||
serie.highlight = true;
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
serieData.context.highlight = true;
|
||||
@@ -148,15 +154,21 @@ namespace XCharts.Runtime
|
||||
}
|
||||
break;
|
||||
case RadarType.Single:
|
||||
needInteract = false;
|
||||
for (int i = 0; i < serie.data.Count; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
serieData.index = i;
|
||||
if (Vector3.Distance(chart.pointerPos, serieData.context.position) < serie.symbol.size * 2)
|
||||
var size = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize);
|
||||
if (Vector3.Distance(chart.pointerPos, serieData.context.position) < size * 2)
|
||||
{
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
return;
|
||||
serieData.context.highlight = true;
|
||||
needInteract = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
}
|
||||
}
|
||||
if (!serie.context.pointerEnter && areaStyle != null)
|
||||
@@ -172,6 +184,7 @@ namespace XCharts.Runtime
|
||||
serie.context.pointerEnter = true;
|
||||
serie.context.pointerItemDataIndex = n;
|
||||
p1.context.highlight = true;
|
||||
needInteract = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,6 +222,7 @@ namespace XCharts.Runtime
|
||||
var interacting = false;
|
||||
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||
SerieHelper.GetAllMinMaxData(serie, m_RadarCoord.ceilRate);
|
||||
Color32 areaColor, areaToColor;
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
{
|
||||
var serieData = serie.data[j];
|
||||
@@ -217,14 +231,13 @@ namespace XCharts.Runtime
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var serieState = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
var lineStyle = SerieHelper.GetLineStyle(serie, serieData);
|
||||
var areaStyle = SerieHelper.GetAreaStyle(serie, serieData);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var isHighlight = serieData.context.highlight;
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var areaColor = SerieHelper.GetAreaColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
var areaToColor = SerieHelper.GetAreaToColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex, isHighlight);
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData, serieState);
|
||||
|
||||
var colorIndex = serie.colorByData ? chart.GetLegendRealShowNameIndex(serieData.legendName) : serie.context.colorIndex;
|
||||
var showArea = SerieHelper.GetAreaColor(out areaColor, out areaToColor, serie, serieData, chart.theme, colorIndex);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex);
|
||||
var lineWidth = lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
int dataCount = m_RadarCoord.indicatorList.Count;
|
||||
serieData.context.dataPoints.Clear();
|
||||
@@ -262,11 +275,11 @@ namespace XCharts.Runtime
|
||||
{
|
||||
toPoint = new Vector3(centerPos.x + radius * Mathf.Sin(currAngle),
|
||||
centerPos.y + radius * Mathf.Cos(currAngle));
|
||||
if (areaStyle != null && areaStyle.show)
|
||||
if (showArea && !serie.smooth)
|
||||
{
|
||||
UGL.DrawTriangle(vh, startPoint, toPoint, centerPos, areaColor, areaColor, areaToColor);
|
||||
}
|
||||
if (lineStyle.show)
|
||||
if (lineStyle.show && !serie.smooth)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle.type, lineWidth, startPoint, toPoint, lineColor);
|
||||
}
|
||||
@@ -274,36 +287,42 @@ namespace XCharts.Runtime
|
||||
}
|
||||
serieData.context.dataPoints.Add(startPoint);
|
||||
}
|
||||
if (areaStyle != null && areaStyle.show)
|
||||
if (showArea && !serie.smooth)
|
||||
{
|
||||
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
|
||||
}
|
||||
if (lineStyle.show)
|
||||
if (lineStyle.show && !serie.smooth)
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle.type, lineWidth, startPoint, firstPoint, lineColor);
|
||||
}
|
||||
|
||||
if (serie.smooth)
|
||||
{
|
||||
UGL.DrawCurves(vh, serieData.context.dataPoints, lineWidth, lineColor,
|
||||
chart.settings.lineSmoothStyle,
|
||||
chart.settings.lineSmoothness,
|
||||
UGL.Direction.Random,
|
||||
float.NaN, true);
|
||||
}
|
||||
|
||||
if (symbol.show && symbol.type != SymbolType.None)
|
||||
{
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 symbolColor, symbolToColor, symbolEmptyColor, borderColor;
|
||||
for (int m = 0; m < serieData.context.dataPoints.Count; m++)
|
||||
{
|
||||
var point = serieData.context.dataPoints[m];
|
||||
var symbolSize = isHighlight ?
|
||||
symbol.GetSelectedSize(null, chart.theme.serie.lineSymbolSelectedSize) :
|
||||
symbol.GetSize(null, chart.theme.serie.lineSymbolSize);
|
||||
var symbolSize = 0f;
|
||||
if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
|
||||
{
|
||||
symbolSize = isHighlight ?
|
||||
symbol.GetSelectedSize(serieData.data, symbolSize) :
|
||||
symbol.GetSize(serieData.data, symbolSize);
|
||||
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.lineSymbolSize, serieState);
|
||||
serieData.interact.SetValue(ref interacting, symbolSize);
|
||||
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
|
||||
}
|
||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, j, isHighlight);
|
||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, j, isHighlight);
|
||||
var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, j, isHighlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, isHighlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||
colorIndex = serie.colorByData ? m : colorIndex;
|
||||
SerieHelper.GetItemColor(out symbolColor, out symbolToColor, out symbolEmptyColor, serie, serieData, chart.theme, colorIndex, serieState);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, serieState);
|
||||
chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
||||
symbolToColor, symbolEmptyColor, borderColor, symbol.gap, cornerRadius);
|
||||
}
|
||||
@@ -322,15 +341,14 @@ namespace XCharts.Runtime
|
||||
|
||||
private void DrawSingleRadar(VertexHelper vh)
|
||||
{
|
||||
var radar = chart.GetChartComponent<RadarCoord>(serie.radarIndex);
|
||||
if (radar == null)
|
||||
m_RadarCoord = chart.GetChartComponent<RadarCoord>(serie.radarIndex);
|
||||
if (m_RadarCoord == null)
|
||||
return;
|
||||
|
||||
var indicatorNum = radar.indicatorList.Count;
|
||||
var indicatorNum = m_RadarCoord.indicatorList.Count;
|
||||
var angle = 2 * Mathf.PI / indicatorNum;
|
||||
var centerPos = radar.context.center;
|
||||
var centerPos = m_RadarCoord.context.center;
|
||||
serie.animation.InitProgress(0, 1);
|
||||
serie.context.dataPoints.Clear();
|
||||
if (!serie.show || serie.animation.HasFadeOut())
|
||||
{
|
||||
return;
|
||||
@@ -346,11 +364,10 @@ namespace XCharts.Runtime
|
||||
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||
var startIndex = GetStartShowIndex(serie);
|
||||
var endIndex = GetEndShowIndex(serie);
|
||||
SerieHelper.UpdateMinMaxData(serie, 1, radar.ceilRate);
|
||||
SerieHelper.UpdateMinMaxData(serie, 1, m_RadarCoord.ceilRate);
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
{
|
||||
var serieData = serie.data[j];
|
||||
serieData.index = j;
|
||||
string dataName = serieData.name;
|
||||
|
||||
if (!serieData.show)
|
||||
@@ -359,28 +376,27 @@ namespace XCharts.Runtime
|
||||
continue;
|
||||
}
|
||||
var lineStyle = SerieHelper.GetLineStyle(serie, serieData);
|
||||
var areaStyle = SerieHelper.GetAreaStyle(serie, serieData);
|
||||
var isHighlight = serie.context.pointerEnter;
|
||||
var areaColor = SerieHelper.GetAreaColor(serie, serieData, chart.theme, j, isHighlight);
|
||||
var areaToColor = SerieHelper.GetAreaToColor(serie, serieData, chart.theme, j, isHighlight);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, j, isHighlight);
|
||||
int dataCount = radar.indicatorList.Count;
|
||||
Color32 areaColor, areaToColor;
|
||||
var colorIndex = serie.colorByData?j : serie.context.colorIndex;
|
||||
var showArea = SerieHelper.GetAreaColor(out areaColor, out areaToColor, serie, serieData, chart.theme, colorIndex);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex);
|
||||
int dataCount = m_RadarCoord.indicatorList.Count;
|
||||
var index = serieData.index;
|
||||
var p = radar.context.center;
|
||||
var max = radar.GetIndicatorMax(index);
|
||||
var p = m_RadarCoord.context.center;
|
||||
var max = m_RadarCoord.GetIndicatorMax(index);
|
||||
var value = serieData.GetCurrData(1, dataChangeDuration);
|
||||
if (serieData.IsDataChanged()) dataChanging = true;
|
||||
if (max == 0)
|
||||
{
|
||||
max = serie.context.dataMax;
|
||||
}
|
||||
if (!radar.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||
if (!m_RadarCoord.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||
{
|
||||
lineColor = radar.outRangeColor;
|
||||
lineColor = m_RadarCoord.outRangeColor;
|
||||
}
|
||||
var radius = (float) (max < 0 ? radar.context.dataRadius - radar.context.dataRadius * value / max :
|
||||
radar.context.dataRadius * value / max);
|
||||
var currAngle = (index + (radar.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle;
|
||||
var radius = (float) (max < 0 ? m_RadarCoord.context.dataRadius - m_RadarCoord.context.dataRadius * value / max :
|
||||
m_RadarCoord.context.dataRadius * value / max);
|
||||
var currAngle = (index + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle;
|
||||
radius *= rate;
|
||||
if (index == startIndex)
|
||||
{
|
||||
@@ -394,58 +410,67 @@ namespace XCharts.Runtime
|
||||
{
|
||||
toPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle),
|
||||
p.y + radius * Mathf.Cos(currAngle));
|
||||
if (areaStyle != null && areaStyle.show)
|
||||
if (showArea && !serie.smooth)
|
||||
{
|
||||
UGL.DrawTriangle(vh, startPoint, toPoint, p, areaColor, areaColor, areaToColor);
|
||||
}
|
||||
if (lineStyle.show)
|
||||
if (lineStyle.show && !serie.smooth)
|
||||
{
|
||||
if (radar.connectCenter)
|
||||
if (m_RadarCoord.connectCenter)
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle, startPoint, centerPos,
|
||||
chart.theme.serie.lineWidth, LineStyle.Type.Solid, lastColor, lastColor);
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle, startPoint, toPoint, chart.theme.serie.lineWidth,
|
||||
LineStyle.Type.Solid, radar.lineGradient ? lastColor : lineColor, lineColor);
|
||||
LineStyle.Type.Solid, m_RadarCoord.lineGradient ? lastColor : lineColor, lineColor);
|
||||
}
|
||||
startPoint = toPoint;
|
||||
lastColor = lineColor;
|
||||
}
|
||||
serie.context.dataPoints.Add(startPoint);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
serieData.context.position = startPoint;
|
||||
serieData.context.labelPosition = startPoint;
|
||||
|
||||
if (areaStyle != null && areaStyle.show && j == endIndex)
|
||||
if (showArea && j == endIndex && !serie.smooth)
|
||||
{
|
||||
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
|
||||
}
|
||||
if (lineStyle.show && j == endIndex)
|
||||
if (lineStyle.show && j == endIndex && !serie.smooth)
|
||||
{
|
||||
if (radar.connectCenter)
|
||||
if (m_RadarCoord.connectCenter)
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle, startPoint, centerPos,
|
||||
chart.theme.serie.lineWidth, LineStyle.Type.Solid, lastColor, lastColor);
|
||||
ChartDrawer.DrawLineStyle(vh, lineStyle, startPoint, firstPoint, chart.theme.serie.lineWidth,
|
||||
LineStyle.Type.Solid, lineColor, radar.lineGradient ? firstColor : lineColor);
|
||||
LineStyle.Type.Solid, lineColor, m_RadarCoord.lineGradient ? firstColor : lineColor);
|
||||
}
|
||||
}
|
||||
if (serie.smooth)
|
||||
{
|
||||
var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
|
||||
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.context.colorIndex);
|
||||
UGL.DrawCurves(vh, serie.context.dataPoints, lineWidth, lineColor,
|
||||
chart.settings.lineSmoothStyle,
|
||||
chart.settings.lineSmoothness,
|
||||
UGL.Direction.Random,
|
||||
float.NaN, true);
|
||||
}
|
||||
if (serie.symbol.show && serie.symbol.type != SymbolType.None)
|
||||
{
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 symbolColor, symbolToColor, symbolEmptyColor, borderColor;
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
{
|
||||
var serieData = serie.data[j];
|
||||
if (!serieData.show) continue;
|
||||
var isHighlight = serie.highlight || serieData.context.highlight || serie.context.pointerEnter;
|
||||
var serieIndex = serieData.index;
|
||||
var symbolSize = isHighlight ?
|
||||
serie.symbol.GetSelectedSize(serieData.data, chart.theme.serie.lineSymbolSelectedSize) :
|
||||
serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||
var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, isHighlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||
if (!radar.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||
var state = SerieHelper.GetSerieState(serie, serieData);
|
||||
var symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.lineSymbolSize, state);
|
||||
var colorIndex = serie.colorByData ? serieData.index : serie.context.colorIndex;
|
||||
SerieHelper.GetItemColor(out symbolColor, out symbolToColor, out symbolEmptyColor, serie, serieData, chart.theme, colorIndex, state);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, state);
|
||||
if (!m_RadarCoord.IsInIndicatorRange(j, serieData.GetData(1)))
|
||||
{
|
||||
symbolColor = radar.outRangeColor;
|
||||
symbolToColor = radar.outRangeColor;
|
||||
symbolColor = m_RadarCoord.outRangeColor;
|
||||
symbolToColor = m_RadarCoord.outRangeColor;
|
||||
}
|
||||
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, serieData.context.labelPosition, symbolColor,
|
||||
symbolToColor, symbolEmptyColor, borderColor, serie.symbol.gap, cornerRadius);
|
||||
@@ -478,27 +503,5 @@ namespace XCharts.Runtime
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void DrawRadarSymbol(VertexHelper vh, Serie serie, SerieData serieData, int serieIndex, bool isHighlight,
|
||||
List<Vector3> pointList)
|
||||
{
|
||||
if (serie.symbol.show && serie.symbol.type != SymbolType.None)
|
||||
{
|
||||
var symbolSize = isHighlight ?
|
||||
serie.symbol.GetSelectedSize(serieData.data, chart.theme.serie.lineSymbolSelectedSize) :
|
||||
serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize);
|
||||
var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||
var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight);
|
||||
var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, isHighlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight);
|
||||
foreach (var point in pointList)
|
||||
{
|
||||
chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
|
||||
symbolToColor, symbolEmptyColor, borderColor, serie.symbol.gap, cornerRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
[System.Serializable]
|
||||
[SerieHandler(typeof(RingHandler), true)]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(TitleStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(TitleStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField()]
|
||||
public class Ring : Serie
|
||||
{
|
||||
public override bool useDataNameForColor { get { return true; } }
|
||||
public override SerieColorBy defaultColorBy { get { return SerieColorBy.Data; } }
|
||||
public static Serie AddDefaultSerie(BaseChart chart, string serieName)
|
||||
{
|
||||
var serie = chart.AddSerie<Ring>(serieName);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
if (dataIndex < 0)
|
||||
@@ -86,6 +86,8 @@ namespace XCharts.Runtime
|
||||
var serieData = serie.GetSerieData(dataIndex);
|
||||
if (serieData == null)
|
||||
return;
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, dataIndex);
|
||||
|
||||
var param = serie.context.param;
|
||||
param.serieName = serie.serieName;
|
||||
@@ -96,7 +98,7 @@ namespace XCharts.Runtime
|
||||
param.dataCount = serie.dataCount;
|
||||
param.value = serieData.GetData(0);
|
||||
param.total = serieData.GetData(1);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, dataIndex, false);
|
||||
param.color = color;
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);;
|
||||
@@ -150,7 +152,6 @@ namespace XCharts.Runtime
|
||||
for (int j = 0; j < data.Count; j++)
|
||||
{
|
||||
var serieData = data[j];
|
||||
serieData.index = j;
|
||||
if (!serieData.show) continue;
|
||||
if (serieData.IsDataChanged()) dataChanging = true;
|
||||
var value = serieData.GetFirstData(dataChangeDuration);
|
||||
@@ -158,10 +159,10 @@ namespace XCharts.Runtime
|
||||
var degree = (float) (360 * value / max);
|
||||
var startDegree = GetStartAngle(serie);
|
||||
var toDegree = GetToAngle(serie, degree);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData, serieData.context.highlight);
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.legendName);
|
||||
var itemColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
var itemToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, colorIndex, serieData.context.highlight);
|
||||
Color32 itemColor, itemToColor;
|
||||
SerieHelper.GetItemColor(out itemColor, out itemToColor, serie, serieData, chart.theme, colorIndex);
|
||||
var outsideRadius = serie.context.outsideRadius - j * (ringWidth + serie.gap);
|
||||
var insideRadius = outsideRadius - ringWidth;
|
||||
var borderWidth = itemStyle.borderWidth;
|
||||
@@ -214,8 +215,7 @@ namespace XCharts.Runtime
|
||||
chart.RefreshPainter(serie);
|
||||
}
|
||||
|
||||
public override void OnPointerDown(PointerEventData eventData)
|
||||
{ }
|
||||
public override void OnPointerDown(PointerEventData eventData) { }
|
||||
|
||||
private float GetStartAngle(Serie serie)
|
||||
{
|
||||
@@ -258,7 +258,12 @@ namespace XCharts.Runtime
|
||||
private void DrawBackground(VertexHelper vh, Serie serie, SerieData serieData, int index, float insideRadius, float outsideRadius)
|
||||
{
|
||||
var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
|
||||
var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, index, false);
|
||||
var backgroundColor = itemStyle.backgroundColor;
|
||||
if (ChartHelper.IsClearColor(backgroundColor))
|
||||
{
|
||||
backgroundColor = chart.theme.GetColor(index);
|
||||
backgroundColor.a = 50;
|
||||
}
|
||||
if (itemStyle.backgroundWidth != 0)
|
||||
{
|
||||
var centerRadius = (outsideRadius + insideRadius) / 2;
|
||||
@@ -297,7 +302,6 @@ namespace XCharts.Runtime
|
||||
for (int i = 0; i < serie.data.Count; i++)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
serieData.index = i;
|
||||
if (dist >= serieData.context.insideRadius &&
|
||||
dist <= serieData.context.outsideRadius &&
|
||||
angle >= serieData.context.startAngle &&
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace XCharts.Runtime
|
||||
}
|
||||
|
||||
public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category,
|
||||
string marker, string itemFormatter, string numericFormatter,
|
||||
string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title)
|
||||
{
|
||||
dataIndex = serie.context.pointerItemDataIndex;
|
||||
@@ -36,7 +36,7 @@ namespace XCharts.Runtime
|
||||
param.dimension = 1;
|
||||
param.dataCount = serie.dataCount;
|
||||
param.serieData = serieData;
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
param.color = chart.GetItemColor(serie, serieData);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -82,22 +82,21 @@ namespace XCharts.Runtime
|
||||
for (int i = serie.dataCount - 1; i >= 0; i--)
|
||||
{
|
||||
var serieData = serie.data[i];
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
var symbolSize = symbol.GetSize(serieData.data, themeSymbolSize);
|
||||
var symbolSelectedSize = symbol.GetSelectedSize(serieData.data, themeSymbolSelectedSize);
|
||||
var symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize);
|
||||
if (m_LegendEnter ||
|
||||
(!needHideAll && Vector3.Distance(serieData.context.position, chart.pointerPos) <= symbolSize))
|
||||
{
|
||||
serie.context.pointerItemDataIndex = i;
|
||||
serie.context.pointerEnter = true;
|
||||
serieData.context.highlight = true;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSelectedSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
serieData.context.highlight = false;
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
}
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, themeSymbolSize, state);
|
||||
serieData.interact.SetValue(ref needInteract, symbolSize);
|
||||
}
|
||||
if (needInteract)
|
||||
{
|
||||
@@ -144,19 +143,19 @@ namespace XCharts.Runtime
|
||||
serie.containerIndex = m_Grid.index;
|
||||
serie.containterInstanceId = m_Grid.instanceId;
|
||||
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 color, toColor, emptyColor, borderColor;
|
||||
foreach (var serieData in dataList)
|
||||
{
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
if (!symbol.ShowSymbol(serieData.index, maxCount))
|
||||
continue;
|
||||
|
||||
var highlight = serie.highlight || serieData.context.highlight;
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, theme, colorIndex, highlight);
|
||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, theme, colorIndex, highlight);
|
||||
var emptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, colorIndex, highlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
|
||||
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, state);
|
||||
double xValue = serieData.GetCurrData(0, dataChangeDuration, xAxis.inverse);
|
||||
double yValue = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse);
|
||||
|
||||
@@ -173,16 +172,13 @@ namespace XCharts.Runtime
|
||||
continue;
|
||||
|
||||
serie.context.dataPoints.Add(pos);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
serieData.context.position = pos;
|
||||
var datas = serieData.data;
|
||||
var symbolSize = serie.highlight || serieData.context.highlight ?
|
||||
theme.serie.scatterSymbolSelectedSize :
|
||||
theme.serie.scatterSymbolSize;
|
||||
var symbolSize = 0f;
|
||||
if (!serieData.interact.TryGetValue(ref symbolSize, ref interacting))
|
||||
{
|
||||
symbolSize = highlight ?
|
||||
symbol.GetSelectedSize(serieData.data, symbolSize) :
|
||||
symbol.GetSize(serieData.data, symbolSize);
|
||||
symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.scatterSymbolSize, state);
|
||||
serieData.interact.SetValue(ref interacting, symbolSize);
|
||||
}
|
||||
|
||||
@@ -249,25 +245,25 @@ namespace XCharts.Runtime
|
||||
serie.containerIndex = axis.index;
|
||||
serie.containterInstanceId = axis.instanceId;
|
||||
|
||||
float symbolBorder = 0f;
|
||||
float[] cornerRadius = null;
|
||||
Color32 color, toColor, emptyColor, borderColor;
|
||||
foreach (var serieData in dataList)
|
||||
{
|
||||
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
|
||||
if (!symbol.ShowSymbol(serieData.index, maxCount))
|
||||
continue;
|
||||
|
||||
var highlight = serie.highlight || serieData.context.highlight;
|
||||
var color = SerieHelper.GetItemColor(serie, serieData, theme, colorIndex, highlight);
|
||||
var toColor = SerieHelper.GetItemToColor(serie, serieData, theme, colorIndex, highlight);
|
||||
var emptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, theme, colorIndex, highlight, false);
|
||||
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, highlight);
|
||||
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, highlight);
|
||||
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, highlight);
|
||||
var xValue = serieData.GetCurrData(0, dataChangeDuration, axis.inverse);
|
||||
var state = SerieHelper.GetSerieState(serie, serieData, true);
|
||||
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
|
||||
SerieHelper.GetSymbolInfo(out borderColor, out symbolBorder, out cornerRadius, serie, serieData, chart.theme, state);
|
||||
|
||||
if (serieData.IsDataChanged())
|
||||
dataChanging = true;
|
||||
|
||||
var pos = Vector3.zero;
|
||||
var xValue = serieData.GetCurrData(0, dataChangeDuration, axis.inverse);
|
||||
|
||||
if (axis.orient == Orient.Horizonal)
|
||||
{
|
||||
var xDataHig = GetDataHig(axis, xValue, axis.context.width);
|
||||
@@ -281,14 +277,11 @@ namespace XCharts.Runtime
|
||||
pos = new Vector3(axis.context.x + xDataHig, axis.context.y + yDataHig);
|
||||
}
|
||||
serie.context.dataPoints.Add(pos);
|
||||
serie.context.dataIndexs.Add(serieData.index);
|
||||
serieData.context.position = pos;
|
||||
|
||||
var datas = serieData.data;
|
||||
var symbolSize = 0f;
|
||||
if (serie.highlight || serieData.context.highlight)
|
||||
symbolSize = symbol.GetSelectedSize(datas, theme.serie.scatterSymbolSelectedSize);
|
||||
else
|
||||
symbolSize = symbol.GetSize(datas, theme.serie.scatterSymbolSize);
|
||||
var symbolSize = SerieHelper.GetSysmbolSize(serie, serieData, chart.theme, chart.theme.serie.scatterSymbolSize, state);
|
||||
symbolSize *= rate;
|
||||
|
||||
if (isEffectScatter)
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
[SerieHandler(typeof(EffectScatterHandler), true)]
|
||||
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_Radius")]
|
||||
public class EffectScatter : BaseScatter
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
[SerieHandler(typeof(ScatterHandler), true)]
|
||||
[CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisItemStyle), typeof(EmphasisLabelStyle))]
|
||||
[SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
|
||||
[SerieDataExtraField("m_Radius")]
|
||||
public class Scatter : BaseScatter
|
||||
{
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace XCharts.Runtime
|
||||
{ typeof(LineArrow), "m_LineArrows" },
|
||||
{ typeof(AreaStyle), "m_AreaStyles" },
|
||||
{ typeof(TitleStyle), "m_TitleStyles" },
|
||||
{ typeof(EmphasisItemStyle), "m_EmphasisItemStyles" },
|
||||
{ typeof(EmphasisLabelStyle), "m_EmphasisLabels" },
|
||||
{ typeof(EmphasisLabelLine), "m_EmphasisLabelLines" },
|
||||
{ typeof(EmphasisStyle), "m_EmphasisStyles" },
|
||||
{ typeof(BlurStyle), "m_BlurStyles" },
|
||||
{ typeof(SelectStyle), "m_SelectStyles" },
|
||||
};
|
||||
|
||||
[SerializeField][IgnoreDoc] private List<LabelStyle> m_Labels = new List<LabelStyle>();
|
||||
@@ -25,9 +25,9 @@ namespace XCharts.Runtime
|
||||
[SerializeField][IgnoreDoc] private List<LineArrow> m_LineArrows = new List<LineArrow>();
|
||||
[SerializeField][IgnoreDoc] private List<AreaStyle> m_AreaStyles = new List<AreaStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<TitleStyle> m_TitleStyles = new List<TitleStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisItemStyle> m_EmphasisItemStyles = new List<EmphasisItemStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisLabelStyle> m_EmphasisLabels = new List<EmphasisLabelStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisLabelLine> m_EmphasisLabelLines = new List<EmphasisLabelLine>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisStyle> m_EmphasisStyles = new List<EmphasisStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<BlurStyle> m_BlurStyles = new List<BlurStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<SelectStyle> m_SelectStyles = new List<SelectStyle>();
|
||||
|
||||
/// <summary>
|
||||
/// The style of area.
|
||||
@@ -51,22 +51,25 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public LineArrow lineArrow { get { return m_LineArrows.Count > 0 ? m_LineArrows[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮的图形样式
|
||||
/// </summary>
|
||||
public EmphasisItemStyle emphasisItemStyle { get { return m_EmphasisItemStyles.Count > 0 ? m_EmphasisItemStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮时的标签样式
|
||||
/// </summary>
|
||||
public EmphasisLabelStyle emphasisLabel { get { return m_EmphasisLabels.Count > 0 ? m_EmphasisLabels[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮时的标签引导线样式
|
||||
/// </summary>
|
||||
public EmphasisLabelLine emphasisLabelLine { get { return m_EmphasisLabelLines.Count > 0 ? m_EmphasisLabelLines[0] : null; } }
|
||||
/// <summary>
|
||||
/// the icon of data.
|
||||
/// |数据项标题样式。
|
||||
/// </summary>
|
||||
public TitleStyle titleStyle { get { return m_TitleStyles.Count > 0 ? m_TitleStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// style of emphasis state.
|
||||
/// |高亮状态的样式。
|
||||
/// </summary>
|
||||
public EmphasisStyle emphasisStyle { get { return m_EmphasisStyles.Count > 0 ? m_EmphasisStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// style of blur state.
|
||||
/// |淡出状态的样式。
|
||||
/// </summary>
|
||||
public BlurStyle blurStyle { get { return m_BlurStyles.Count > 0 ? m_BlurStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// style of select state.
|
||||
/// |选中状态的样式。
|
||||
/// </summary>
|
||||
public SelectStyle selectStyle { get { return m_SelectStyles.Count > 0 ? m_SelectStyles[0] : null; } }
|
||||
|
||||
public void RemoveAllExtraComponent()
|
||||
{
|
||||
|
||||
@@ -161,6 +161,62 @@ namespace XCharts.Runtime
|
||||
Right
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serie state. Supports normal, emphasis, blur, and select states.
|
||||
/// |Serie状态。支持正常、高亮、淡出、选中四种状态。
|
||||
/// </summary>
|
||||
public enum SerieState
|
||||
{
|
||||
/// <summary>
|
||||
/// Normal state.
|
||||
/// |正常状态。
|
||||
/// </summary>
|
||||
Normal,
|
||||
/// <summary>
|
||||
/// Emphasis state.
|
||||
/// |高亮状态。
|
||||
/// </summary>
|
||||
Emphasis,
|
||||
/// <summary>
|
||||
/// Blur state.
|
||||
/// |淡出状态。
|
||||
/// </summary>
|
||||
Blur,
|
||||
/// <summary>
|
||||
/// Select state.
|
||||
/// |选中状态。
|
||||
/// </summary>
|
||||
Select,
|
||||
/// <summary>
|
||||
/// Auto state.
|
||||
/// |自动保持和父节点一致。一般用在SerieData。
|
||||
/// </summary>
|
||||
Auto
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The policy to take color from theme.
|
||||
/// |从主题中取色策略。
|
||||
/// </summary>
|
||||
public enum SerieColorBy
|
||||
{
|
||||
/// <summary>
|
||||
/// Select state.
|
||||
/// |默认策略。每种Serie都有自己的默认的取颜色策略。比如Line默认是Series策略,Pie默认是Data策略
|
||||
/// </summary>
|
||||
Default,
|
||||
/// <summary>
|
||||
/// assigns the colors in the palette by serie, so that all data in the same series are in the same color;.
|
||||
/// |按照系列分配调色盘中的颜色,同一系列中的所有数据都是用相同的颜色。
|
||||
/// </summary>
|
||||
Serie,
|
||||
/// <summary>
|
||||
/// assigns colors in the palette according to data items, with each data item using a different color..
|
||||
/// |按照数据项分配调色盘中的颜色,每个数据项都使用不同的颜色。
|
||||
/// </summary>
|
||||
Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 系列。
|
||||
/// </summary>
|
||||
@@ -172,6 +228,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private string m_CoordSystem = "GridCoord";
|
||||
[SerializeField] private string m_SerieType = "";
|
||||
[SerializeField] private string m_SerieName;
|
||||
[SerializeField][Since("v3.2.0")] private SerieState m_State = SerieState.Normal;
|
||||
[SerializeField][Since("v3.2.0")] private SerieColorBy m_ColorBy = SerieColorBy.Default;
|
||||
[SerializeField] private string m_Stack;
|
||||
[SerializeField] private int m_XAxisIndex = 0;
|
||||
[SerializeField] private int m_YAxisIndex = 0;
|
||||
@@ -296,6 +354,25 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public string legendName { get { return string.IsNullOrEmpty(serieName) ? ChartCached.IntToStr(index) : serieName; } }
|
||||
/// <summary>
|
||||
/// The default state of a serie.
|
||||
/// |系列的默认状态。
|
||||
/// </summary>
|
||||
public SerieState state
|
||||
{
|
||||
get { return m_State; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_State, value)) { SetAllDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// The policy to take color from theme.
|
||||
/// |从主题中取色的策略。
|
||||
/// </summary>
|
||||
public SerieColorBy colorBy
|
||||
{
|
||||
//get { return m_ColorBy; }
|
||||
get { return m_ColorBy == SerieColorBy.Default?defaultColorBy : m_ColorBy; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ColorBy, value)) { SetAllDirty(); } }
|
||||
}
|
||||
/// <summary>
|
||||
/// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
|
||||
/// |数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。
|
||||
/// </summary>
|
||||
@@ -817,7 +894,10 @@ namespace XCharts.Runtime
|
||||
/// 系列中的数据内容数组。SerieData可以设置1到n维数据。
|
||||
/// </summary>
|
||||
public List<SerieData> data { get { return m_Data; } }
|
||||
|
||||
/// <summary>
|
||||
/// 取色策略是否为按数据项分配。
|
||||
/// </summary>
|
||||
public bool colorByData { get { return colorBy == SerieColorBy.Data; } }
|
||||
public override bool vertsDirty
|
||||
{
|
||||
get
|
||||
@@ -826,12 +906,14 @@ namespace XCharts.Runtime
|
||||
symbol.vertsDirty ||
|
||||
lineStyle.vertsDirty ||
|
||||
itemStyle.vertsDirty ||
|
||||
(lineArrow != null && lineArrow.vertsDirty) ||
|
||||
(areaStyle != null && areaStyle.vertsDirty) ||
|
||||
(label != null && label.vertsDirty) ||
|
||||
(labelLine != null && labelLine.vertsDirty) ||
|
||||
(emphasisItemStyle != null && emphasisItemStyle.vertsDirty) ||
|
||||
(titleStyle != null && titleStyle.vertsDirty) ||
|
||||
IsVertsDirty(lineArrow) ||
|
||||
IsVertsDirty(areaStyle) ||
|
||||
IsVertsDirty(label) ||
|
||||
IsVertsDirty(labelLine) ||
|
||||
IsVertsDirty(titleStyle) ||
|
||||
IsVertsDirty(emphasisStyle) ||
|
||||
IsVertsDirty(blurStyle) ||
|
||||
IsVertsDirty(selectStyle) ||
|
||||
AnySerieDataVerticesDirty();
|
||||
}
|
||||
}
|
||||
@@ -842,11 +924,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
return m_ComponentDirty ||
|
||||
symbol.componentDirty ||
|
||||
(titleStyle != null && titleStyle.componentDirty) ||
|
||||
(label != null && label.componentDirty) ||
|
||||
(labelLine != null && labelLine.componentDirty) ||
|
||||
(emphasisLabel != null && emphasisLabel.componentDirty) ||
|
||||
(emphasisLabelLine != null && emphasisLabelLine.componentDirty);
|
||||
IsComponentDirty(titleStyle) ||
|
||||
IsComponentDirty(label) ||
|
||||
IsComponentDirty(labelLine) ||
|
||||
IsComponentDirty(emphasisStyle) ||
|
||||
IsComponentDirty(blurStyle) ||
|
||||
IsComponentDirty(selectStyle);
|
||||
}
|
||||
}
|
||||
public override void ClearVerticesDirty()
|
||||
@@ -860,16 +943,13 @@ namespace XCharts.Runtime
|
||||
symbol.ClearVerticesDirty();
|
||||
lineStyle.ClearVerticesDirty();
|
||||
itemStyle.ClearVerticesDirty();
|
||||
if (areaStyle != null)
|
||||
areaStyle.ClearVerticesDirty();
|
||||
if (label != null)
|
||||
label.ClearVerticesDirty();
|
||||
if (emphasisItemStyle != null)
|
||||
emphasisItemStyle.ClearVerticesDirty();
|
||||
if (lineArrow != null)
|
||||
lineArrow.ClearVerticesDirty();
|
||||
if (titleStyle != null)
|
||||
titleStyle.ClearVerticesDirty();
|
||||
ClearVerticesDirty(areaStyle);
|
||||
ClearVerticesDirty(label);
|
||||
ClearVerticesDirty(emphasisStyle);
|
||||
ClearVerticesDirty(blurStyle);
|
||||
ClearVerticesDirty(selectStyle);
|
||||
ClearVerticesDirty(lineArrow);
|
||||
ClearVerticesDirty(titleStyle);
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
@@ -883,18 +963,13 @@ namespace XCharts.Runtime
|
||||
symbol.ClearComponentDirty();
|
||||
lineStyle.ClearComponentDirty();
|
||||
itemStyle.ClearComponentDirty();
|
||||
if (areaStyle != null)
|
||||
areaStyle.ClearComponentDirty();
|
||||
if (label != null)
|
||||
label.ClearComponentDirty();
|
||||
if (emphasisLabel != null)
|
||||
emphasisLabel.ClearComponentDirty();
|
||||
if (emphasisLabelLine != null)
|
||||
emphasisLabelLine.ClearComponentDirty();
|
||||
if (lineArrow != null)
|
||||
lineArrow.ClearComponentDirty();
|
||||
if (titleStyle != null)
|
||||
titleStyle.ClearComponentDirty();
|
||||
ClearComponentDirty(areaStyle);
|
||||
ClearComponentDirty(label);
|
||||
ClearComponentDirty(emphasisStyle);
|
||||
ClearComponentDirty(blurStyle);
|
||||
ClearComponentDirty(selectStyle);
|
||||
ClearComponentDirty(lineArrow);
|
||||
ClearComponentDirty(titleStyle);
|
||||
}
|
||||
|
||||
public override void SetAllDirty()
|
||||
@@ -1084,6 +1159,23 @@ namespace XCharts.Runtime
|
||||
serieData.interact.Reset();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置数据项索引。避免部分数据项的索引异常。
|
||||
/// </summary>
|
||||
public bool ResetDataIndex()
|
||||
{
|
||||
var flag = false;
|
||||
for (int i = 0; i < m_Data.Count; i++)
|
||||
{
|
||||
if (m_Data[i].index != i)
|
||||
{
|
||||
m_Data[i].index = i;
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空所有数据
|
||||
/// </summary>
|
||||
@@ -1665,7 +1757,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public bool IsLegendName(string legendName)
|
||||
{
|
||||
if (useDataNameForColor)
|
||||
if (colorBy == SerieColorBy.Data)
|
||||
{
|
||||
return IsSerieDataLegendName(legendName) || IsSerieLegendName(legendName);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,10 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public int vertCount;
|
||||
/// <summary>
|
||||
/// theme的颜色索引
|
||||
/// </summary>
|
||||
public int colorIndex;
|
||||
/// <summary>
|
||||
/// 数据对应的位置坐标。
|
||||
/// </summary>
|
||||
public List<Vector3> dataPoints = new List<Vector3>();
|
||||
@@ -92,15 +96,15 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public List<bool> dataIgnores = new List<bool>();
|
||||
/// <summary>
|
||||
/// 数据对应的index索引。dataIndexs 和 dataPoints 一一对应。
|
||||
/// </summary>
|
||||
public List<int> dataIndexs = new List<int>();
|
||||
/// <summary>
|
||||
/// 排序后的数据
|
||||
/// </summary>
|
||||
public List<SerieData> sortedData = new List<SerieData>();
|
||||
public List<SerieData> rootData = new List<SerieData>();
|
||||
/// <summary>
|
||||
/// theme的颜色索引
|
||||
/// </summary>
|
||||
public int colorIndex;
|
||||
/// <summary>
|
||||
/// 绘制点
|
||||
/// </summary>
|
||||
public List<PointInfo> drawPoints = new List<PointInfo>();
|
||||
|
||||
@@ -16,9 +16,10 @@ namespace XCharts.Runtime
|
||||
{
|
||||
"m_Id",
|
||||
"m_ParentId",
|
||||
"m_State",
|
||||
"m_Ignore",
|
||||
"m_Selected",
|
||||
"m_Radius"
|
||||
"m_Radius",
|
||||
};
|
||||
public static Dictionary<Type, string> extraComponentMap = new Dictionary<Type, string>
|
||||
{ { typeof(ItemStyle), "m_ItemStyles" },
|
||||
@@ -28,9 +29,9 @@ namespace XCharts.Runtime
|
||||
{ typeof(LineStyle), "m_LineStyles" },
|
||||
{ typeof(AreaStyle), "m_AreaStyles" },
|
||||
{ typeof(TitleStyle), "m_TitleStyles" },
|
||||
{ typeof(EmphasisItemStyle), "m_EmphasisItemStyles" },
|
||||
{ typeof(EmphasisLabelStyle), "m_EmphasisLabels" },
|
||||
{ typeof(EmphasisLabelLine), "m_EmphasisLabelLines" },
|
||||
{ typeof(EmphasisStyle), "m_EmphasisStyles" },
|
||||
{ typeof(BlurStyle), "m_BlurStyles" },
|
||||
{ typeof(SelectStyle), "m_SelectStyles" },
|
||||
};
|
||||
|
||||
[SerializeField] private int m_Index;
|
||||
@@ -40,6 +41,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private bool m_Ignore;
|
||||
[SerializeField] private bool m_Selected;
|
||||
[SerializeField] private float m_Radius;
|
||||
[SerializeField][Since("v3.2.0")] private SerieState m_State = SerieState.Auto;
|
||||
[SerializeField][IgnoreDoc] private List<ItemStyle> m_ItemStyles = new List<ItemStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<LabelStyle> m_Labels = new List<LabelStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<LabelLine> m_LabelLines = new List<LabelLine>();
|
||||
@@ -47,9 +49,9 @@ namespace XCharts.Runtime
|
||||
[SerializeField][IgnoreDoc] private List<LineStyle> m_LineStyles = new List<LineStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<AreaStyle> m_AreaStyles = new List<AreaStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<TitleStyle> m_TitleStyles = new List<TitleStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisItemStyle> m_EmphasisItemStyles = new List<EmphasisItemStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisLabelStyle> m_EmphasisLabels = new List<EmphasisLabelStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisLabelLine> m_EmphasisLabelLines = new List<EmphasisLabelLine>();
|
||||
[SerializeField][IgnoreDoc] private List<EmphasisStyle> m_EmphasisStyles = new List<EmphasisStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<BlurStyle> m_BlurStyles = new List<BlurStyle>();
|
||||
[SerializeField][IgnoreDoc] private List<SelectStyle> m_SelectStyles = new List<SelectStyle>();
|
||||
[SerializeField] private List<double> m_Data = new List<double>();
|
||||
|
||||
[NonSerialized] public SerieDataContext context = new SerieDataContext();
|
||||
@@ -97,6 +99,11 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public bool selected { get { return m_Selected; } set { m_Selected = value; } }
|
||||
/// <summary>
|
||||
/// the state of serie data.
|
||||
/// |数据项的默认状态。
|
||||
/// </summary>
|
||||
public SerieState state { get { return m_State; } set { m_State = value; } }
|
||||
/// <summary>
|
||||
/// 数据项图例名称。当数据项名称不为空时,图例名称即为系列名称;反之则为索引index。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
@@ -119,17 +126,17 @@ namespace XCharts.Runtime
|
||||
public AreaStyle areaStyle { get { return m_AreaStyles.Count > 0 ? m_AreaStyles[0] : null; } }
|
||||
public TitleStyle titleStyle { get { return m_TitleStyles.Count > 0 ? m_TitleStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮的图形样式
|
||||
/// 高亮状态的样式
|
||||
/// </summary>
|
||||
public EmphasisItemStyle emphasisItemStyle { get { return m_EmphasisItemStyles.Count > 0 ? m_EmphasisItemStyles[0] : null; } }
|
||||
public EmphasisStyle emphasisStyle { get { return m_EmphasisStyles.Count > 0 ? m_EmphasisStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮时的标签样式
|
||||
/// 淡出状态的样式。
|
||||
/// </summary>
|
||||
public EmphasisLabelStyle emphasisLabel { get { return m_EmphasisLabels.Count > 0 ? m_EmphasisLabels[0] : null; } }
|
||||
public BlurStyle blurStyle { get { return m_BlurStyles.Count > 0 ? m_BlurStyles[0] : null; } }
|
||||
/// <summary>
|
||||
/// 高亮时的标签引导线样式
|
||||
/// 选中状态的样式。
|
||||
/// </summary>
|
||||
public EmphasisLabelLine emphasisLabelLine { get { return m_EmphasisLabelLines.Count > 0 ? m_EmphasisLabelLines[0] : null; } }
|
||||
public SelectStyle selectStyle { get { return m_SelectStyles.Count > 0 ? m_SelectStyles[0] : null; } }
|
||||
|
||||
/// <summary>
|
||||
/// An arbitrary dimension data list of data item.
|
||||
@@ -152,12 +159,14 @@ namespace XCharts.Runtime
|
||||
get
|
||||
{
|
||||
return m_VertsDirty ||
|
||||
(labelLine != null && labelLine.vertsDirty) ||
|
||||
(itemStyle != null && itemStyle.vertsDirty) ||
|
||||
(symbol != null && symbol.vertsDirty) ||
|
||||
(lineStyle != null && lineStyle.vertsDirty) ||
|
||||
(areaStyle != null && areaStyle.vertsDirty) ||
|
||||
(emphasisItemStyle != null && emphasisItemStyle.vertsDirty);
|
||||
IsVertsDirty(labelLine) ||
|
||||
IsVertsDirty(itemStyle) ||
|
||||
IsVertsDirty(symbol) ||
|
||||
IsVertsDirty(lineStyle) ||
|
||||
IsVertsDirty(areaStyle) ||
|
||||
IsVertsDirty(emphasisStyle) ||
|
||||
IsVertsDirty(blurStyle) ||
|
||||
IsVertsDirty(selectStyle);
|
||||
}
|
||||
}
|
||||
public override bool componentDirty
|
||||
@@ -165,35 +174,38 @@ namespace XCharts.Runtime
|
||||
get
|
||||
{
|
||||
return m_ComponentDirty ||
|
||||
(labelStyle != null && labelStyle.componentDirty) ||
|
||||
(labelLine != null && labelLine.componentDirty) ||
|
||||
(titleStyle != null && titleStyle.componentDirty) ||
|
||||
(emphasisLabel != null && emphasisLabel.componentDirty) ||
|
||||
(emphasisLabelLine != null && emphasisLabelLine.componentDirty);
|
||||
IsComponentDirty(labelStyle) ||
|
||||
IsComponentDirty(labelLine) ||
|
||||
IsComponentDirty(titleStyle) ||
|
||||
IsComponentDirty(emphasisStyle) ||
|
||||
IsComponentDirty(blurStyle) ||
|
||||
IsComponentDirty(selectStyle);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ClearVerticesDirty()
|
||||
{
|
||||
base.ClearVerticesDirty();
|
||||
if (labelLine != null) labelLine.ClearVerticesDirty();
|
||||
if (itemStyle != null) itemStyle.ClearVerticesDirty();
|
||||
if (lineStyle != null) lineStyle.ClearVerticesDirty();
|
||||
if (areaStyle != null) areaStyle.ClearVerticesDirty();
|
||||
if (symbol != null) symbol.ClearVerticesDirty();
|
||||
if (emphasisItemStyle != null) emphasisItemStyle.ClearVerticesDirty();
|
||||
ClearVerticesDirty(labelLine);
|
||||
ClearVerticesDirty(itemStyle);
|
||||
ClearVerticesDirty(lineStyle);
|
||||
ClearVerticesDirty(areaStyle);
|
||||
ClearVerticesDirty(emphasisStyle);
|
||||
ClearVerticesDirty(blurStyle);
|
||||
ClearVerticesDirty(selectStyle);
|
||||
}
|
||||
|
||||
public override void ClearComponentDirty()
|
||||
{
|
||||
base.ClearComponentDirty();
|
||||
if (labelLine != null) labelLine.ClearComponentDirty();
|
||||
if (itemStyle != null) itemStyle.ClearComponentDirty();
|
||||
if (lineStyle != null) lineStyle.ClearComponentDirty();
|
||||
if (areaStyle != null) areaStyle.ClearComponentDirty();
|
||||
if (symbol != null) symbol.ClearComponentDirty();
|
||||
if (emphasisLabel != null) emphasisLabel.ClearComponentDirty();
|
||||
if (emphasisLabelLine != null) emphasisLabelLine.ClearComponentDirty();
|
||||
ClearComponentDirty(labelLine);
|
||||
ClearComponentDirty(itemStyle);
|
||||
ClearComponentDirty(lineStyle);
|
||||
ClearComponentDirty(areaStyle);
|
||||
ClearComponentDirty(symbol);
|
||||
ClearComponentDirty(emphasisStyle);
|
||||
ClearComponentDirty(blurStyle);
|
||||
ClearComponentDirty(selectStyle);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
@@ -217,9 +229,9 @@ namespace XCharts.Runtime
|
||||
m_LineStyles.Clear();
|
||||
m_AreaStyles.Clear();
|
||||
m_TitleStyles.Clear();
|
||||
m_EmphasisItemStyles.Clear();
|
||||
m_EmphasisLabels.Clear();
|
||||
m_EmphasisLabelLines.Clear();
|
||||
m_EmphasisStyles.Clear();
|
||||
m_BlurStyles.Clear();
|
||||
m_SelectStyles.Clear();
|
||||
}
|
||||
|
||||
public T GetOrAddComponent<T>() where T : ChildComponent, ISerieDataComponent
|
||||
@@ -247,23 +259,23 @@ namespace XCharts.Runtime
|
||||
m_LabelLines.Add(new LabelLine() { show = true });
|
||||
return m_LabelLines[0];
|
||||
}
|
||||
else if (type == typeof(EmphasisItemStyle))
|
||||
else if (type == typeof(EmphasisStyle))
|
||||
{
|
||||
if (m_EmphasisItemStyles.Count == 0)
|
||||
m_EmphasisItemStyles.Add(new EmphasisItemStyle() { show = true });
|
||||
return m_EmphasisItemStyles[0];
|
||||
if (m_EmphasisStyles.Count == 0)
|
||||
m_EmphasisStyles.Add(new EmphasisStyle() { show = true });
|
||||
return m_EmphasisStyles[0];
|
||||
}
|
||||
else if (type == typeof(EmphasisLabelStyle))
|
||||
else if (type == typeof(BlurStyle))
|
||||
{
|
||||
if (m_EmphasisLabels.Count == 0)
|
||||
m_EmphasisLabels.Add(new EmphasisLabelStyle() { show = true });
|
||||
return m_EmphasisLabels[0];
|
||||
if (m_BlurStyles.Count == 0)
|
||||
m_BlurStyles.Add(new BlurStyle() { show = true });
|
||||
return m_BlurStyles[0];
|
||||
}
|
||||
else if (type == typeof(EmphasisLabelLine))
|
||||
else if (type == typeof(SelectStyle))
|
||||
{
|
||||
if (m_EmphasisLabelLines.Count == 0)
|
||||
m_EmphasisLabelLines.Add(new EmphasisLabelLine() { show = true });
|
||||
return m_EmphasisLabelLines[0];
|
||||
if (m_SelectStyles.Count == 0)
|
||||
m_SelectStyles.Add(new SelectStyle() { show = true });
|
||||
return m_SelectStyles[0];
|
||||
}
|
||||
else if (type == typeof(SerieSymbol))
|
||||
{
|
||||
@@ -301,9 +313,9 @@ namespace XCharts.Runtime
|
||||
m_Labels.Clear();
|
||||
m_LabelLines.Clear();
|
||||
m_Symbols.Clear();
|
||||
m_EmphasisItemStyles.Clear();
|
||||
m_EmphasisLabels.Clear();
|
||||
m_EmphasisLabelLines.Clear();
|
||||
m_EmphasisStyles.Clear();
|
||||
m_BlurStyles.Clear();
|
||||
m_SelectStyles.Clear();
|
||||
m_LineStyles.Clear();
|
||||
m_AreaStyles.Clear();
|
||||
m_TitleStyles.Clear();
|
||||
@@ -322,12 +334,12 @@ namespace XCharts.Runtime
|
||||
m_Labels.Clear();
|
||||
else if (type == typeof(LabelLine))
|
||||
m_LabelLines.Clear();
|
||||
else if (type == typeof(EmphasisItemStyle))
|
||||
m_EmphasisItemStyles.Clear();
|
||||
else if (type == typeof(EmphasisLabelStyle))
|
||||
m_EmphasisLabels.Clear();
|
||||
else if (type == typeof(EmphasisLabelLine))
|
||||
m_EmphasisLabelLines.Clear();
|
||||
else if (type == typeof(EmphasisStyle))
|
||||
m_EmphasisStyles.Clear();
|
||||
else if (type == typeof(BlurStyle))
|
||||
m_BlurStyles.Clear();
|
||||
else if (type == typeof(SelectStyle))
|
||||
m_SelectStyles.Clear();
|
||||
else if (type == typeof(SerieSymbol))
|
||||
m_Symbols.Clear();
|
||||
else if (type == typeof(LineStyle))
|
||||
@@ -537,6 +549,10 @@ namespace XCharts.Runtime
|
||||
public void SetLabelActive(bool flag)
|
||||
{
|
||||
if (labelObject != null) labelObject.SetActive(flag);
|
||||
foreach (var labelObject in context.dataLabels)
|
||||
{
|
||||
labelObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
public void SetIconActive(bool flag)
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace XCharts.Runtime
|
||||
public virtual void RefreshLabelInternal() { }
|
||||
public virtual void UpdateTooltipSerieParams(int dataIndex, bool showCategory,
|
||||
string category, string marker,
|
||||
string itemFormatter, string numericFormatter,
|
||||
string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
ref List<SerieParams> paramList, ref string title) { }
|
||||
public virtual void OnLegendButtonClick(int index, string legendName, bool show) { }
|
||||
public virtual void OnLegendButtonEnter(int index, string legendName) { }
|
||||
@@ -144,7 +144,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void OnLegendButtonClick(int index, string legendName, bool show)
|
||||
{
|
||||
if (serie.useDataNameForColor && serie.IsSerieDataLegendName(legendName))
|
||||
if (serie.colorByData && serie.IsSerieDataLegendName(legendName))
|
||||
{
|
||||
LegendHelper.CheckDataShow(serie, legendName, show);
|
||||
chart.UpdateLegendColor(legendName, show);
|
||||
@@ -159,7 +159,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void OnLegendButtonEnter(int index, string legendName)
|
||||
{
|
||||
if (serie.useDataNameForColor && serie.IsSerieDataLegendName(legendName))
|
||||
if (serie.colorByData && serie.IsSerieDataLegendName(legendName))
|
||||
{
|
||||
LegendHelper.CheckDataHighlighted(serie, legendName, true);
|
||||
chart.RefreshPainter(serie);
|
||||
@@ -173,7 +173,7 @@ namespace XCharts.Runtime
|
||||
|
||||
public override void OnLegendButtonExit(int index, string legendName)
|
||||
{
|
||||
if (serie.useDataNameForColor && serie.IsSerieDataLegendName(legendName))
|
||||
if (serie.colorByData && serie.IsSerieDataLegendName(legendName))
|
||||
{
|
||||
LegendHelper.CheckDataHighlighted(serie, legendName, false);
|
||||
chart.RefreshPainter(serie);
|
||||
@@ -212,13 +212,12 @@ namespace XCharts.Runtime
|
||||
chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta);
|
||||
m_SerieLabelRoot.hideFlags = chart.chartHideFlags;
|
||||
SerieLabelPool.ReleaseAll(m_SerieLabelRoot.transform);
|
||||
//ChartHelper.DestroyAllChildren(m_SerieLabelRoot.transform);
|
||||
int count = 0;
|
||||
SerieHelper.UpdateCenter(serie, chart.chartPosition, chart.chartWidth, chart.chartHeight);
|
||||
for (int j = 0; j < serie.data.Count; j++)
|
||||
{
|
||||
var serieData = serie.data[j];
|
||||
serieData.index = count;
|
||||
serieData.index = j;
|
||||
serieData.labelObject = null;
|
||||
if (AddSerieLabel(m_SerieLabelRoot, serieData, ref count))
|
||||
{
|
||||
@@ -240,11 +239,9 @@ namespace XCharts.Runtime
|
||||
|
||||
if (count == -1) count = serie.dataCount;
|
||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||
if (serieLabel == null)
|
||||
if (serieLabel == null || !serieLabel.show)
|
||||
{
|
||||
serieLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
|
||||
if (serieLabel == null || !serieLabel.show)
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
var dataAutoColor = GetSerieDataAutoColor(serieData);
|
||||
@@ -371,18 +368,22 @@ namespace XCharts.Runtime
|
||||
return;
|
||||
|
||||
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||
var needCheck = serie.context.dataIndexs.Count > 0;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
if (serieData.labelObject == null && serieData.context.dataLabels.Count <= 0)
|
||||
{
|
||||
continue;
|
||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||
var emphasisLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
|
||||
var isHighlight = (serieData.context.highlight && emphasisLabel != null && emphasisLabel.show);
|
||||
}
|
||||
if (needCheck && !serie.context.dataIndexs.Contains(serieData.index))
|
||||
{
|
||||
serieData.SetLabelActive(false);
|
||||
continue;
|
||||
};
|
||||
var currLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||
var isIgnore = serie.IsIgnoreIndex(serieData.index, defaultDimension);
|
||||
var currLabel = isHighlight && emphasisLabel != null ? emphasisLabel : serieLabel;
|
||||
if (serie.show &&
|
||||
currLabel != null &&
|
||||
(currLabel.show || isHighlight) &&
|
||||
serieData.context.canShowLabel &&
|
||||
!isIgnore)
|
||||
{
|
||||
@@ -396,7 +397,7 @@ namespace XCharts.Runtime
|
||||
var labelObject = serieData.context.dataLabels[i];
|
||||
var value = serieData.GetCurrData(i, dataChangeDuration);
|
||||
var content = string.IsNullOrEmpty(currLabel.formatter) ?
|
||||
ChartCached.NumberToStr(value, serieLabel.numericFormatter) :
|
||||
ChartCached.NumberToStr(value, currLabel.numericFormatter) :
|
||||
SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
|
||||
currLabel, color);
|
||||
var offset = GetSerieDataLabelOffset(serieData, currLabel);
|
||||
@@ -418,7 +419,7 @@ namespace XCharts.Runtime
|
||||
var total = serie.GetDataTotal(defaultDimension, serieData);
|
||||
var color = chart.GetItemColor(serie, serieData);
|
||||
var content = string.IsNullOrEmpty(currLabel.formatter) ?
|
||||
ChartCached.NumberToStr(value, serieLabel.numericFormatter) :
|
||||
ChartCached.NumberToStr(value, currLabel.numericFormatter) :
|
||||
SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
|
||||
currLabel, color);
|
||||
serieData.SetLabelActive(!isIgnore);
|
||||
@@ -436,10 +437,6 @@ namespace XCharts.Runtime
|
||||
else
|
||||
{
|
||||
serieData.SetLabelActive(false);
|
||||
foreach (var labelObject in serieData.context.dataLabels)
|
||||
{
|
||||
labelObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -491,14 +488,17 @@ namespace XCharts.Runtime
|
||||
|
||||
public virtual Color GetSerieDataAutoColor(SerieData serieData)
|
||||
{
|
||||
var colorIndex = serie.useDataNameForColor ? serieData.index : serie.index;
|
||||
return (Color) SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false, false);
|
||||
var colorIndex = serie.colorByData ? serieData.index : serie.index;
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal, false);
|
||||
return (Color) color;
|
||||
}
|
||||
|
||||
protected void UpdateCoordSerieParams(ref List<SerieParams> paramList, ref string title,
|
||||
int dataIndex, bool showCategory, string category, string marker,
|
||||
string itemFormatter, string numericFormatter)
|
||||
string itemFormatter, string numericFormatter, string ignoreDataDefaultContent)
|
||||
{
|
||||
var dimension = 1;
|
||||
if (dataIndex < 0)
|
||||
dataIndex = serie.context.pointerItemDataIndex;
|
||||
|
||||
@@ -509,62 +509,77 @@ namespace XCharts.Runtime
|
||||
if (serieData == null)
|
||||
return;
|
||||
|
||||
itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
if (serie.placeHolder || TooltipHelper.IsIgnoreFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
var param = serie.context.param;
|
||||
param.serieName = serie.serieName;
|
||||
param.serieIndex = serie.index;
|
||||
param.category = category;
|
||||
param.dimension = 1;
|
||||
param.serieData = serieData;
|
||||
param.dataCount = serie.dataCount;
|
||||
param.value = serieData.GetData(1);
|
||||
param.total = serie.yTotal;
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, serie.context.colorIndex, false);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = itemFormatter;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
param.columns.Clear();
|
||||
|
||||
param.columns.Add(param.marker);
|
||||
param.columns.Add(showCategory ? category : serie.serieName);
|
||||
param.columns.Add(ChartCached.NumberToStr(param.value, param.numericFormatter));
|
||||
|
||||
paramList.Add(param);
|
||||
}
|
||||
|
||||
protected void UpdateItemSerieParams(ref List<SerieParams> paramList, ref string title,
|
||||
int dataIndex, string category, string marker,
|
||||
string itemFormatter, string numericFormatter, int dimension = 1)
|
||||
{
|
||||
if (dataIndex < 0)
|
||||
dataIndex = serie.context.pointerItemDataIndex;
|
||||
|
||||
if (dataIndex < 0)
|
||||
return;
|
||||
|
||||
var serieData = serie.GetSerieData(dataIndex);
|
||||
if (serieData == null)
|
||||
var ignore = serie.IsIgnoreValue(serieData, dimension);
|
||||
if (ignore && string.IsNullOrEmpty(ignoreDataDefaultContent))
|
||||
return;
|
||||
|
||||
itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
if (serie.placeHolder || TooltipHelper.IsIgnoreFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
var colorIndex = chart.GetLegendRealShowNameIndex(serieData.name);
|
||||
|
||||
var param = serie.context.param;
|
||||
param.serieName = serie.serieName;
|
||||
param.serieIndex = serie.index;
|
||||
param.category = category;
|
||||
param.dimension = dimension;
|
||||
param.serieData = serieData;
|
||||
param.dataCount = serie.dataCount;
|
||||
param.value = serieData.GetData(dimension);
|
||||
param.ignore = ignore;
|
||||
param.total = serie.yTotal;
|
||||
param.color = chart.GetItemColor(serie, serieData);
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = itemFormatter;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
param.columns.Clear();
|
||||
|
||||
param.columns.Add(param.marker);
|
||||
param.columns.Add(showCategory ? category : serie.serieName);
|
||||
param.columns.Add(ignore?ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter));
|
||||
|
||||
paramList.Add(param);
|
||||
}
|
||||
|
||||
protected void UpdateItemSerieParams(ref List<SerieParams> paramList, ref string title,
|
||||
int dataIndex, string category, string marker,
|
||||
string itemFormatter, string numericFormatter, string ignoreDataDefaultContent,
|
||||
int dimension = 1, int colorIndex = -1)
|
||||
{
|
||||
if (dataIndex < 0)
|
||||
dataIndex = serie.context.pointerItemDataIndex;
|
||||
|
||||
if (dataIndex < 0)
|
||||
return;
|
||||
|
||||
var serieData = serie.GetSerieData(dataIndex);
|
||||
if (serieData == null)
|
||||
return;
|
||||
|
||||
var ignore = serie.IsIgnoreValue(serieData, dimension);
|
||||
if (ignore && string.IsNullOrEmpty(ignoreDataDefaultContent))
|
||||
return;
|
||||
|
||||
itemFormatter = SerieHelper.GetItemFormatter(serie, serieData, itemFormatter);
|
||||
if (serie.placeHolder || TooltipHelper.IsIgnoreFormatter(itemFormatter))
|
||||
return;
|
||||
|
||||
if (colorIndex < 0)
|
||||
colorIndex = serie.colorByData?dataIndex : chart.GetLegendRealShowNameIndex(serieData.name);
|
||||
|
||||
Color32 color, toColor;
|
||||
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal);
|
||||
var param = serie.context.param;
|
||||
param.serieName = serie.serieName;
|
||||
param.serieIndex = serie.index;
|
||||
|
||||
param.category = category;
|
||||
param.dimension = dimension;
|
||||
param.serieData = serieData;
|
||||
param.dataCount = serie.dataCount;
|
||||
param.value = serieData.GetData(param.dimension);
|
||||
param.ignore = ignore;
|
||||
param.total = SerieHelper.GetMaxData(serie, dimension);
|
||||
param.color = SerieHelper.GetItemColor(serie, serieData, chart.theme, colorIndex, false);
|
||||
param.color = color;
|
||||
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
|
||||
param.itemFormatter = itemFormatter;
|
||||
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
|
||||
@@ -572,7 +587,8 @@ namespace XCharts.Runtime
|
||||
|
||||
param.columns.Add(param.marker);
|
||||
param.columns.Add(serieData.name);
|
||||
param.columns.Add(ChartCached.NumberToStr(param.value, param.numericFormatter));
|
||||
|
||||
param.columns.Add(ignore?ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter));
|
||||
|
||||
paramList.Add(param);
|
||||
}
|
||||
|
||||
@@ -242,105 +242,158 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static SerieState GetSerieState(Serie serie)
|
||||
{
|
||||
if (serie.highlight) return SerieState.Emphasis;
|
||||
return serie.state;
|
||||
}
|
||||
|
||||
public static SerieState GetSerieState(SerieData serieData)
|
||||
{
|
||||
if (serieData.context.highlight) return SerieState.Emphasis;
|
||||
return serieData.state;
|
||||
}
|
||||
|
||||
public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)
|
||||
{
|
||||
if (serieData == null) return GetSerieState(serie);
|
||||
if (serieData.context.highlight) return SerieState.Emphasis;
|
||||
if (serieData.state == SerieState.Auto) return defaultSerieState?serie.state : GetSerieState(serie);
|
||||
return serieData.state;
|
||||
}
|
||||
|
||||
public static Color32 GetItemBackgroundColor(Serie serie, SerieData serieData, ThemeStyle theme, int index,
|
||||
bool highlight, bool useDefault = true)
|
||||
SerieState state = SerieState.Auto, bool useDefault = false)
|
||||
{
|
||||
var color = ChartConst.clearColor32;
|
||||
if (highlight)
|
||||
{
|
||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
|
||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.backgroundColor))
|
||||
{
|
||||
color = itemStyleEmphasis.backgroundColor;
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
var itemStyle = GetItemStyle(serie, serieData);
|
||||
if (!ChartHelper.IsClearColor(itemStyle.backgroundColor))
|
||||
{
|
||||
color = itemStyle.backgroundColor;
|
||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||
return color;
|
||||
}
|
||||
else if (useDefault)
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
color = GetItemStyle(serie, serieData, SerieState.Normal).backgroundColor;
|
||||
else
|
||||
color = stateStyle.itemStyle.backgroundColor;
|
||||
if (useDefault && ChartHelper.IsClearColor(color))
|
||||
{
|
||||
color = theme.GetColor(index);
|
||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||
color.a = 50;
|
||||
return color;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)
|
||||
public static void GetItemColor(out Color32 color, out Color32 toColor,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)
|
||||
{
|
||||
if (serie == null)
|
||||
return ChartConst.clearColor32;
|
||||
|
||||
ItemStyle itemStyle = null;
|
||||
if (highlight)
|
||||
itemStyle = GetItemStyleEmphasis(serie, serieData);
|
||||
if (itemStyle == null)
|
||||
itemStyle = GetItemStyle(serie, serieData);
|
||||
|
||||
var color = ChartHelper.IsClearColor(itemStyle.color) ?
|
||||
theme.GetColor(index) :
|
||||
itemStyle.color;
|
||||
|
||||
if (highlight)
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
if (opacity)
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||
return color;
|
||||
}
|
||||
public static Color32 GetItemColor0(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, Color32 defaultColor)
|
||||
{
|
||||
if (serie == null)
|
||||
return ChartConst.clearColor32;
|
||||
|
||||
ItemStyle itemStyle = null;
|
||||
if (highlight)
|
||||
itemStyle = GetItemStyleEmphasis(serie, serieData);
|
||||
if (itemStyle == null)
|
||||
itemStyle = GetItemStyle(serie, serieData);
|
||||
|
||||
var color = ChartHelper.IsClearColor(itemStyle.color0) ?
|
||||
defaultColor :
|
||||
itemStyle.color0;
|
||||
|
||||
if (highlight)
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||
return color;
|
||||
var colorIndex = serieData != null && serie.colorByData? serieData.index : serie.context.colorIndex;
|
||||
GetItemColor(out color, out toColor, serie, serieData, theme, colorIndex, state, true);
|
||||
}
|
||||
|
||||
public static Color32 GetItemToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true)
|
||||
public static void GetItemColor(out Color32 color, out Color32 toColor,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)
|
||||
{
|
||||
if (serie == null)
|
||||
return ChartConst.clearColor32;
|
||||
|
||||
ItemStyle itemStyle = null;
|
||||
if (highlight)
|
||||
itemStyle = GetItemStyleEmphasis(serie, serieData);
|
||||
if (itemStyle == null)
|
||||
itemStyle = GetItemStyle(serie, serieData);
|
||||
|
||||
var color = itemStyle.toColor;
|
||||
if (ChartHelper.IsClearColor(color))
|
||||
color = ColorUtil.clearColor32;
|
||||
toColor = ColorUtil.clearColor32;
|
||||
if (serie == null) return;
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
color = ChartHelper.IsClearColor(itemStyle.color) ?
|
||||
theme.GetColor(index) :
|
||||
itemStyle.color;
|
||||
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
||||
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
||||
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity);
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
toColor = ChartHelper.GetHighlightColor(toColor);
|
||||
break;
|
||||
case SerieState.Blur:
|
||||
color = ChartHelper.GetBlurColor(color);
|
||||
toColor = ChartHelper.GetBlurColor(toColor);
|
||||
break;
|
||||
case SerieState.Select:
|
||||
color = ChartHelper.GetSelectColor(color);
|
||||
toColor = ChartHelper.GetSelectColor(toColor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||
}
|
||||
}
|
||||
|
||||
if (highlight)
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
public static void GetItemColor(out Color32 color, out Color32 toColor, out Color32 backgroundColor,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)
|
||||
{
|
||||
color = ColorUtil.clearColor32;
|
||||
toColor = ColorUtil.clearColor32;
|
||||
backgroundColor = ColorUtil.clearColor32;
|
||||
if (serie == null) return;
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var style = GetItemStyle(serie, serieData, SerieState.Normal);
|
||||
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
||||
GetColor(ref toColor, style.toColor, color, style.opacity, theme, index, opacity);
|
||||
backgroundColor = style.backgroundColor;
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
toColor = ChartHelper.GetHighlightColor(toColor);
|
||||
break;
|
||||
case SerieState.Blur:
|
||||
color = ChartHelper.GetBlurColor(color);
|
||||
toColor = ChartHelper.GetBlurColor(toColor);
|
||||
break;
|
||||
case SerieState.Select:
|
||||
color = ChartHelper.GetSelectColor(color);
|
||||
toColor = ChartHelper.GetSelectColor(toColor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundColor = stateStyle.itemStyle.backgroundColor;
|
||||
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||
GetColor(ref toColor, stateStyle.itemStyle.toColor, color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||
}
|
||||
}
|
||||
|
||||
if (opacity)
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
|
||||
public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)
|
||||
{
|
||||
var color = ColorUtil.clearColor32;
|
||||
if (serie == null) return color;
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null || !stateStyle.itemStyle.show)
|
||||
{
|
||||
var style = GetItemStyle(serie, serieData);
|
||||
GetColor(ref color, style.color, style.color, style.opacity, theme, index, opacity);
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
break;
|
||||
case SerieState.Blur:
|
||||
color = ChartHelper.GetBlurColor(color);
|
||||
break;
|
||||
case SerieState.Select:
|
||||
color = ChartHelper.GetSelectColor(color);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetColor(ref color, stateStyle.itemStyle.color, stateStyle.itemStyle.color, stateStyle.itemStyle.opacity, theme, index, opacity);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -370,72 +423,60 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, bool highlight = false)
|
||||
public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
|
||||
{
|
||||
if (highlight)
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
if (state == SerieState.Normal)
|
||||
{
|
||||
var style = GetItemStyleEmphasis(serie, serieData);
|
||||
if (style == null) return GetItemStyle(serie, serieData, false);
|
||||
else return style;
|
||||
}
|
||||
else if (serie.IsPerformanceMode()) return serie.itemStyle;
|
||||
else if (serieData != null && serieData.itemStyle != null) return serieData.itemStyle;
|
||||
else return serie.itemStyle;
|
||||
}
|
||||
|
||||
public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData != null && serieData.emphasisItemStyle != null && serieData.emphasisItemStyle.show)
|
||||
return serieData.emphasisItemStyle;
|
||||
else if (serie.emphasisItemStyle != null && serie.emphasisItemStyle.show) return serie.emphasisItemStyle;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, bool highlight = false)
|
||||
{
|
||||
if (serieData == null) return serie.label;
|
||||
if (highlight)
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.emphasisLabel != null && serieData.emphasisLabel.show)
|
||||
return serieData.emphasisLabel;
|
||||
else if (serie.emphasisLabel != null && serie.emphasisLabel.show) return serie.emphasisLabel;
|
||||
else return serie.label;
|
||||
return serieData != null && serieData.itemStyle != null? serieData.itemStyle : serie.itemStyle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.labelStyle != null) return serieData.labelStyle;
|
||||
else return serie.label;
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
return stateStyle == null?serie.itemStyle : stateStyle.itemStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public static LabelStyle GetSerieEmphasisLabel(Serie serie, SerieData serieData)
|
||||
public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.emphasisLabel != null && serieData.emphasisLabel.show)
|
||||
return serieData.emphasisLabel;
|
||||
else if (serie.emphasisLabel != null && serie.emphasisLabel.show) return serie.emphasisLabel;
|
||||
else return null;
|
||||
}
|
||||
|
||||
public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, bool highlight = false)
|
||||
{
|
||||
if (highlight)
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
if (state == SerieState.Normal)
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.emphasisLabelLine != null && serieData.emphasisLabelLine.show)
|
||||
return serieData.emphasisLabelLine;
|
||||
else if (serie.emphasisLabelLine != null && serie.emphasisLabelLine.show) return serie.emphasisLabelLine;
|
||||
else return serie.labelLine;
|
||||
return serieData != null && serieData.labelStyle != null? serieData.labelStyle : serie.label;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.labelLine != null) return serieData.labelLine;
|
||||
else return serie.labelLine;
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
return stateStyle == null?serie.label : stateStyle.label;
|
||||
}
|
||||
}
|
||||
|
||||
public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)
|
||||
public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
|
||||
{
|
||||
if (!serie.IsPerformanceMode() && serieData.symbol != null) return serieData.symbol;
|
||||
else return serie.symbol;
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
if (state == SerieState.Normal)
|
||||
{
|
||||
return serieData != null && serieData.labelLine != null? serieData.labelLine : serie.labelLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
return stateStyle == null?serie.labelLine : stateStyle.labelLine;
|
||||
}
|
||||
}
|
||||
|
||||
public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
|
||||
{
|
||||
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
|
||||
if (state == SerieState.Normal)
|
||||
{
|
||||
return serieData != null && serieData.symbol != null? serieData.symbol : serie.symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
return stateStyle == null?serie.symbol : stateStyle.symbol;
|
||||
}
|
||||
}
|
||||
|
||||
public static LineStyle GetLineStyle(Serie serie, SerieData serieData)
|
||||
@@ -456,94 +497,195 @@ namespace XCharts.Runtime
|
||||
else return serie.titleStyle;
|
||||
}
|
||||
|
||||
public static Color32 GetAreaColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)
|
||||
public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)
|
||||
{
|
||||
Color32 color = ChartConst.clearColor32;
|
||||
var areaStyle = GetAreaStyle(serie, serieData);
|
||||
if (areaStyle == null || !areaStyle.show)
|
||||
return color;
|
||||
if (!ChartHelper.IsClearColor(areaStyle.color)) color = areaStyle.color;
|
||||
else if (!ChartHelper.IsClearColor(serie.itemStyle.color)) color = serie.itemStyle.color;
|
||||
else color = theme.GetColor(index);
|
||||
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
||||
if (highlight)
|
||||
{
|
||||
if (!ChartHelper.IsClearColor(areaStyle.highlightColor))
|
||||
color = areaStyle.highlightColor;
|
||||
else
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
}
|
||||
return color;
|
||||
if (serieData != null && serieData.emphasisStyle != null) return serieData.emphasisStyle;
|
||||
else return serie.emphasisStyle;
|
||||
}
|
||||
|
||||
public static Color32 GetAreaToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)
|
||||
public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)
|
||||
{
|
||||
Color32 color = ChartConst.clearColor32;
|
||||
var areaStyle = GetAreaStyle(serie, serieData);
|
||||
if (areaStyle == null || !areaStyle.show)
|
||||
return color;
|
||||
if (!ChartHelper.IsClearColor(areaStyle.toColor)) color = areaStyle.toColor;
|
||||
else if (!ChartHelper.IsClearColor(serie.itemStyle.toColor)) color = serie.itemStyle.toColor;
|
||||
else color = theme.GetColor(index);
|
||||
ChartHelper.SetColorOpacity(ref color, areaStyle.opacity);
|
||||
if (highlight)
|
||||
{
|
||||
if (!ChartHelper.IsClearColor(areaStyle.highlightToColor))
|
||||
color = areaStyle.highlightToColor;
|
||||
else
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
}
|
||||
return color;
|
||||
if (serieData != null && serieData.blurStyle != null) return serieData.blurStyle;
|
||||
else return serie.blurStyle;
|
||||
}
|
||||
public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)
|
||||
{
|
||||
if (serieData != null && serieData.selectStyle != null) return serieData.selectStyle;
|
||||
else return serie.selectStyle;
|
||||
}
|
||||
|
||||
public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight)
|
||||
public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)
|
||||
{
|
||||
Color32 color = ChartConst.clearColor32;
|
||||
var lineStyle = GetLineStyle(serie, serieData);
|
||||
if (highlight)
|
||||
switch (state)
|
||||
{
|
||||
var itemStyleEmphasis = GetItemStyleEmphasis(serie, null);
|
||||
if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.color))
|
||||
case SerieState.Emphasis:
|
||||
return GetEmphasisStyle(serie, serieData);
|
||||
case SerieState.Blur:
|
||||
return GetBlurStyle(serie, serieData);
|
||||
case SerieState.Select:
|
||||
return GetSelectStyle(serie, serieData);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetAreaColor(out Color32 color, out Color32 toColor,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index)
|
||||
{
|
||||
bool fill;
|
||||
return GetAreaColor(out color, out toColor, out fill,serie, serieData, theme, index);
|
||||
}
|
||||
|
||||
public static bool GetAreaColor(out Color32 color, out Color32 toColor, out bool innerFill,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, int index)
|
||||
{
|
||||
color = ChartConst.clearColor32;
|
||||
toColor = ChartConst.clearColor32;
|
||||
innerFill = false;
|
||||
var state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var areaStyle = GetAreaStyle(serie, serieData);
|
||||
if (areaStyle == null || !areaStyle.show) return false;
|
||||
innerFill = areaStyle.innerFill;
|
||||
GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index);
|
||||
GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index);
|
||||
switch (state)
|
||||
{
|
||||
color = itemStyleEmphasis.color;
|
||||
ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity);
|
||||
return color;
|
||||
case SerieState.Emphasis:
|
||||
color = ChartHelper.GetHighlightColor(color);
|
||||
toColor = ChartHelper.GetHighlightColor(toColor);
|
||||
break;
|
||||
case SerieState.Blur:
|
||||
color = ChartHelper.GetBlurColor(color);
|
||||
toColor = ChartHelper.GetBlurColor(toColor);
|
||||
break;
|
||||
case SerieState.Select:
|
||||
color = ChartHelper.GetSelectColor(color);
|
||||
toColor = ChartHelper.GetSelectColor(toColor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ChartHelper.IsClearColor(lineStyle.color)) color = lineStyle.color;
|
||||
else if (!ChartHelper.IsClearColor(serie.itemStyle.color)) color = serie.itemStyle.GetColor();
|
||||
if (ChartHelper.IsClearColor(color)) color = theme.GetColor(index);
|
||||
ChartHelper.SetColorOpacity(ref color, lineStyle.opacity);
|
||||
if (highlight) color = ChartHelper.GetHighlightColor(color);
|
||||
return color;
|
||||
else
|
||||
{
|
||||
if (stateStyle.areaStyle.show)
|
||||
{
|
||||
innerFill = stateStyle.areaStyle.innerFill;
|
||||
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
||||
GetColor(ref color, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)
|
||||
public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)
|
||||
{
|
||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
|
||||
else return serie.lineStyle.GetWidth(theme.serie.lineWidth) * 2;
|
||||
Color32 color = ChartConst.clearColor32;
|
||||
if (state == SerieState.Auto)
|
||||
state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var lineStyle = GetLineStyle(serie, serieData);
|
||||
GetColor(ref color, lineStyle.color, serie.itemStyle.color, lineStyle.opacity, theme, index);
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
return ChartHelper.GetHighlightColor(color);
|
||||
case SerieState.Blur:
|
||||
return ChartHelper.GetBlurColor(color);
|
||||
case SerieState.Select:
|
||||
return ChartHelper.GetSelectColor(color);
|
||||
default:
|
||||
return color;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetColor(ref color, stateStyle.lineStyle.color, stateStyle.itemStyle.color, stateStyle.lineStyle.opacity, theme, index);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)
|
||||
private static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
|
||||
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
|
||||
{
|
||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||
if (itemStyle != null && !ChartHelper.IsClearColor(itemStyle.borderColor)) return itemStyle.borderColor;
|
||||
else return serie.itemStyle.borderColor;
|
||||
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
|
||||
else if (!ChartHelper.IsClearColor(itemColor)) color = itemColor;
|
||||
if (ChartHelper.IsClearColor(color) && colorIndex >= 0) color = theme.GetColor(colorIndex);
|
||||
if (setOpacity) ChartHelper.SetColorOpacity(ref color, opacity);
|
||||
}
|
||||
|
||||
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, float defaultWidth)
|
||||
public static void GetSymbolInfo(out Color32 borderColor, out float border, out float[] cornerRadius,
|
||||
Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)
|
||||
{
|
||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
|
||||
else return defaultWidth;
|
||||
borderColor = ChartConst.clearColor32;
|
||||
if (state == SerieState.Auto)
|
||||
state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var itemStyle = GetItemStyle(serie, serieData, SerieState.Normal);
|
||||
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : serie.lineStyle.GetWidth(theme.serie.lineWidth);
|
||||
cornerRadius = itemStyle.cornerRadius;
|
||||
GetColor(ref borderColor, itemStyle.borderColor, itemStyle.borderColor, 1, theme, -1);
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
borderColor = ChartHelper.GetHighlightColor(borderColor);
|
||||
break;
|
||||
case SerieState.Blur:
|
||||
borderColor = ChartHelper.GetBlurColor(borderColor);
|
||||
break;
|
||||
case SerieState.Select:
|
||||
borderColor = ChartHelper.GetSelectColor(borderColor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var itemStyle = stateStyle.itemStyle;
|
||||
border = itemStyle.borderWidth != 0 ? itemStyle.borderWidth : stateStyle.lineStyle.GetWidth(theme.serie.lineWidth);
|
||||
cornerRadius = itemStyle.cornerRadius;
|
||||
GetColor(ref borderColor, stateStyle.itemStyle.borderColor, ColorUtil.clearColor32, 1, theme, -1);
|
||||
}
|
||||
}
|
||||
|
||||
public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)
|
||||
public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)
|
||||
{
|
||||
var itemStyle = GetItemStyle(serie, serieData, highlight);
|
||||
if (itemStyle != null) return itemStyle.cornerRadius;
|
||||
else return null;
|
||||
if (state == SerieState.Auto)
|
||||
state = GetSerieState(serie, serieData);
|
||||
var stateStyle = GetStateStyle(serie, serieData, state);
|
||||
var size = 0f;
|
||||
if (stateStyle == null)
|
||||
{
|
||||
var symbol = GetSerieSymbol(serie, serieData, SerieState.Normal);
|
||||
size = symbol.GetSize(serieData.data, defaultSize);
|
||||
switch (state)
|
||||
{
|
||||
case SerieState.Emphasis:
|
||||
case SerieState.Select:
|
||||
size *= theme.serie.selectedRate;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var symbol = stateStyle.symbol;
|
||||
size = symbol.GetSize(serieData.data, defaultSize);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)
|
||||
@@ -644,10 +786,9 @@ namespace XCharts.Runtime
|
||||
private static void UpdateFilterData_XAxisValue(Serie serie, DataZoom dataZoom, int dimension, double min, double max)
|
||||
{
|
||||
var data = serie.data;
|
||||
var startValue = min + (max - min) * dataZoom.start / 100;
|
||||
var endValue = min + (max - min) * dataZoom.end / 100;
|
||||
var startValue = min;
|
||||
var endValue = max;
|
||||
if (endValue < startValue) endValue = startValue;
|
||||
|
||||
if (startValue != serie.m_FilterStartValue || endValue != serie.m_FilterEndValue ||
|
||||
dataZoom.minShowNum != serie.m_FilterMinShow || serie.m_NeedUpdateFilterData)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace XCharts.Runtime
|
||||
public Color32 color;
|
||||
public string itemFormatter;
|
||||
public string numericFormatter;
|
||||
public bool ignore;
|
||||
public List<string> columns = new List<string>();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user