[feature][serie] support EmphasisStle,BlurStyle and SelectStyle

This commit is contained in:
monitor1394
2022-07-25 07:46:03 +08:00
parent 8dde322c04
commit 4f93628667
61 changed files with 1052 additions and 758 deletions

View File

@@ -57,6 +57,10 @@
## master
* (2022.07.24) 增加`Serie``SerieData``state`设置默认状态
* (2022.07.22) 增加`Serie`的三种状态`EmphasisStyle`,`BlurStyle`,`SelectStyle`
* (2022.07.22) 去掉`AreaStyle``m_HighlightColor``m_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`设置坐标轴次分割线

View File

@@ -190,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> |
@@ -340,6 +341,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> |
@@ -353,6 +355,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.7f)</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> |
@@ -828,18 +831,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> |
@@ -848,14 +848,16 @@ 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> |
| `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)</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> |
| `GetStateStyle()` |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)</br> |
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)</br> |
| `GetSymbolBorderColor()` |public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)</br> |
| `GetSymbolCornerRadius()` |public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, 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> |

View File

@@ -190,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> |
@@ -340,6 +341,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> |
@@ -353,6 +355,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.7f)</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> |
@@ -828,18 +831,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> |
@@ -848,14 +848,16 @@ 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> |
| `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)</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> |
| `GetStateStyle()` |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)</br> |
| `GetSymbolBorder()` |public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)</br> |
| `GetSymbolBorderColor()` |public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)</br> |
| `GetSymbolCornerRadius()` |public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, 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> |

View File

@@ -85,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)
@@ -111,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)
@@ -130,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)
@@ -217,8 +215,6 @@ 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.
## `ArrowStyle`
@@ -440,6 +436,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)
@@ -581,39 +586,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`
@@ -1063,6 +1048,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)
@@ -1076,6 +1070,7 @@ 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>|
|`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.
@@ -1153,6 +1148,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`
@@ -1261,6 +1257,23 @@ 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)|
## `SubTitleTheme`
Inherits or Implemented: [ComponentTheme](#ComponentTheme)

View File

@@ -85,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)
@@ -111,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)
@@ -130,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)
@@ -217,8 +215,6 @@ Inherits or Implemented: [ChildComponent](#ChildComponent),[ISerieExtraComponent
|`color`|||区域填充的颜色如果toColor不是默认值则表示渐变色的起点颜色。
|`toColor`|||渐变色的终点颜色。
|`opacity`|0.6f||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。
|`highlightColor`|||高亮时区域填充的颜色如果highlightToColor不是默认值则表示渐变色的起点颜色。
|`highlightToColor`|||高亮时渐变色的终点颜色。
## `ArrowStyle`
@@ -440,6 +436,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)
@@ -581,39 +586,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||Whether to scale to highlight the data in emphasis state. 高亮时的缩放倍数
|`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`
@@ -1063,6 +1048,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)
@@ -1076,6 +1070,7 @@ 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>|
|`stack`|||数据堆叠同个类目轴上系列配置相同的stack值后后一个系列的值会在前一个系列的值上相加。
|`xAxisIndex`|0||使用X轴的index。
|`yAxisIndex`|0||使用Y轴的index。
@@ -1153,6 +1148,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`
@@ -1261,6 +1257,23 @@ 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)|
## `SubTitleTheme`
Inherits or Implemented: [ComponentTheme](#ComponentTheme)

View File

@@ -17,8 +17,6 @@ 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");
--EditorGUI.indentLevel;
}

View File

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

View File

@@ -0,0 +1,54 @@
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_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"; } }
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6e0b1690532674b24952a87e0aead6fa
guid: 3aad8ee99115742729ec5a963274fae0
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -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();
@@ -189,9 +189,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>();

View File

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

View File

@@ -37,8 +37,6 @@ 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;
/// <summary>
/// Set this to false to prevent the areafrom showing.
@@ -85,24 +83,6 @@ namespace XCharts.Runtime
get { return m_Opacity; }
set { if (PropertyUtil.SetStruct(ref m_Opacity, value)) SetVerticesDirty(); }
}
/// <summary>
/// the color of area,default use serie color.
/// |高亮时区域填充的颜色如果highlightToColor不是默认值则表示渐变色的起点颜色。
/// </summary>
public Color32 highlightColor
{
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(); }
}
public Color32 GetColor()
{

View File

@@ -1,11 +0,0 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// 高亮的图形样式
/// </summary>
[System.Serializable]
public class EmphasisItemStyle : ItemStyle, ISerieExtraComponent, ISerieDataComponent
{ }
}

View File

@@ -1,11 +0,0 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// 高亮的标签引导线样式
/// </summary>
[System.Serializable]
public class EmphasisLabelLine : LabelLine, ISerieExtraComponent, ISerieDataComponent
{ }
}

View File

@@ -1,11 +0,0 @@
using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// 高亮的标签样式
/// </summary>
[System.Serializable]
public class EmphasisLabelStyle : LabelStyle, ISerieExtraComponent, ISerieDataComponent
{ }
}

View File

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

View File

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

View File

@@ -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,9 @@ 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);
var tickness = SerieHelper.GetSymbolBorder(serie, null, theme);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, null, theme);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, null);
chart.DrawClipSymbol(vh, symbol.type, symbol.size, tickness, pos, lineColor, lineColor,
ColorUtil.clearColor32, borderColor, symbol.gap, true, cornerRadius, grid, startPos);
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4cd4074bb11fc40059363dd78b9ee98d
guid: ca1088963feb54117bce8be6bceb64de
folderAsset: yes
DefaultImporter:
externalObjects: {}

View 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
{ }
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7de9b5e4c5d474fdd88ebb89f0924305
guid: 4e3f901db80454f89800a84977289535
MonoImporter:
externalObjects: {}
serializedVersion: 2

View 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(); }
}
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a0d9ff3b8e09d464e9b5ea996b941314
guid: 91a31f424478042418811c32bb8aa2d5
MonoImporter:
externalObjects: {}
serializedVersion: 2

View 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
{ }
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5d1095175540449f99bb9da27a5aaf04
guid: 986a9b6da6fdd48c49a9b665450dd605
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -3,15 +3,19 @@ using UnityEngine;
namespace XCharts.Runtime
{
/// <summary>
/// 高亮的图形样式和文本标签样式。
/// the state style of serie.
/// |Serie的状态样式。Serie的状态有正常高亮淡出选中四种状态。
/// </summary>
[System.Serializable]
public class Emphasis : ChildComponent, ISerieExtraComponent, ISerieDataComponent
[Since("v3.2.0")]
public class StateStyle : ChildComponent
{
[SerializeField] private bool m_Show;
[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();
public void Reset()
{
@@ -53,22 +57,57 @@ namespace XCharts.Runtime
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(); }
}
public override bool vertsDirty { get { return m_VertsDirty || label.vertsDirty || itemStyle.vertsDirty; } }
public override bool vertsDirty
{
get
{
return m_VertsDirty ||
m_Label.vertsDirty ||
m_ItemStyle.vertsDirty ||
m_LineStyle.vertsDirty ||
m_AreaStyle.vertsDirty;
}
}
public override bool componentDirty { get { return m_ComponentDirty || label.componentDirty; } }
public override bool componentDirty
{
get
{
return m_ComponentDirty ||
m_Label.componentDirty;
}
}
public override void ClearVerticesDirty()
{
base.ClearVerticesDirty();
label.ClearVerticesDirty();
itemStyle.ClearVerticesDirty();
m_Label.ClearVerticesDirty();
m_ItemStyle.ClearVerticesDirty();
m_LineStyle.ClearVerticesDirty();
m_AreaStyle.ClearVerticesDirty();
}
public override void ClearComponentDirty()
{
base.ClearComponentDirty();
label.ClearComponentDirty();
m_Label.ClearComponentDirty();
}
}
}

View File

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

View File

@@ -544,17 +544,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;
}
}
}

View File

@@ -27,6 +27,28 @@ 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 +69,7 @@ namespace XCharts.Runtime
m_ComponentDirty = false;
}
public virtual void ClearData()
{ }
public virtual void ClearData() { }
public virtual void ClearDirty()
{
@@ -68,11 +89,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()
{

View File

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

View File

@@ -845,6 +845,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.7f)
{
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);

View File

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

View File

@@ -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);
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, SerieState.Emphasis);
}
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);
}
}
if (needInteract)
@@ -190,18 +186,18 @@ namespace XCharts.Runtime
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);
}
@@ -242,11 +238,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 +362,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 +390,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,

View File

@@ -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);
}
}
}
@@ -162,15 +159,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);
}

View File

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

View File

@@ -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,8 +113,8 @@ namespace XCharts.Runtime
serie.context.dataPoints.Add(Vector3.zero);
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);

View File

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

View File

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

View File

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

View File

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

View File

@@ -187,18 +187,18 @@ namespace XCharts.Runtime
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);
var state = SerieHelper.GetSerieState(serie, serieData);
Color32 symbolColor, symbolToColor,symbolEmptyColor;
SerieHelper.GetItemColor(out symbolColor, out symbolToColor,out symbolEmptyColor, serie, serieData, theme, serie.index, 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);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, state);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, state);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, state);
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 +220,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;

View File

@@ -120,7 +120,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,6 +205,7 @@ namespace XCharts.Runtime
continue;
var count = serie.dataCount;
Color32 symbolColor, symbolToColor,symbolEmptyColor;
for (int i = 0; i < count; i++)
{
var serieData = serie.GetSerieData(i);
@@ -220,13 +221,11 @@ namespace XCharts.Runtime
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 state = SerieHelper.GetSerieState(serie, serieData);
SerieHelper.GetItemColor(out symbolColor, out symbolToColor,out symbolEmptyColor, serie, serieData, chart.theme, n);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, state);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, state);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, state);
symbolSize = serie.animation.GetSysmbolSize(symbolSize);
chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, serieData.context.position,

View File

@@ -24,11 +24,11 @@ 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 srcAreaColor, srcAreaToColor;
if (!SerieHelper.GetAreaColor(out srcAreaColor, out srcAreaToColor, 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);
}
var gridXY = (isY ? grid.context.x : grid.context.y);
if (lastStackSerie == null)
{
@@ -263,7 +263,7 @@ namespace XCharts.Runtime
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;

View File

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

View File

@@ -38,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 ?

View File

@@ -4,8 +4,8 @@ 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
{

View File

@@ -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);
}
}
@@ -322,7 +320,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 +332,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);
}

View File

@@ -6,8 +6,8 @@ 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
{

View File

@@ -54,7 +54,8 @@ namespace XCharts.Runtime
if (serieData == null)
return;
var color = SerieHelper.GetItemColor(serie, serieData, chart.theme, dataIndex, false);;
Color32 color, toColor;
SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, dataIndex, SerieState.Normal);
title = serieData.name;
for (int i = 0; i < serieData.data.Count; i++)
{
@@ -96,6 +97,7 @@ namespace XCharts.Runtime
needHideAll = true;
}
m_LastCheckContextFlag = needCheck;
serie.highlight = false;
serie.context.pointerEnter = false;
serie.context.pointerItemDataIndex = -1;
var areaStyle = serie.areaStyle;
@@ -120,6 +122,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 +139,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;
@@ -154,6 +158,7 @@ namespace XCharts.Runtime
serieData.index = i;
if (Vector3.Distance(chart.pointerPos, serieData.context.position) < serie.symbol.size * 2)
{
serie.highlight = true;
serie.context.pointerEnter = true;
serie.context.pointerItemDataIndex = i;
return;
@@ -169,6 +174,7 @@ namespace XCharts.Runtime
var p2 = n >= dataPoints.Count - 1 ? dataPoints[0] : dataPoints[n + 1];
if (UGLHelper.IsPointInTriangle(p1.context.position, center, p2.context.position, chart.pointerPos))
{
serie.highlight = true;
serie.context.pointerEnter = true;
serie.context.pointerItemDataIndex = n;
p1.context.highlight = true;
@@ -209,6 +215,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];
@@ -218,13 +225,12 @@ namespace XCharts.Runtime
continue;
}
var lineStyle = SerieHelper.GetLineStyle(serie, serieData);
var areaStyle = SerieHelper.GetAreaStyle(serie, serieData);
var symbol = SerieHelper.GetSerieSymbol(serie, serieData);
var isHighlight = serieData.context.highlight;
var serieState = SerieHelper.GetSerieState(serie, serieData);
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 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,7 +268,7 @@ namespace XCharts.Runtime
{
toPoint = new Vector3(centerPos.x + radius * Mathf.Sin(currAngle),
centerPos.y + radius * Mathf.Cos(currAngle));
if (areaStyle != null && areaStyle.show && !serie.smooth)
if (showArea && !serie.smooth)
{
UGL.DrawTriangle(vh, startPoint, toPoint, centerPos, areaColor, areaColor, areaToColor);
}
@@ -274,7 +280,7 @@ namespace XCharts.Runtime
}
serieData.context.dataPoints.Add(startPoint);
}
if (areaStyle != null && areaStyle.show && !serie.smooth)
if (showArea && !serie.smooth)
{
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
}
@@ -308,12 +314,11 @@ namespace XCharts.Runtime
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);
Color32 symbolColor, symbolToColor, symbolEmptyColor;
SerieHelper.GetItemColor(out symbolColor, out symbolToColor, out symbolEmptyColor, serie, serieData, chart.theme, j, serieState);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, serieState);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, serieState);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, serieState);
chart.DrawSymbol(vh, symbol.type, symbolSize, symbolBorder, point, symbolColor,
symbolToColor, symbolEmptyColor, borderColor, symbol.gap, cornerRadius);
}
@@ -369,11 +374,9 @@ 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);
Color32 areaColor, areaToColor;
var showArea = SerieHelper.GetAreaColor(out areaColor, out areaToColor, serie, serieData, chart.theme, j);
var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, j);
int dataCount = radar.indicatorList.Count;
var index = serieData.index;
var p = radar.context.center;
@@ -404,7 +407,7 @@ namespace XCharts.Runtime
{
toPoint = new Vector3(p.x + radius * Mathf.Sin(currAngle),
p.y + radius * Mathf.Cos(currAngle));
if (areaStyle != null && areaStyle.show && !serie.smooth)
if (showArea && !serie.smooth)
{
UGL.DrawTriangle(vh, startPoint, toPoint, p, areaColor, areaColor, areaToColor);
}
@@ -423,7 +426,7 @@ namespace XCharts.Runtime
serieData.context.position = startPoint;
serieData.context.labelPosition = startPoint;
if (areaStyle != null && areaStyle.show && j == endIndex && !serie.smooth)
if (showArea && j == endIndex && !serie.smooth)
{
UGL.DrawTriangle(vh, startPoint, firstPoint, centerPos, areaColor, areaColor, areaToColor);
}
@@ -439,7 +442,7 @@ namespace XCharts.Runtime
if (serie.smooth)
{
var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth);
var lineColor = SerieHelper.GetLineColor(serie, null, chart.theme, serie.context.colorIndex, false);
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,
@@ -452,17 +455,16 @@ namespace XCharts.Runtime
{
var serieData = serie.data[j];
if (!serieData.show) continue;
var isHighlight = serie.highlight || serieData.context.highlight || serie.context.pointerEnter;
var state = SerieHelper.GetSerieState(serie, serieData);
var serieIndex = serieData.index;
var symbolSize = isHighlight ?
var symbolSize = state == SerieState.Emphasis ?
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);
Color32 symbolColor, symbolToColor,symbolEmptyColor;
SerieHelper.GetItemColor(out symbolColor, out symbolToColor,out symbolEmptyColor, serie, serieData, chart.theme, serieIndex, state);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, state);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, state);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, state);
if (!radar.IsInIndicatorRange(j, serieData.GetData(1)))
{
symbolColor = radar.outRangeColor;
@@ -499,27 +501,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);
}
}
}
}
}

View File

@@ -4,8 +4,8 @@ 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
{

View File

@@ -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);;
@@ -158,10 +160,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 +216,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 +259,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;

View File

@@ -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);
@@ -151,12 +151,12 @@ namespace XCharts.Runtime
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);
Color32 color, toColor, emptyColor;
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, state);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, state);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, state);
double xValue = serieData.GetCurrData(0, dataChangeDuration, xAxis.inverse);
double yValue = serieData.GetCurrData(1, dataChangeDuration, yAxis.inverse);
@@ -255,13 +255,12 @@ namespace XCharts.Runtime
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);
Color32 color, toColor, emptyColor;
SerieHelper.GetItemColor(out color, out toColor, out emptyColor, serie, serieData, chart.theme, colorIndex, state);
var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, theme, state);
var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, theme, state);
var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, state);
var xValue = serieData.GetCurrData(0, dataChangeDuration, axis.inverse);
if (serieData.IsDataChanged())

View File

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

View File

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

View File

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

View File

@@ -161,6 +161,39 @@ 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>
/// 系列。
/// </summary>
@@ -172,6 +205,7 @@ 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] private string m_Stack;
[SerializeField] private int m_XAxisIndex = 0;
[SerializeField] private int m_YAxisIndex = 0;
@@ -296,6 +330,15 @@ 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>
/// 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>
@@ -826,12 +869,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 +887,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 +906,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 +926,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()

View File

@@ -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>();
@@ -97,10 +101,6 @@ namespace XCharts.Runtime
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>();

View File

@@ -18,7 +18,7 @@ namespace XCharts.Runtime
"m_ParentId",
"m_Ignore",
"m_Selected",
"m_Radius"
"m_Radius",
};
public static Dictionary<Type, string> extraComponentMap = new Dictionary<Type, string>
{ { typeof(ItemStyle), "m_ItemStyles" },
@@ -28,9 +28,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 +40,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 +48,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 +98,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 +125,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 +158,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 +173,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 +228,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 +258,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 +312,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 +333,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))

View File

@@ -240,11 +240,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);
@@ -375,14 +373,10 @@ namespace XCharts.Runtime
{
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);
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 +390,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 +412,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);
@@ -492,7 +486,9 @@ 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);
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,
@@ -522,7 +518,7 @@ namespace XCharts.Runtime
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.color = chart.GetItemColor(serie, serieData);
param.marker = SerieHelper.GetItemMarker(serie, serieData, marker);
param.itemFormatter = itemFormatter;
param.numericFormatter = SerieHelper.GetNumericFormatter(serie, serieData, numericFormatter);
@@ -554,6 +550,8 @@ namespace XCharts.Runtime
return;
var colorIndex = 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;
@@ -564,7 +562,7 @@ namespace XCharts.Runtime
param.dataCount = serie.dataCount;
param.value = serieData.GetData(param.dimension);
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);

View File

@@ -242,105 +242,150 @@ namespace XCharts.Runtime
}
}
public static SerieState GetSerieState(Serie serie)
{
if (serie.highlight || serie.context.pointerEnter) return SerieState.Emphasis;
return serie.state;
}
public static SerieState GetSerieState(Serie serie, SerieData serieData)
{
if (serieData == null || serieData.state == SerieState.Auto) return GetSerieState(serie);
if (serieData.context.highlight) return SerieState.Emphasis;
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;
GetItemColor(out color, out toColor, serie, serieData, theme, serie.context.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,66 +415,32 @@ 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;
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
var stateStyle = GetStateStyle(serie, serieData, state);
return stateStyle == null?serie.label : stateStyle.label;
}
public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, bool highlight = false)
public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
{
if (highlight)
{
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;
}
else
{
if (!serie.IsPerformanceMode() && serieData.labelLine != null) return serieData.labelLine;
else return serie.labelLine;
}
if (state == SerieState.Auto) state = GetSerieState(serie, serieData);
var stateStyle = GetStateStyle(serie, serieData, state);
return stateStyle == null?serie.labelLine : stateStyle.labelLine;
}
public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)
@@ -456,92 +467,139 @@ 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)
{
color = ChartConst.clearColor32;
toColor = ChartConst.clearColor32;
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;
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)
{
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);
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;
}
}
private static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
{
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
else if (!ChartHelper.IsClearColor(itemColor)) color = itemColor;
if (ChartHelper.IsClearColor(color)) color = theme.GetColor(colorIndex);
if (setOpacity) ChartHelper.SetColorOpacity(ref color, opacity);
}
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)
{
var itemStyle = GetItemStyle(serie, serieData, state);
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
else return serie.lineStyle.GetWidth(theme.serie.lineWidth) * 2;
}
public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight)
public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto)
{
var itemStyle = GetItemStyle(serie, serieData, highlight);
var itemStyle = GetItemStyle(serie, serieData, state);
if (itemStyle != null && !ChartHelper.IsClearColor(itemStyle.borderColor)) return itemStyle.borderColor;
else return serie.itemStyle.borderColor;
}
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, float defaultWidth)
public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)
{
var itemStyle = GetItemStyle(serie, serieData, highlight);
if (itemStyle != null && itemStyle.borderWidth != 0) return itemStyle.borderWidth;
else return defaultWidth;
}
public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight)
{
var itemStyle = GetItemStyle(serie, serieData, highlight);
var itemStyle = GetItemStyle(serie, serieData, state);
if (itemStyle != null) return itemStyle.cornerRadius;
else return null;
}

View File

@@ -106,7 +106,9 @@ namespace XCharts.Runtime
break;
}
}
return SerieHelper.GetItemColor(destSerie, destSerieData, chart.theme, index, false);
Color32 color, toColor;
SerieHelper.GetItemColor(out color, out toColor, destSerie, destSerieData, chart.theme, index, SerieState.Normal);
return color;
}
/// <summary>