增加AnimationExchange排序交换动画

This commit is contained in:
monitor1394
2025-03-26 08:28:27 +08:00
parent 9e07617cc4
commit 0b218f6dfe
11 changed files with 365 additions and 28 deletions

View File

@@ -13,6 +13,7 @@ slug: /api
- [AnimationAddition](#animationaddition) - [AnimationAddition](#animationaddition)
- [AnimationChange](#animationchange) - [AnimationChange](#animationchange)
- [AnimationEasing](#animationeasing) - [AnimationEasing](#animationeasing)
- [AnimationExchange](#animationexchange)
- [AnimationFadeIn](#animationfadein) - [AnimationFadeIn](#animationfadein)
- [AnimationFadeOut](#animationfadeout) - [AnimationFadeOut](#animationfadeout)
- [AnimationHiding](#animationhiding) - [AnimationHiding](#animationhiding)
@@ -70,6 +71,7 @@ slug: /api
- [ColorUtil](#colorutil) - [ColorUtil](#colorutil)
- [Comment](#comment) - [Comment](#comment)
- [CommentItem](#commentitem) - [CommentItem](#commentitem)
- [CommentLayer](#commentlayer)
- [CommentMarkStyle](#commentmarkstyle) - [CommentMarkStyle](#commentmarkstyle)
- [ComponentHandlerAttribute](#componenthandlerattribute) - [ComponentHandlerAttribute](#componenthandlerattribute)
- [ComponentHelper](#componenthelper) - [ComponentHelper](#componenthelper)
@@ -360,6 +362,14 @@ Options:
- `Linear`: - `Linear`:
## AnimationExchange
class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo)
> Since `v3.15.0`
Data exchange animation. Generally used for animation of data sorting.
## AnimationFadeIn ## AnimationFadeIn
class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo) class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo)
@@ -386,7 +396,7 @@ Data hiding animation.
## AnimationInfo ## AnimationInfo
class in XCharts.Runtime / Subclasses: [AnimationFadeIn](#animationfadein),[AnimationFadeOut](#animationfadeout),[AnimationChange](#animationchange),[AnimationAddition](#animationaddition),[AnimationHiding](#animationhiding),[AnimationInteraction](#animationinteraction) class in XCharts.Runtime / Subclasses: [AnimationFadeIn](#animationfadein),[AnimationFadeOut](#animationfadeout),[AnimationChange](#animationchange),[AnimationAddition](#animationaddition),[AnimationHiding](#animationhiding),[AnimationInteraction](#animationinteraction),[AnimationExchange](#animationexchange)
> Since `v3.8.0` > Since `v3.8.0`
@@ -531,7 +541,7 @@ public float GetWidth(float width)
class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent) class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
the animation of serie. support animation type: fadeIn, fadeOut, change, addition. the animation of serie. support animation type: fadeIn, fadeOut, change, addition, exchange.
### AnimationStyle.addition ### AnimationStyle.addition
@@ -548,6 +558,11 @@ Update data animation configuration.
public bool enable public bool enable
Whether to enable animation. Whether to enable animation.
### AnimationStyle.exchange
public AnimationExchange exchange
Exchange animation configuration. Valid in sort bar chart.
### AnimationStyle.fadeIn ### AnimationStyle.fadeIn
public AnimationFadeIn fadeIn public AnimationFadeIn fadeIn
@@ -639,6 +654,10 @@ public int GetCurrIndex()
public float GetCurrRate() public float GetCurrRate()
### AnimationStyle.GetExchangeDuration
public float GetExchangeDuration()
### AnimationStyle.GetInteractionDuration ### AnimationStyle.GetInteractionDuration
public float GetInteractionDuration() public float GetInteractionDuration()
@@ -1097,7 +1116,7 @@ public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleW
### AxisHelper.GetAxisValueLength ### AxisHelper.GetAxisValueLength
public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value) public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value, float gap = 0)
获得数值value在坐标轴上对应的长度 获得数值value在坐标轴上对应的长度
### AxisHelper.GetAxisValuePosition ### AxisHelper.GetAxisValuePosition
@@ -1674,6 +1693,10 @@ Global parameter setting component.
public ThemeStyle theme public ThemeStyle theme
### BaseChart.topPainter
public Painter topPainter
### BaseChart.typeListForComponent ### BaseChart.typeListForComponent
public Dictionary<Type, FieldInfo> typeListForComponent public Dictionary<Type, FieldInfo> typeListForComponent
@@ -3428,13 +3451,20 @@ Convert the html string to color.
class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent),[IPropertyChanged](#ipropertychanged) class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent),[IPropertyChanged](#ipropertychanged)
comment of chart. > Since `v3.15.0`
comment of chart. Used to annotate special information in the chart.
### Comment.items ### Comment.items
public List<CommentItem> items public List<CommentItem> items
The items of comment. The items of comment.
### Comment.layer
public CommentLayer layer
The layer of comment.
### Comment.show ### Comment.show
public bool show public bool show
@@ -3443,10 +3473,12 @@ Set this to false to prevent the comment from showing.
### Comment.GetLabelStyle ### Comment.GetLabelStyle
public LabelStyle GetLabelStyle(int index) public LabelStyle GetLabelStyle(int index)
Get the label style of comment item.
### Comment.GetMarkStyle ### Comment.GetMarkStyle
public CommentMarkStyle GetMarkStyle(int index) public CommentMarkStyle GetMarkStyle(int index)
Get the mark style of comment item.
### Comment.OnChanged ### Comment.OnChanged
@@ -3478,6 +3510,17 @@ the mark rect style.
public bool show public bool show
Set this to false to prevent this comment item from showing. Set this to false to prevent this comment item from showing.
## CommentLayer
class in XCharts.Runtime
The layer of comment.
Options:
- `Lower`: The comment is display under the serie.
- `Upper`: The comment is display above the serie.
## CommentMarkStyle ## CommentMarkStyle
class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent) class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
@@ -7257,6 +7300,10 @@ class in XCharts.Runtime
public void Reset() public void Reset()
### SerieDataContext.UpdateExchangePosition
public void UpdateExchangePosition(ref float x, ref float y, float totalTime)
## SerieDataExtraFieldAttribute ## SerieDataExtraFieldAttribute
class in XCharts.Runtime / Inherits from: [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute) class in XCharts.Runtime / Inherits from: [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute)
@@ -7685,6 +7732,10 @@ public override void RefreshLabelInternal()
public override void RefreshLabelNextFrame() public override void RefreshLabelNextFrame()
### SerieHandler<T>.RefreshTitleLabelInternal
public void RefreshTitleLabelInternal()
### SerieHandler<T>.RemoveComponent ### SerieHandler<T>.RemoveComponent
public override void RemoveComponent() public override void RemoveComponent()

View File

@@ -176,6 +176,7 @@ slug: /configuration
- [AnimationAddition](#animationaddition) - [AnimationAddition](#animationaddition)
- [AnimationChange](#animationchange) - [AnimationChange](#animationchange)
- [AnimationExchange](#animationexchange)
- [AnimationFadeIn](#animationfadein) - [AnimationFadeIn](#animationfadein)
- [AnimationFadeOut](#animationfadeout) - [AnimationFadeOut](#animationfadeout)
- [AnimationHiding](#animationhiding) - [AnimationHiding](#animationhiding)
@@ -234,6 +235,14 @@ class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo)
Data change animation. Data change animation.
## AnimationExchange
class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo)
> Since `v3.15.0`
Data exchange animation. Generally used for animation of data sorting.
## AnimationFadeIn ## AnimationFadeIn
class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo) class in XCharts.Runtime / Inherits from: [AnimationInfo](#animationinfo)
@@ -260,7 +269,7 @@ Data hiding animation.
## AnimationInfo ## AnimationInfo
class in XCharts.Runtime / Subclasses: [AnimationFadeIn](#animationfadein), [AnimationFadeOut](#animationfadeout), [AnimationChange](#animationchange), [AnimationAddition](#animationaddition), [AnimationHiding](#animationhiding), [AnimationInteraction](#animationinteraction) class in XCharts.Runtime / Subclasses: [AnimationFadeIn](#animationfadein), [AnimationFadeOut](#animationfadeout), [AnimationChange](#animationchange), [AnimationAddition](#animationaddition), [AnimationHiding](#animationhiding), [AnimationInteraction](#animationinteraction), [AnimationExchange](#animationexchange)
> Since `v3.8.0` > Since `v3.8.0`
@@ -326,7 +335,7 @@ the mlvalue of width.
class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent) class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent)
the animation of serie. support animation type: fadeIn, fadeOut, change, addition. the animation of serie. support animation type: fadeIn, fadeOut, change, addition, exchange.
### AnimationStyle.addition ### AnimationStyle.addition
@@ -356,6 +365,12 @@ Options:
Whether to enable animation. Whether to enable animation.
### AnimationStyle.exchange
[AnimationExchange](#animationexchange) `v3.15.0`
Exchange animation configuration. Valid in sort bar chart.
### AnimationStyle.fadeIn ### AnimationStyle.fadeIn
[AnimationFadeIn](#animationfadein) `v3.8.0` [AnimationFadeIn](#animationfadein) `v3.8.0`
@@ -1247,7 +1262,9 @@ class in XCharts.Runtime / Subclasses: [AnimationStyle](#animationstyle), [AxisA
class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent), [IPropertyChanged](#ipropertychanged) class in XCharts.Runtime / Inherits from: [MainComponent](#maincomponent), [IPropertyChanged](#ipropertychanged)
comment of chart. > Since `v3.15.0`
comment of chart. Used to annotate special information in the chart.
### Comment.items ### Comment.items
@@ -1261,6 +1278,17 @@ The items of comment.
The text style of all comments. The text style of all comments.
### Comment.layer
[CommentLayer](#commentlayer) `v3.15.0`
The layer of comment.
Options:
- `Lower`: The comment is display under the serie.
- `Upper`: The comment is display above the serie.
### Comment.markStyle ### Comment.markStyle
[CommentMarkStyle](#commentmarkstyle) [CommentMarkStyle](#commentmarkstyle)
@@ -2238,6 +2266,12 @@ class in XCharts.Runtime / Inherits from: [ChildComponent](#childcomponent), [IS
数据项背景颜色。 数据项背景颜色。
### ItemStyle.backgroundGap
`float` `v3.15.0`
the gap between background and data item.
### ItemStyle.backgroundWidth ### ItemStyle.backgroundWidth
`float` `float`
@@ -2464,6 +2498,18 @@ the sytle of background.
the distance of label to axis line. the distance of label to axis line.
### LabelStyle.fixedX
`float` `0` `v3.15.0`
the fixed x of label. When not 0, it will be fixed on the specified x value.
### LabelStyle.fixedY
`float` `0` `v3.15.0`
the fixed y of label. When not 0, it will be fixed on the specified y value.
### LabelStyle.formatter ### LabelStyle.formatter
`string` `string`

View File

@@ -13,6 +13,7 @@ slug: /api
- [AnimationAddition](#animationaddition) - [AnimationAddition](#animationaddition)
- [AnimationChange](#animationchange) - [AnimationChange](#animationchange)
- [AnimationEasing](#animationeasing) - [AnimationEasing](#animationeasing)
- [AnimationExchange](#animationexchange)
- [AnimationFadeIn](#animationfadein) - [AnimationFadeIn](#animationfadein)
- [AnimationFadeOut](#animationfadeout) - [AnimationFadeOut](#animationfadeout)
- [AnimationHiding](#animationhiding) - [AnimationHiding](#animationhiding)
@@ -70,6 +71,7 @@ slug: /api
- [ColorUtil](#colorutil) - [ColorUtil](#colorutil)
- [Comment](#comment) - [Comment](#comment)
- [CommentItem](#commentitem) - [CommentItem](#commentitem)
- [CommentLayer](#commentlayer)
- [CommentMarkStyle](#commentmarkstyle) - [CommentMarkStyle](#commentmarkstyle)
- [ComponentHandlerAttribute](#componenthandlerattribute) - [ComponentHandlerAttribute](#componenthandlerattribute)
- [ComponentHelper](#componenthelper) - [ComponentHelper](#componenthelper)
@@ -360,6 +362,14 @@ class in XCharts.Runtime
- `Linear`: - `Linear`:
## AnimationExchange
class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
> 从 `v3.15.0` 开始支持
数据交换动画。一般用于图表数据排序时顺序变化的动画。
## AnimationFadeIn ## AnimationFadeIn
class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo) class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
@@ -386,7 +396,7 @@ class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
## AnimationInfo ## AnimationInfo
class in XCharts.Runtime / 子类: [AnimationFadeIn](#animationfadein),[AnimationFadeOut](#animationfadeout),[AnimationChange](#animationchange),[AnimationAddition](#animationaddition),[AnimationHiding](#animationhiding),[AnimationInteraction](#animationinteraction) class in XCharts.Runtime / 子类: [AnimationFadeIn](#animationfadein),[AnimationFadeOut](#animationfadeout),[AnimationChange](#animationchange),[AnimationAddition](#animationaddition),[AnimationHiding](#animationhiding),[AnimationInteraction](#animationinteraction),[AnimationExchange](#animationexchange)
> 从 `v3.8.0` 开始支持 > 从 `v3.8.0` 开始支持
@@ -531,7 +541,7 @@ public float GetWidth(float width)
class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent) class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画。 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画 动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画Exchange交换动画。 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画
### AnimationStyle.addition ### AnimationStyle.addition
@@ -548,6 +558,11 @@ public AnimationChange change
public bool enable public bool enable
是否开启动画效果。 是否开启动画效果。
### AnimationStyle.exchange
public AnimationExchange exchange
交换动画配置。如在排序柱图中有效。
### AnimationStyle.fadeIn ### AnimationStyle.fadeIn
public AnimationFadeIn fadeIn public AnimationFadeIn fadeIn
@@ -639,6 +654,10 @@ public int GetCurrIndex()
public float GetCurrRate() public float GetCurrRate()
### AnimationStyle.GetExchangeDuration
public float GetExchangeDuration()
### AnimationStyle.GetInteractionDuration ### AnimationStyle.GetInteractionDuration
public float GetInteractionDuration() public float GetInteractionDuration()
@@ -1097,7 +1116,7 @@ public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleW
### AxisHelper.GetAxisValueLength ### AxisHelper.GetAxisValueLength
public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value) public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value, float gap = 0)
获得数值value在坐标轴上对应的长度 获得数值value在坐标轴上对应的长度
### AxisHelper.GetAxisValuePosition ### AxisHelper.GetAxisValuePosition
@@ -1674,6 +1693,10 @@ public Settings settings
public ThemeStyle theme public ThemeStyle theme
### BaseChart.topPainter
public Painter topPainter
### BaseChart.typeListForComponent ### BaseChart.typeListForComponent
public Dictionary<Type, FieldInfo> typeListForComponent public Dictionary<Type, FieldInfo> typeListForComponent
@@ -3428,13 +3451,20 @@ public static Color32 GetColor(string hexColorStr)
class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent),[IPropertyChanged](#ipropertychanged) class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent),[IPropertyChanged](#ipropertychanged)
图表注解组件。 > 从 `v3.15.0` 开始支持
图表注解组件。用于标注图表中的特殊信息。
### Comment.items ### Comment.items
public List<CommentItem> items public List<CommentItem> items
注解项。每个注解组件可以设置多个注解项。 注解项。每个注解组件可以设置多个注解项。
### Comment.layer
public CommentLayer layer
注解的显示层级。
### Comment.show ### Comment.show
public bool show public bool show
@@ -3443,10 +3473,12 @@ public bool show
### Comment.GetLabelStyle ### Comment.GetLabelStyle
public LabelStyle GetLabelStyle(int index) public LabelStyle GetLabelStyle(int index)
获取注解项的文本样式。
### Comment.GetMarkStyle ### Comment.GetMarkStyle
public CommentMarkStyle GetMarkStyle(int index) public CommentMarkStyle GetMarkStyle(int index)
获取注解项的标记样式。
### Comment.OnChanged ### Comment.OnChanged
@@ -3478,6 +3510,17 @@ public CommentMarkStyle markStyle
public bool show public bool show
是否显示当前注解项。 是否显示当前注解项。
## CommentLayer
class in XCharts.Runtime
注解的显示层级。
可选:
- `Lower`: 注解在系列下方。
- `Upper`: 注解在系列上方。
## CommentMarkStyle ## CommentMarkStyle
class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent) class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
@@ -7257,6 +7300,10 @@ class in XCharts.Runtime
public void Reset() public void Reset()
### SerieDataContext.UpdateExchangePosition
public void UpdateExchangePosition(ref float x, ref float y, float totalTime)
## SerieDataExtraFieldAttribute ## SerieDataExtraFieldAttribute
class in XCharts.Runtime / 继承自: [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute) class in XCharts.Runtime / 继承自: [Attribute](https://docs.unity3d.com/ScriptReference/30_search.html?q=attribute)
@@ -7685,6 +7732,10 @@ public override void RefreshLabelInternal()
public override void RefreshLabelNextFrame() public override void RefreshLabelNextFrame()
### SerieHandler<T>.RefreshTitleLabelInternal
public void RefreshTitleLabelInternal()
### SerieHandler<T>.RemoveComponent ### SerieHandler<T>.RemoveComponent
public override void RemoveComponent() public override void RemoveComponent()

View File

@@ -80,6 +80,7 @@ slug: /changelog
## master ## master
* (2025.03.26) 增加`Animation``Exchange`排序交换动画
* (2025.03.22) 增加`Comment``layer`设置层级 * (2025.03.22) 增加`Comment``layer`设置层级
* (2025.03.21) 优化`Comment`的坐标刷新 * (2025.03.21) 优化`Comment`的坐标刷新
* (2025.03.19) 增加`Serie``Label``formatter`支持`{index}`通配符 * (2025.03.19) 增加`Serie``Label``formatter`支持`{index}`通配符

View File

@@ -176,6 +176,7 @@ slug: /configuration
- [AnimationAddition](#animationaddition) - [AnimationAddition](#animationaddition)
- [AnimationChange](#animationchange) - [AnimationChange](#animationchange)
- [AnimationExchange](#animationexchange)
- [AnimationFadeIn](#animationfadein) - [AnimationFadeIn](#animationfadein)
- [AnimationFadeOut](#animationfadeout) - [AnimationFadeOut](#animationfadeout)
- [AnimationHiding](#animationhiding) - [AnimationHiding](#animationhiding)
@@ -234,6 +235,14 @@ class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
数据变更动画。 数据变更动画。
## AnimationExchange
class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
> 从 `v3.15.0` 开始支持
数据交换动画。一般用于图表数据排序时顺序变化的动画。
## AnimationFadeIn ## AnimationFadeIn
class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo) class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
@@ -260,7 +269,7 @@ class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
## AnimationInfo ## AnimationInfo
class in XCharts.Runtime / 子类: [AnimationFadeIn](#animationfadein), [AnimationFadeOut](#animationfadeout), [AnimationChange](#animationchange), [AnimationAddition](#animationaddition), [AnimationHiding](#animationhiding), [AnimationInteraction](#animationinteraction) class in XCharts.Runtime / 子类: [AnimationFadeIn](#animationfadein), [AnimationFadeOut](#animationfadeout), [AnimationChange](#animationchange), [AnimationAddition](#animationaddition), [AnimationHiding](#animationhiding), [AnimationInteraction](#animationinteraction), [AnimationExchange](#animationexchange)
> 从 `v3.8.0` 开始支持 > 从 `v3.8.0` 开始支持
@@ -326,7 +335,7 @@ class in XCharts.Runtime / 继承自: [AnimationInfo](#animationinfo)
class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent) class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画。 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画 动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画Exchange交换动画。 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画
### AnimationStyle.addition ### AnimationStyle.addition
@@ -356,6 +365,12 @@ class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent)
是否开启动画效果。 是否开启动画效果。
### AnimationStyle.exchange
[AnimationExchange](#animationexchange) `v3.15.0`
交换动画配置。如在排序柱图中有效。
### AnimationStyle.fadeIn ### AnimationStyle.fadeIn
[AnimationFadeIn](#animationfadein) `v3.8.0` [AnimationFadeIn](#animationfadein) `v3.8.0`
@@ -1247,7 +1262,9 @@ class in XCharts.Runtime / 子类: [AnimationStyle](#animationstyle), [AxisAnima
class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IPropertyChanged](#ipropertychanged) class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IPropertyChanged](#ipropertychanged)
图表注解组件。 > 从 `v3.15.0` 开始支持
图表注解组件。用于标注图表中的特殊信息。
### Comment.items ### Comment.items
@@ -1261,6 +1278,17 @@ class in XCharts.Runtime / 继承自: [MainComponent](#maincomponent), [IPropert
所有组件的文本样式。 所有组件的文本样式。
### Comment.layer
[CommentLayer](#commentlayer) `v3.15.0`
注解的显示层级。
可选:
- `Lower`: 注解在系列下方。
- `Upper`: 注解在系列上方。
### Comment.markStyle ### Comment.markStyle
[CommentMarkStyle](#commentmarkstyle) [CommentMarkStyle](#commentmarkstyle)
@@ -2238,6 +2266,12 @@ class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent), [ISerie
数据项背景颜色。 数据项背景颜色。
### ItemStyle.backgroundGap
`float` `v3.15.0`
数据项背景间隙。
### ItemStyle.backgroundWidth ### ItemStyle.backgroundWidth
`float` `float`
@@ -2464,6 +2498,18 @@ class in XCharts.Runtime / 继承自: [ChildComponent](#childcomponent), [ISerie
距离轴线的距离。 距离轴线的距离。
### LabelStyle.fixedX
`float` `0` `v3.15.0`
固定的X值。不为0时会固定在指定的X值上。
### LabelStyle.fixedY
`float` `0` `v3.15.0`
固定的Y值。不为0时会固定在指定的Y值上。
### LabelStyle.formatter ### LabelStyle.formatter
`string` `string`

View File

@@ -71,6 +71,21 @@ namespace XCharts.Editor
} }
} }
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationExchange), true)]
public class AnimationExchangeDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AnimationStyle), true)] [CustomPropertyDrawer(typeof(AnimationStyle), true)]
public class AnimationDrawer : BasePropertyDrawer public class AnimationDrawer : BasePropertyDrawer
{ {
@@ -88,6 +103,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_Change"); PropertyField(prop, "m_Change");
PropertyField(prop, "m_Addition"); PropertyField(prop, "m_Addition");
PropertyField(prop, "m_Interaction"); PropertyField(prop, "m_Interaction");
PropertyField(prop, "m_Exchange");
--EditorGUI.indentLevel; --EditorGUI.indentLevel;
} }
} }

View File

@@ -493,4 +493,14 @@ namespace XCharts.Runtime
return m_Offset.value; return m_Offset.value;
} }
} }
/// <summary>
/// Data exchange animation. Generally used for animation of data sorting.
/// ||数据交换动画。一般用于图表数据排序时顺序变化的动画。
/// </summary>
[Since("v3.15.0")]
[System.Serializable]
public class AnimationExchange : AnimationInfo
{
}
} }

View File

@@ -44,8 +44,8 @@ namespace XCharts.Runtime
} }
/// <summary> /// <summary>
/// the animation of serie. support animation type: fadeIn, fadeOut, change, addition. /// the animation of serie. support animation type: fadeIn, fadeOut, change, addition, exchange.
/// ||动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画 /// ||动画组件用于控制图表的动画播放。支持配置五种动画表现FadeIn渐入动画FadeOut渐出动画Change变更动画Addition新增动画Interaction交互动画Exchange交换动画
/// 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画 /// 按作用的对象可以分为两类SerieAnimation系列动画和DataAnimation数据动画
/// </summary> /// </summary>
[System.Serializable] [System.Serializable]
@@ -62,6 +62,7 @@ namespace XCharts.Runtime
[SerializeField][Since("v3.8.0")] private AnimationAddition m_Addition = new AnimationAddition() { duration = 500 }; [SerializeField][Since("v3.8.0")] private AnimationAddition m_Addition = new AnimationAddition() { duration = 500 };
[SerializeField][Since("v3.8.0")] private AnimationHiding m_Hiding = new AnimationHiding() { duration = 500 }; [SerializeField][Since("v3.8.0")] private AnimationHiding m_Hiding = new AnimationHiding() { duration = 500 };
[SerializeField][Since("v3.8.0")] private AnimationInteraction m_Interaction = new AnimationInteraction() { duration = 250 }; [SerializeField][Since("v3.8.0")] private AnimationInteraction m_Interaction = new AnimationInteraction() { duration = 250 };
[SerializeField][Since("v3.15.0")] private AnimationExchange m_Exchange = new AnimationExchange() { duration = 250 };
[Obsolete("Use animation.fadeIn.delayFunction instead.", true)] [Obsolete("Use animation.fadeIn.delayFunction instead.", true)]
public AnimationDelayFunction fadeInDelayFunction; public AnimationDelayFunction fadeInDelayFunction;
@@ -138,6 +139,11 @@ namespace XCharts.Runtime
/// ||交互动画配置。 /// ||交互动画配置。
/// </summary> /// </summary>
public AnimationInteraction interaction { get { return m_Interaction; } } public AnimationInteraction interaction { get { return m_Interaction; } }
/// <summary>
/// Exchange animation configuration. Valid in sort bar chart.
/// ||交换动画配置。如在排序柱图中有效。
/// </summary>
public AnimationExchange exchange { get { return m_Exchange; } }
private Vector3 m_LinePathLastPos; private Vector3 m_LinePathLastPos;
private List<AnimationInfo> m_Animations; private List<AnimationInfo> m_Animations;
@@ -147,12 +153,15 @@ namespace XCharts.Runtime
{ {
if (m_Animations == null) if (m_Animations == null)
{ {
m_Animations = new List<AnimationInfo>(); m_Animations = new List<AnimationInfo>
m_Animations.Add(m_FadeIn); {
m_Animations.Add(m_FadeOut); m_FadeIn,
m_Animations.Add(m_Change); m_FadeOut,
m_Animations.Add(m_Addition); m_Change,
m_Animations.Add(m_Hiding); m_Addition,
m_Hiding,
m_Exchange
};
} }
return m_Animations; return m_Animations;
} }
@@ -565,6 +574,14 @@ namespace XCharts.Runtime
return 0; return 0;
} }
public float GetExchangeDuration()
{
if (m_Enable && m_Exchange.enable)
return m_Exchange.context.currDuration > 0 ? m_Exchange.context.currDuration : m_Exchange.duration;
else
return 0;
}
public float GetAdditionDuration() public float GetAdditionDuration()
{ {
if (m_Enable && m_Addition.enable) if (m_Enable && m_Addition.enable)

View File

@@ -253,9 +253,9 @@ namespace XCharts
var serie = chart.GetSerie(0); var serie = chart.GetSerie(0);
if (isCategory && serie != null && serie.useSortData) if (isCategory && serie != null && serie.useSortData)
{ {
var isY = axis is YAxis;
var showData = serie.GetDataList(dataZoom, true); var showData = serie.GetDataList(dataZoom, true);
var isChanged = CheckSortedDataChanged(axis, showData); if (CheckSortedDataChanged(axis, showData))
if (isChanged)
{ {
for (int i = 0; i < context.labelObjectList.Count; i++) for (int i = 0; i < context.labelObjectList.Count; i++)
{ {
@@ -268,6 +268,25 @@ namespace XCharts
} }
SaveSortedDataIndex(axis, showData); SaveSortedDataIndex(axis, showData);
} }
if (CheckSortedDataAnimation(axis, showData))
{
float diff = axis.context.scaleWidth / 2;
for (int i = 0; i < context.labelObjectList.Count; i++)
{
var labelObject = context.labelObjectList[i];
if (labelObject != null)
{
if (i < showData.Count)
{
var serieData = showData[i];
var pos = serieData.context.exchangePosition;
if (ChartHelper.IsZeroVector(pos)) continue;
var sourPos = labelObject.GetPosition();
labelObject.SetPosition(isY ? new Vector3(sourPos.x, pos.y + diff) : new Vector3(pos.x + diff, sourPos.y));
}
}
}
}
} }
else else
{ {
@@ -282,7 +301,7 @@ namespace XCharts
} }
} }
private bool CheckSortedDataChanged(Axis axis, List<SerieData> dataList) private static bool CheckSortedDataChanged(Axis axis, List<SerieData> dataList)
{ {
if (dataList.Count != axis.context.sortedDataIndices.Count) return true; if (dataList.Count != axis.context.sortedDataIndices.Count) return true;
for (int i = 0; i < dataList.Count; i++) for (int i = 0; i < dataList.Count; i++)
@@ -292,7 +311,17 @@ namespace XCharts
return false; return false;
} }
private void SaveSortedDataIndex(Axis axis, List<SerieData> dataList) private static bool CheckSortedDataAnimation(Axis axis, List<SerieData> dataList)
{
if (!axis.IsCategory()) return false;
foreach (var data in dataList)
{
if (!data.context.exchangeEnd) return true;
}
return false;
}
private static void SaveSortedDataIndex(Axis axis, List<SerieData> dataList)
{ {
axis.context.sortedDataIndices.Clear(); axis.context.sortedDataIndices.Clear();
for (int i = 0; i < dataList.Count; i++) for (int i = 0; i < dataList.Count; i++)
@@ -484,7 +513,6 @@ namespace XCharts
SerieHelper.UpdateSerieRuntimeFilterData(sortSerie); SerieHelper.UpdateSerieRuntimeFilterData(sortSerie);
} }
var showData = sortSerie != null ? sortSerie.GetDataList(dataZoom, true) : null; var showData = sortSerie != null ? sortSerie.GetDataList(dataZoom, true) : null;
for (int i = 0; i < splitNumber; i++) for (int i = 0; i < splitNumber; i++)
{ {
var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom); var labelWidth = AxisHelper.GetScaleWidth(axis, axisLength, i + 1, dataZoom);

View File

@@ -207,11 +207,13 @@ namespace XCharts.Runtime
var dataChangeDuration = serie.animation.GetChangeDuration(); var dataChangeDuration = serie.animation.GetChangeDuration();
var dataAddDuration = serie.animation.GetAdditionDuration(); var dataAddDuration = serie.animation.GetAdditionDuration();
var interactDuration = serie.animation.GetInteractionDuration(); var interactDuration = serie.animation.GetInteractionDuration();
var exchangeDuration = serie.animation.GetExchangeDuration();
var areaColor = ColorUtil.clearColor32; var areaColor = ColorUtil.clearColor32;
var areaToColor = ColorUtil.clearColor32; var areaToColor = ColorUtil.clearColor32;
var interacting = false; var interacting = false;
axis.context.scaleWidth = categoryWidth;
serie.context.isHorizontal = isY; serie.context.isHorizontal = isY;
serie.containerIndex = m_SerieGrid.index; serie.containerIndex = m_SerieGrid.index;
serie.containterInstanceId = m_SerieGrid.instanceId; serie.containterInstanceId = m_SerieGrid.instanceId;
@@ -249,7 +251,11 @@ namespace XCharts.Runtime
var pY = 0f; var pY = 0f;
UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, relativedCategoryWidth, UpdateXYPosition(m_SerieGrid, isY, axis, relativedAxis, i, categoryWidth, relativedCategoryWidth,
barWidth, isStack, value, backgroundGap, ref pX, ref pY); barWidth, isStack, value, backgroundGap, ref pX, ref pY);
var barHig = 0f; if (serie.useSortData)
{
serieData.context.UpdateExchangePosition(ref pX, ref pY, exchangeDuration);
}
float barHig;
if (isPercentStack) if (isPercentStack)
{ {
var valueTotal = chart.GetSerieSameStackTotalValue<Bar>(serie.stack, i, m_SerieGrid.index); var valueTotal = chart.GetSerieSameStackTotalValue<Bar>(serie.stack, i, m_SerieGrid.index);

View File

@@ -35,6 +35,19 @@ namespace XCharts.Runtime
public float offsetRadius; public float offsetRadius;
public float outsideRadius; public float outsideRadius;
public Vector3 position; public Vector3 position;
/// <summary>
/// is the exchange animation end.
/// ||交换动画是否结束。
/// </summary>
public bool exchangeEnd;
/// <summary>
/// the current position of the exchange animation.
/// ||交换动画的当前位置。
/// </summary>
public Vector3 exchangePosition;
private float exchangeStartTime;
private Vector3 exchangeStartPosition;
private Vector3 exchangeEndPosition;
public List<Vector3> dataPoints = new List<Vector3>(); public List<Vector3> dataPoints = new List<Vector3>();
public List<ChartLabel> dataLabels = new List<ChartLabel>(); public List<ChartLabel> dataLabels = new List<ChartLabel>();
public List<SerieData> children = new List<SerieData>(); public List<SerieData> children = new List<SerieData>();
@@ -77,9 +90,61 @@ namespace XCharts.Runtime
symbol = null; symbol = null;
rect = Rect.zero; rect = Rect.zero;
subRect = Rect.zero; subRect = Rect.zero;
exchangeEnd = true;
exchangeStartPosition = Vector3.zero;
exchangePosition = Vector3.zero;
exchangeEndPosition = Vector3.zero;
children.Clear(); children.Clear();
dataPoints.Clear(); dataPoints.Clear();
dataLabels.Clear(); dataLabels.Clear();
} }
public void UpdateExchangePosition(ref float x, ref float y, float totalTime)
{
if (exchangeEndPosition.x != x || exchangeEndPosition.y != y)
{
if (exchangeStartPosition == Vector3.zero || Time.time - exchangeStartTime < 0.1f)
{
exchangeEnd = true;
exchangeStartTime = Time.time;
exchangeEndPosition.x = x;
exchangeEndPosition.y = y;
exchangeStartPosition = exchangeEndPosition;
exchangePosition = exchangeEndPosition;
return;
}
else
{
exchangeEnd = false;
exchangeStartTime = Time.time;
exchangeStartPosition = exchangePosition;
exchangeEndPosition.x = x;
exchangeEndPosition.y = y;
}
}
if (exchangeStartPosition == exchangeEndPosition)
{
exchangeEnd = true;
exchangePosition = exchangeEndPosition;
x = exchangePosition.x;
y = exchangePosition.y;
return;
}
var spendTime = Time.time - exchangeStartTime;
totalTime /= 1000;
if (spendTime >= totalTime)
{
exchangeEnd = true;
exchangeStartPosition = exchangeEndPosition;
exchangePosition = exchangeEndPosition;
x = exchangePosition.x;
y = exchangePosition.y;
return;
}
exchangePosition = Vector3.Lerp(exchangeStartPosition, exchangeEndPosition, spendTime / totalTime);
x = exchangePosition.x;
y = exchangePosition.y;
return;
}
} }
} }