mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
增加BaseChart.AnimationFadeOut()渐入动画,重构动画系统
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.02.23) 增加`BaseChart.AnimationFadeOut()`渐入动画,重构动画系统
|
||||||
* (2020.02.13) 增加`BaseChart.RefreshTooltip()`接口立即重新初始化`Tooltip`组件
|
* (2020.02.13) 增加`BaseChart.RefreshTooltip()`接口立即重新初始化`Tooltip`组件
|
||||||
* (2020.02.13) 增加`Tooltip`的`textStyle`参数配置内容文本样式,去掉`fontSize`和`fontStyle`参数
|
* (2020.02.13) 增加`Tooltip`的`textStyle`参数配置内容文本样式,去掉`fontSize`和`fontStyle`参数
|
||||||
* (2020.02.13) 增加`TextStyle`的`lineSpacing`参数配置行间距
|
* (2020.02.13) 增加`TextStyle`的`lineSpacing`参数配置行间距
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
* (2019.12.06) 修复数据过小时`AxisLabel`直接科学计数法显示的问题
|
* (2019.12.06) 修复数据过小时`AxisLabel`直接科学计数法显示的问题
|
||||||
* (2019.12.04) 优化和完善数据更新`UpdateData`接口
|
* (2019.12.04) 优化和完善数据更新`UpdateData`接口
|
||||||
* (2019.12.03) 增加圆环饼图的圆角支持,参数:`serie.arcShaped`
|
* (2019.12.03) 增加圆环饼图的圆角支持,参数:`serie.arcShaped`
|
||||||
* (2019.12.03) 增加数据更新动画,参数:`serie.animation.updateAnimation`
|
* (2019.12.03) 增加数据更新动画,参数:`serie.animation.dataChangeEnable`
|
||||||
* (2019.11.30) 增加`GaugeChart`仪表盘
|
* (2019.11.30) 增加`GaugeChart`仪表盘
|
||||||
* (2019.11.22) 修复`BarChart`清空数据重新赋值后`SerieLabel`显示异常的问题
|
* (2019.11.22) 修复`BarChart`清空数据重新赋值后`SerieLabel`显示异常的问题
|
||||||
* (2019.11.16) 修复`SerieLabel`设置`color`等参数不生效的问题
|
* (2019.11.16) 修复`SerieLabel`设置`color`等参数不生效的问题
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
updateTime = 0;
|
updateTime = 0;
|
||||||
var serie = chart.series.GetSerie(0);
|
var serie = chart.series.GetSerie(0);
|
||||||
//serie.animation.updateAnimation = true;
|
//serie.animation.dataChangeEnable = true;
|
||||||
var dataCount = serie.dataCount;
|
var dataCount = serie.dataCount;
|
||||||
if (chart is RadarChart)
|
if (chart is RadarChart)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace XCharts
|
|||||||
serie.center[1] = 0.5f;
|
serie.center[1] = 0.5f;
|
||||||
serie.radius[0] = 80;
|
serie.radius[0] = 80;
|
||||||
serie.splitNumber = 5;
|
serie.splitNumber = 5;
|
||||||
serie.animation.updateAnimation = true;
|
serie.animation.dataChangeEnable = true;
|
||||||
serie.arcShaped = true;
|
serie.arcShaped = true;
|
||||||
|
|
||||||
serie.titleStyle.show = true;
|
serie.titleStyle.show = true;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
updateTime = 0;
|
updateTime = 0;
|
||||||
var serie = chart.series.GetSerie(0);
|
var serie = chart.series.GetSerie(0);
|
||||||
serie.animation.updateAnimation = true;
|
serie.animation.dataChangeEnable = true;
|
||||||
var dataCount = serie.dataCount;
|
var dataCount = serie.dataCount;
|
||||||
if (chart is HeatmapChart)
|
if (chart is HeatmapChart)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,10 +42,12 @@
|
|||||||
* `BaseChart.RefreshLabel()`:在下一帧刷新文本标签。
|
* `BaseChart.RefreshLabel()`:在下一帧刷新文本标签。
|
||||||
* `BaseChart.RefreshTooltip()`:立即刷新`Tooltip`组件。
|
* `BaseChart.RefreshTooltip()`:立即刷新`Tooltip`组件。
|
||||||
* `BaseChart.UpdateTheme(Theme theme)`:切换图表主题。
|
* `BaseChart.UpdateTheme(Theme theme)`:切换图表主题。
|
||||||
* `BaseChart.AnimationEnable(bool flag)`:启用或关闭起始动画。
|
* `BaseChart.AnimationEnable(bool flag)`:启用或关闭动画。
|
||||||
* `BaseChart.AnimationStart()`:开始初始动画。
|
* `BaseChart.AnimationFadeIn()`:渐入动画。
|
||||||
* `BaseChart.AnimationStop()`:停止初始化动画。
|
* `BaseChart.AnimationFadeOut()`:渐出动画。
|
||||||
* `BaseChart.AnimationReset()`:重置初始动画,重新播放。
|
* `BaseChart.AnimationPause()`:暂停动画。
|
||||||
|
* `BaseChart.AnimationResume()`:继续动画。
|
||||||
|
* `BaseChart.AnimationReset()`:重置动画。
|
||||||
* `BaseChart.ClickLegendButton(int legendIndex, string legendName, bool show)`:点击图例按钮。
|
* `BaseChart.ClickLegendButton(int legendIndex, string legendName, bool show)`:点击图例按钮。
|
||||||
|
|
||||||
## `CoordinateChart`
|
## `CoordinateChart`
|
||||||
|
|||||||
@@ -608,14 +608,13 @@
|
|||||||
|
|
||||||
## `SerieAnimation`
|
## `SerieAnimation`
|
||||||
|
|
||||||
* `enable`:是否开起始画效果。
|
* `enable`:是否开启动画系统。
|
||||||
* `easing`:动画的缓动效果。支持以下动画效果:
|
* ~~`threshold`:是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。~~
|
||||||
* `Linear`:线性效果。
|
* `fadeInDelay`:设定的渐入动画延时,单位毫秒。
|
||||||
* `duration`:设定的动画时长,单位毫秒。
|
* `fadeInDuration`:设定的渐入动画时长,单位毫秒。
|
||||||
* `updateAnimation`:是否开启数据变更动画。
|
* `fadeOutDuration`:设定的渐出动画时长,单位毫秒。
|
||||||
* `updateDuration`:数据变更动画时长,单位毫秒。
|
* `dataChangeEnable`:是否开启数据变更动画。
|
||||||
* `threshold`:是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。
|
* `dataChangeDuration`:数据变更动画时长,单位毫秒。
|
||||||
* `delay`:动画延时,单位毫秒。
|
|
||||||
|
|
||||||
## `AreaStyle`
|
## `AreaStyle`
|
||||||
|
|
||||||
|
|||||||
@@ -22,11 +22,12 @@ namespace XCharts
|
|||||||
drawRect.height = EditorGUIUtility.singleLineHeight;
|
drawRect.height = EditorGUIUtility.singleLineHeight;
|
||||||
|
|
||||||
SerializedProperty m_Enable = prop.FindPropertyRelative("m_Enable");
|
SerializedProperty m_Enable = prop.FindPropertyRelative("m_Enable");
|
||||||
SerializedProperty m_Easting = prop.FindPropertyRelative("m_Easting");
|
//SerializedProperty m_Easting = prop.FindPropertyRelative("m_Easting");
|
||||||
SerializedProperty m_Duration = prop.FindPropertyRelative("m_Duration");
|
SerializedProperty m_FadeInDuration = prop.FindPropertyRelative("m_FadeInDuration");
|
||||||
SerializedProperty m_UpdateAnimation = prop.FindPropertyRelative("m_UpdateAnimation");
|
SerializedProperty m_FadeOutDuration = prop.FindPropertyRelative("m_FadeOutDuration");
|
||||||
SerializedProperty m_UpdateDuration = prop.FindPropertyRelative("m_UpdateDuration");
|
SerializedProperty m_DataChangeEnable = prop.FindPropertyRelative("m_DataChangeEnable");
|
||||||
SerializedProperty m_Delay = prop.FindPropertyRelative("m_Delay");
|
SerializedProperty m_DataChangeDuration = prop.FindPropertyRelative("m_DataChangeDuration");
|
||||||
|
SerializedProperty m_FadeInDelay = prop.FindPropertyRelative("m_FadeInDelay");
|
||||||
SerializedProperty m_Threshold = prop.FindPropertyRelative("m_Threshold");
|
SerializedProperty m_Threshold = prop.FindPropertyRelative("m_Threshold");
|
||||||
SerializedProperty m_ActualDuration = prop.FindPropertyRelative("m_ActualDuration");
|
SerializedProperty m_ActualDuration = prop.FindPropertyRelative("m_ActualDuration");
|
||||||
// SerializedProperty m_CurrDetailProgress = prop.FindPropertyRelative("m_CurrDetailProgress");
|
// SerializedProperty m_CurrDetailProgress = prop.FindPropertyRelative("m_CurrDetailProgress");
|
||||||
@@ -37,23 +38,26 @@ namespace XCharts
|
|||||||
if (ChartEditorHelper.IsToggle(m_AnimationModuleToggle, prop))
|
if (ChartEditorHelper.IsToggle(m_AnimationModuleToggle, prop))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
EditorGUI.PropertyField(drawRect, m_Easting);
|
//EditorGUI.PropertyField(drawRect, m_Easting);
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
//drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_Threshold);
|
EditorGUI.PropertyField(drawRect, m_Threshold);
|
||||||
if (m_Threshold.intValue < 0) m_Threshold.intValue = 0;
|
if (m_Threshold.intValue < 0) m_Threshold.intValue = 0;
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_Delay);
|
EditorGUI.PropertyField(drawRect, m_FadeInDelay);
|
||||||
if (m_Delay.floatValue < 0) m_Delay.floatValue = 0;
|
if (m_FadeInDelay.floatValue < 0) m_FadeInDelay.floatValue = 0;
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_Duration);
|
EditorGUI.PropertyField(drawRect, m_FadeInDuration);
|
||||||
if (m_Duration.floatValue < 0) m_Duration.floatValue = 0;
|
if (m_FadeInDuration.floatValue < 0) m_FadeInDuration.floatValue = 0;
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_UpdateAnimation);
|
EditorGUI.PropertyField(drawRect, m_FadeOutDuration);
|
||||||
|
if (m_FadeOutDuration.floatValue < 0) m_FadeOutDuration.floatValue = 0;
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
EditorGUI.PropertyField(drawRect, m_UpdateDuration);
|
EditorGUI.PropertyField(drawRect, m_DataChangeEnable);
|
||||||
if (m_UpdateDuration.floatValue < 0) m_UpdateDuration.floatValue = 0;
|
|
||||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
EditorGUI.PropertyField(drawRect, m_DataChangeDuration);
|
||||||
|
if (m_DataChangeDuration.floatValue < 0) m_DataChangeDuration.floatValue = 0;
|
||||||
|
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
|
|
||||||
// EditorGUI.LabelField(drawRect, "CurrDetailProgress:" + m_CurrDetailProgress.floatValue);
|
// EditorGUI.LabelField(drawRect, "CurrDetailProgress:" + m_CurrDetailProgress.floatValue);
|
||||||
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
// drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||||
// EditorGUI.LabelField(drawRect, "DestDetailProgress:" + m_DestDetailProgress.floatValue);
|
// EditorGUI.LabelField(drawRect, "DestDetailProgress:" + m_DestDetailProgress.floatValue);
|
||||||
|
|||||||
@@ -523,32 +523,62 @@ namespace XCharts
|
|||||||
m_Series.AnimationEnable(flag);
|
m_Series.AnimationEnable(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("Use BaseChart.AnimationFadeIn() instead.", true)]
|
||||||
/// Start play animation.
|
|
||||||
/// 开始初始动画。
|
|
||||||
/// </summary>
|
|
||||||
public void AnimationStart()
|
public void AnimationStart()
|
||||||
{
|
{
|
||||||
m_Series.AnimationStart();
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use BaseChart.AnimationFadeOut() instead.", true)]
|
||||||
|
public void MissAnimationStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// fadeIn animation.
|
||||||
|
/// 开始渐入动画。
|
||||||
|
/// </summary>
|
||||||
|
public void AnimationFadeIn()
|
||||||
|
{
|
||||||
|
m_Series.AnimationFadeIn();
|
||||||
|
RefreshChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// fadeIn animation.
|
||||||
|
/// 开始渐出动画。
|
||||||
|
/// </summary>
|
||||||
|
public void AnimationFadeOut()
|
||||||
|
{
|
||||||
|
m_Series.AnimationFadeOut();
|
||||||
|
RefreshChart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pause animation.
|
||||||
|
/// 暂停动画。
|
||||||
|
/// </summary>
|
||||||
|
public void AnimationPause()
|
||||||
|
{
|
||||||
|
m_Series.AnimationPause();
|
||||||
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop play animation.
|
/// Stop play animation.
|
||||||
/// 停止初始化动画。
|
/// 继续动画。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AnimationStop()
|
public void AnimationResume()
|
||||||
{
|
{
|
||||||
m_CheckAnimation = false;
|
m_Series.AnimationResume();
|
||||||
m_Series.AnimationStop();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset animation to play.
|
/// Reset animation.
|
||||||
/// 重置初始动画,重新播放。
|
/// 重置动画。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AnimationReset()
|
public void AnimationReset()
|
||||||
{
|
{
|
||||||
m_CheckAnimation = false;
|
|
||||||
m_Series.AnimationReset();
|
m_Series.AnimationReset();
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,20 +191,10 @@ namespace XCharts
|
|||||||
get { return m_RuntimeMinValue; }
|
get { return m_RuntimeMinValue; }
|
||||||
internal set
|
internal set
|
||||||
{
|
{
|
||||||
if (value != m_RuntimeMinValue)
|
m_RuntimeMinValue = value;
|
||||||
{
|
m_RuntimeLastMinValue = value;
|
||||||
if (m_RuntimeMinValueFirstChanged)
|
m_RuntimeMinValueUpdateTime = Time.time;
|
||||||
{
|
m_RuntimeMinValueChanged = true;
|
||||||
m_RuntimeMinValueFirstChanged = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_RuntimeLastMinValue = m_RuntimeMinValue;
|
|
||||||
m_RuntimeMinValueChanged = true;
|
|
||||||
m_RuntimeMinValueUpdateTime = Time.time;
|
|
||||||
}
|
|
||||||
m_RuntimeMinValue = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -216,20 +206,10 @@ namespace XCharts
|
|||||||
get { return m_RuntimeMaxValue; }
|
get { return m_RuntimeMaxValue; }
|
||||||
internal set
|
internal set
|
||||||
{
|
{
|
||||||
if (value != m_RuntimeMaxValue)
|
m_RuntimeMaxValue = value;
|
||||||
{
|
m_RuntimeLastMaxValue = value;
|
||||||
if (m_RuntimeMaxValueFirstChanged)
|
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||||
{
|
m_RuntimeMaxValueChanged = false;
|
||||||
m_RuntimeMaxValueFirstChanged = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_RuntimeLastMaxValue = m_RuntimeMaxValue;
|
|
||||||
m_RuntimeMaxValueChanged = true;
|
|
||||||
m_RuntimeMaxValueUpdateTime = Time.time;
|
|
||||||
}
|
|
||||||
m_RuntimeMaxValue = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -708,6 +688,62 @@ namespace XCharts
|
|||||||
m_ValueRange = maxValue - minValue;
|
m_ValueRange = maxValue - minValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void UpdateMinValue(float value, bool check)
|
||||||
|
{
|
||||||
|
if (value != m_RuntimeMaxValue)
|
||||||
|
{
|
||||||
|
if (check)
|
||||||
|
{
|
||||||
|
if (m_RuntimeMinValueFirstChanged)
|
||||||
|
{
|
||||||
|
m_RuntimeMinValueFirstChanged = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RuntimeLastMinValue = m_RuntimeMinValue;
|
||||||
|
m_RuntimeMinValueChanged = true;
|
||||||
|
m_RuntimeMinValueUpdateTime = Time.time;
|
||||||
|
}
|
||||||
|
m_RuntimeMinValue = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RuntimeMinValue = value;
|
||||||
|
m_RuntimeLastMinValue = value;
|
||||||
|
m_RuntimeMinValueUpdateTime = Time.time;
|
||||||
|
m_RuntimeMinValueChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void UpdateMaxValue(float value, bool check)
|
||||||
|
{
|
||||||
|
if (value != m_RuntimeMaxValue)
|
||||||
|
{
|
||||||
|
if (check)
|
||||||
|
{
|
||||||
|
if (m_RuntimeMaxValueFirstChanged)
|
||||||
|
{
|
||||||
|
m_RuntimeMaxValueFirstChanged = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RuntimeLastMaxValue = m_RuntimeMaxValue;
|
||||||
|
m_RuntimeMaxValueChanged = true;
|
||||||
|
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||||
|
}
|
||||||
|
m_RuntimeMaxValue = value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_RuntimeMaxValue = value;
|
||||||
|
m_RuntimeLastMaxValue = value;
|
||||||
|
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||||
|
m_RuntimeMaxValueChanged = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal float GetCurrMinValue(float duration)
|
internal float GetCurrMinValue(float duration)
|
||||||
{
|
{
|
||||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearData()
|
public void ClearData()
|
||||||
{
|
{
|
||||||
AnimationStop();
|
AnimationPause();
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
{
|
{
|
||||||
serie.ClearData();
|
serie.ClearData();
|
||||||
@@ -196,7 +196,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
{
|
{
|
||||||
if (serie.animation.enable && serie.animation.updateAnimation)
|
if (serie.animation.enable && serie.animation.dataChangeEnable)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -257,7 +257,7 @@ namespace XCharts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void RemoveAll()
|
public void RemoveAll()
|
||||||
{
|
{
|
||||||
AnimationStop();
|
AnimationPause();
|
||||||
m_Series.Clear();
|
m_Series.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
serie.symbol.type = SerieSymbolType.None;
|
serie.symbol.type = SerieSymbolType.None;
|
||||||
}
|
}
|
||||||
serie.animation.Reset();
|
serie.animation.Restart();
|
||||||
m_Series.Add(serie);
|
m_Series.Add(serie);
|
||||||
return serie;
|
return serie;
|
||||||
}
|
}
|
||||||
@@ -1006,32 +1006,54 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始初始动画
|
/// 渐入动画
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AnimationStart()
|
public void AnimationFadeIn()
|
||||||
{
|
{
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
{
|
{
|
||||||
if (serie.animation.enable)
|
if (serie.animation.enable)
|
||||||
{
|
{
|
||||||
serie.animation.Start();
|
serie.animation.FadeIn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 停止初始动画
|
/// 渐出动画
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AnimationStop()
|
public void AnimationFadeOut()
|
||||||
{
|
{
|
||||||
foreach (var serie in m_Series)
|
foreach (var serie in m_Series)
|
||||||
{
|
{
|
||||||
if (serie.animation.enable) serie.animation.Stop();
|
if (serie.animation.enable) serie.animation.FadeOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置初始动画
|
/// 暂停动画
|
||||||
|
/// </summary>
|
||||||
|
public void AnimationPause()
|
||||||
|
{
|
||||||
|
foreach (var serie in m_Series)
|
||||||
|
{
|
||||||
|
if (serie.animation.enable) serie.animation.Pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 继续动画
|
||||||
|
/// </summary>
|
||||||
|
public void AnimationResume()
|
||||||
|
{
|
||||||
|
foreach (var serie in m_Series)
|
||||||
|
{
|
||||||
|
if (serie.animation.enable) serie.animation.Resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重置动画
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AnimationReset()
|
public void AnimationReset()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/******************************************/
|
using System.Threading;
|
||||||
|
/******************************************/
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2018 monitor1394 */
|
/* Copyright (c) 2018 monitor1394 */
|
||||||
/* https://github.com/monitor1394 */
|
/* https://github.com/monitor1394 */
|
||||||
@@ -23,11 +24,12 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
[SerializeField] private bool m_Enable = true;
|
[SerializeField] private bool m_Enable = true;
|
||||||
[SerializeField] private Easing m_Easting;
|
[SerializeField] private Easing m_Easting;
|
||||||
[SerializeField] private float m_Duration = 1000;
|
|
||||||
[SerializeField] private int m_Threshold = 2000;
|
[SerializeField] private int m_Threshold = 2000;
|
||||||
[SerializeField] private float m_Delay = 0;
|
[SerializeField] private float m_FadeInDuration = 1000;
|
||||||
[SerializeField] private bool m_UpdateAnimation = true;
|
[SerializeField] private float m_FadeInDelay = 0;
|
||||||
[SerializeField] private float m_UpdateDuration = 500;
|
[SerializeField] private float m_FadeOutDuration = 1000f;
|
||||||
|
[SerializeField] private bool m_DataChangeEnable = true;
|
||||||
|
[SerializeField] private float m_DataChangeDuration = 500;
|
||||||
[SerializeField] private float m_ActualDuration;
|
[SerializeField] private float m_ActualDuration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -39,12 +41,17 @@ namespace XCharts
|
|||||||
/// Easing method used for the first animation.
|
/// Easing method used for the first animation.
|
||||||
/// 动画的缓动效果。
|
/// 动画的缓动效果。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Easing easing { get { return m_Easting; } set { m_Easting = value; } }
|
//public Easing easing { get { return m_Easting; } set { m_Easting = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds duration of the first animation.
|
/// The milliseconds duration of the fadeIn animation.
|
||||||
/// 设定的动画时长(毫秒)。
|
/// 设定的渐入动画时长(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float duration { get { return m_Duration; } set { m_Duration = value < 0 ? 0 : value; } }
|
public float fadeInDuration { get { return m_FadeInDuration; } set { m_FadeInDuration = value < 0 ? 0 : value; } }
|
||||||
|
/// <summary>
|
||||||
|
/// The milliseconds duration of the fadeOut animation.
|
||||||
|
/// 设定的渐出动画时长(毫秒)。
|
||||||
|
/// </summary>
|
||||||
|
public float fadeOutDuration { get { return m_FadeOutDuration; } set { m_FadeOutDuration = value < 0 ? 0 : value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds actual duration of the first animation.
|
/// The milliseconds actual duration of the first animation.
|
||||||
/// 实际的动画时长(毫秒)。
|
/// 实际的动画时长(毫秒)。
|
||||||
@@ -59,21 +66,24 @@ namespace XCharts
|
|||||||
/// The milliseconds delay before updating the first animation.
|
/// The milliseconds delay before updating the first animation.
|
||||||
/// 动画延时(毫秒)。
|
/// 动画延时(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float delay { get { return m_Delay; } set { m_Delay = value < 0 ? 0 : value; } }
|
public float delay { get { return m_FadeInDelay; } set { m_FadeInDelay = value < 0 ? 0 : value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否开启数据变更动画。
|
/// 是否开启数据变更动画。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool updateAnimation { get { return m_UpdateAnimation; } set { m_UpdateAnimation = value; } }
|
public bool dataChangeEnable { get { return m_DataChangeEnable; } set { m_DataChangeEnable = value; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The milliseconds duration of the first animation.
|
/// The milliseconds duration of the data change animation.
|
||||||
/// 数据变更的动画时长(毫秒)。
|
/// 数据变更的动画时长(毫秒)。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float updateDuration { get { return m_UpdateDuration; } set { m_UpdateDuration = value < 0 ? 0 : value; } }
|
public float dataChangeDuration { get { return m_DataChangeDuration; } set { m_DataChangeDuration = value < 0 ? 0 : value; } }
|
||||||
|
|
||||||
private Dictionary<int, float> m_DataAnimationState = new Dictionary<int, float>();
|
private Dictionary<int, float> m_DataAnimationState = new Dictionary<int, float>();
|
||||||
private bool m_IsStart = false;
|
private bool m_FadeIn = false;
|
||||||
private bool m_IsEnd = true;
|
private bool m_IsEnd = true;
|
||||||
private bool m_Inited = false;
|
private bool m_IsPause = false;
|
||||||
|
private bool m_FadeOut = false;
|
||||||
|
private bool m_FadeOuted = false;
|
||||||
|
private bool m_IsInit = false;
|
||||||
|
|
||||||
private float startTime { get; set; }
|
private float startTime { get; set; }
|
||||||
private int m_CurrDataProgress { get; set; }
|
private int m_CurrDataProgress { get; set; }
|
||||||
@@ -82,13 +92,21 @@ namespace XCharts
|
|||||||
[SerializeField] private float m_DestDetailProgress;
|
[SerializeField] private float m_DestDetailProgress;
|
||||||
private float m_CurrSymbolProgress;
|
private float m_CurrSymbolProgress;
|
||||||
|
|
||||||
public void Start()
|
public void FadeIn()
|
||||||
{
|
{
|
||||||
if (m_IsStart) return;
|
if (m_FadeOut) return;
|
||||||
|
if (m_IsPause)
|
||||||
|
{
|
||||||
|
m_IsPause = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_FadeIn) return;
|
||||||
startTime = Time.time;
|
startTime = Time.time;
|
||||||
m_IsStart = true;
|
m_FadeIn = true;
|
||||||
m_IsEnd = false;
|
m_IsEnd = false;
|
||||||
m_Inited = false;
|
m_IsInit = false;
|
||||||
|
m_IsPause = false;
|
||||||
|
m_FadeOuted = false;
|
||||||
m_CurrDataProgress = 1;
|
m_CurrDataProgress = 1;
|
||||||
m_DestDataProgress = 1;
|
m_DestDataProgress = 1;
|
||||||
m_CurrDetailProgress = 0;
|
m_CurrDetailProgress = 0;
|
||||||
@@ -97,34 +115,89 @@ namespace XCharts
|
|||||||
m_DataAnimationState.Clear();
|
m_DataAnimationState.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Restart()
|
||||||
{
|
{
|
||||||
m_IsStart = false;
|
Reset();
|
||||||
m_IsEnd = true;
|
FadeIn();
|
||||||
m_Inited = false;
|
}
|
||||||
|
|
||||||
|
public void FadeOut()
|
||||||
|
{
|
||||||
|
if (m_IsPause)
|
||||||
|
{
|
||||||
|
m_IsPause = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_FadeOut = true;
|
||||||
|
startTime = Time.time;
|
||||||
|
m_FadeIn = true;
|
||||||
|
m_IsEnd = false;
|
||||||
|
m_IsInit = false;
|
||||||
|
m_IsPause = false;
|
||||||
|
m_CurrDataProgress = 0;
|
||||||
|
m_DestDataProgress = 0;
|
||||||
|
m_CurrDetailProgress = 0;
|
||||||
|
m_DestDetailProgress = 1;
|
||||||
|
m_CurrSymbolProgress = 0;
|
||||||
m_DataAnimationState.Clear();
|
m_DataAnimationState.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void End()
|
public void Pause()
|
||||||
|
{
|
||||||
|
if (!m_IsPause)
|
||||||
|
{
|
||||||
|
m_IsPause = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Resume()
|
||||||
|
{
|
||||||
|
if (m_IsPause)
|
||||||
|
{
|
||||||
|
m_IsPause = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void End()
|
||||||
{
|
{
|
||||||
if (m_IsEnd) return;
|
if (m_IsEnd) return;
|
||||||
m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay;
|
m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay;
|
||||||
m_CurrDataProgress = m_DestDataProgress + 1;
|
m_CurrDataProgress = m_DestDataProgress + (m_FadeOut ? -1 : 1);
|
||||||
|
m_FadeIn = false;
|
||||||
m_IsEnd = true;
|
m_IsEnd = true;
|
||||||
|
m_IsInit = false;
|
||||||
|
if (m_FadeOut)
|
||||||
|
{
|
||||||
|
m_FadeOut = false;
|
||||||
|
m_FadeOuted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
Stop();
|
m_FadeIn = false;
|
||||||
Start();
|
m_IsEnd = true;
|
||||||
|
m_IsInit = false;
|
||||||
|
m_IsPause = false;
|
||||||
|
m_FadeOut = false;
|
||||||
|
m_FadeOuted = false;
|
||||||
|
m_DataAnimationState.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitProgress(int data, float curr, float dest)
|
public void InitProgress(int data, float curr, float dest)
|
||||||
{
|
{
|
||||||
if (!m_Inited && !m_IsEnd)
|
if (m_IsInit || m_IsEnd) return;
|
||||||
|
if (curr > dest) return;
|
||||||
|
m_IsInit = true;
|
||||||
|
m_DestDataProgress = data;
|
||||||
|
|
||||||
|
if (m_FadeOut)
|
||||||
|
{
|
||||||
|
m_CurrDetailProgress = dest;
|
||||||
|
m_DestDetailProgress = curr;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_Inited = true;
|
|
||||||
m_DestDataProgress = data;
|
|
||||||
m_CurrDetailProgress = curr;
|
m_CurrDetailProgress = curr;
|
||||||
m_DestDetailProgress = dest;
|
m_DestDetailProgress = dest;
|
||||||
}
|
}
|
||||||
@@ -132,23 +205,21 @@ namespace XCharts
|
|||||||
|
|
||||||
public void SetDataFinish(int dataIndex)
|
public void SetDataFinish(int dataIndex)
|
||||||
{
|
{
|
||||||
if (!m_IsEnd)
|
if (m_IsEnd) return;
|
||||||
{
|
m_CurrDataProgress = dataIndex + (m_FadeOut ? -1 : 1);
|
||||||
m_CurrDataProgress = dataIndex + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDataState(int index, float state)
|
private void SetDataState(int index, float state)
|
||||||
{
|
{
|
||||||
m_DataAnimationState[index] = state;
|
m_DataAnimationState[index] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetDataState(int index)
|
private float GetDataState(int index, float dest)
|
||||||
{
|
{
|
||||||
if (IsInDelay()) return 0;
|
if (IsInDelay()) return dest;
|
||||||
if (!m_DataAnimationState.ContainsKey(index))
|
if (!m_DataAnimationState.ContainsKey(index))
|
||||||
{
|
{
|
||||||
m_DataAnimationState.Add(index, 0);
|
m_DataAnimationState.Add(index, dest);
|
||||||
}
|
}
|
||||||
return m_DataAnimationState[index];
|
return m_DataAnimationState[index];
|
||||||
}
|
}
|
||||||
@@ -182,29 +253,95 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
if (!m_Enable || m_IsEnd) return true;
|
if (!m_Enable || m_IsEnd) return true;
|
||||||
if (IsInDelay()) return false;
|
if (IsInDelay()) return false;
|
||||||
return dataIndex <= m_CurrDataProgress;
|
if (m_FadeOut) return dataIndex > 0;
|
||||||
|
else return dataIndex <= m_CurrDataProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CheckProgress(float delta)
|
internal void CheckProgress(float total)
|
||||||
{
|
{
|
||||||
if (!enable) return;
|
if (IsFinish()) return;
|
||||||
|
if (!m_IsInit || m_IsPause || m_IsEnd) return;
|
||||||
if (IsInDelay()) return;
|
if (IsInDelay()) return;
|
||||||
if (m_IsEnd) return;
|
m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay;
|
||||||
if (m_CurrDetailProgress > m_DestDetailProgress)
|
var duration = GetCurrAnimationDuration();
|
||||||
|
var delta = total / duration * Time.deltaTime;
|
||||||
|
if (m_FadeOut)
|
||||||
{
|
{
|
||||||
End();
|
m_CurrDetailProgress -= delta;
|
||||||
|
if (m_CurrDetailProgress <= m_DestDetailProgress)
|
||||||
|
{
|
||||||
|
m_CurrDetailProgress = m_DestDetailProgress;
|
||||||
|
End();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ActualDuration = (int)((Time.time - startTime) * 1000) - delay;
|
|
||||||
m_CurrDetailProgress += delta;
|
m_CurrDetailProgress += delta;
|
||||||
|
if (m_CurrDetailProgress >= m_DestDetailProgress)
|
||||||
|
{
|
||||||
|
m_CurrDetailProgress = m_DestDetailProgress;
|
||||||
|
End();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void CheckSymbol(float delta, float dest)
|
internal float GetCurrAnimationDuration()
|
||||||
{
|
{
|
||||||
m_CurrSymbolProgress += delta;
|
if (m_FadeOut) return m_FadeOutDuration > 0 ? m_FadeOutDuration / 1000 : 1;
|
||||||
if (m_CurrSymbolProgress > dest) m_CurrSymbolProgress = dest;
|
else return m_FadeInDuration > 0 ? m_FadeInDuration / 1000 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal float CheckBarProgress(int dataIndex, float barHig)
|
||||||
|
{
|
||||||
|
//if (!m_IsInit) return barHig;
|
||||||
|
var destHig = m_FadeOut ? barHig : 0;
|
||||||
|
if (IsInDelay() || IsFinish() || m_IsEnd)
|
||||||
|
{
|
||||||
|
return m_FadeOuted ? 0 : barHig;
|
||||||
|
}
|
||||||
|
else if (m_IsPause)
|
||||||
|
{
|
||||||
|
return GetDataState(dataIndex, destHig);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var duration = GetCurrAnimationDuration();
|
||||||
|
var delta = barHig / duration * Time.deltaTime;
|
||||||
|
var currHig = GetDataState(dataIndex, destHig) + (m_FadeOut ? -delta : delta);
|
||||||
|
SetDataState(dataIndex, currHig);
|
||||||
|
if (m_FadeOut)
|
||||||
|
{
|
||||||
|
if (currHig <= 0)
|
||||||
|
{
|
||||||
|
End();
|
||||||
|
currHig = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Mathf.Abs(currHig) >= Mathf.Abs(barHig))
|
||||||
|
{
|
||||||
|
End();
|
||||||
|
currHig = barHig;
|
||||||
|
}
|
||||||
|
return currHig;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void CheckSymbol(float dest)
|
||||||
|
{
|
||||||
|
if (!enable || m_IsEnd || m_IsPause || !m_IsInit) return;
|
||||||
|
if (IsInDelay()) return;
|
||||||
|
var duration = GetCurrAnimationDuration();
|
||||||
|
var delta = dest / duration * Time.deltaTime;
|
||||||
|
if (m_FadeOut)
|
||||||
|
{
|
||||||
|
m_CurrSymbolProgress -= delta;
|
||||||
|
if (m_CurrSymbolProgress < 0) m_CurrSymbolProgress = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_CurrSymbolProgress += delta;
|
||||||
|
if (m_CurrSymbolProgress > dest) m_CurrSymbolProgress = dest;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetSysmbolSize(float dest)
|
public float GetSysmbolSize(float dest)
|
||||||
@@ -212,7 +349,8 @@ namespace XCharts
|
|||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (!Application.isPlaying) return dest;
|
if (!Application.isPlaying) return dest;
|
||||||
#endif
|
#endif
|
||||||
if (!enable || m_IsEnd) return dest;
|
if (!enable) return dest;
|
||||||
|
if (m_IsEnd) return m_FadeOut ? 0 : dest;
|
||||||
return m_CurrSymbolProgress;
|
return m_CurrSymbolProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,8 +384,13 @@ namespace XCharts
|
|||||||
|
|
||||||
public float GetUpdateAnimationDuration()
|
public float GetUpdateAnimationDuration()
|
||||||
{
|
{
|
||||||
if (m_Enable && m_UpdateAnimation && IsFinish()) return m_UpdateDuration;
|
if (m_Enable && m_DataChangeEnable && IsFinish()) return m_DataChangeDuration;
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasFadeOut()
|
||||||
|
{
|
||||||
|
return enable && m_FadeOuted && m_IsEnd;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ namespace XCharts
|
|||||||
serie.center[1] = 0.5f;
|
serie.center[1] = 0.5f;
|
||||||
serie.radius[0] = 80;
|
serie.radius[0] = 80;
|
||||||
serie.splitNumber = 5;
|
serie.splitNumber = 5;
|
||||||
serie.animation.updateAnimation = true;
|
serie.animation.dataChangeEnable = true;
|
||||||
serie.titleStyle.show = true;
|
serie.titleStyle.show = true;
|
||||||
serie.titleStyle.textStyle.offset = new Vector2(0, 20);
|
serie.titleStyle.textStyle.offset = new Vector2(0, 20);
|
||||||
serie.label.show = true;
|
serie.label.show = true;
|
||||||
@@ -85,7 +85,7 @@ namespace XCharts
|
|||||||
for (int i = 0; i < m_Series.Count; i++)
|
for (int i = 0; i < m_Series.Count; i++)
|
||||||
{
|
{
|
||||||
var serie = m_Series.list[i];
|
var serie = m_Series.list[i];
|
||||||
|
|
||||||
var serieLabel = serie.gaugeAxis.axisLabel;
|
var serieLabel = serie.gaugeAxis.axisLabel;
|
||||||
serie.gaugeAxis.ClearLabelObject();
|
serie.gaugeAxis.ClearLabelObject();
|
||||||
var count = serie.splitNumber > 36 ? 36 : (serie.splitNumber + 1);
|
var count = serie.splitNumber > 36 ? 36 : (serie.splitNumber + 1);
|
||||||
@@ -103,7 +103,7 @@ namespace XCharts
|
|||||||
item.SetIconActive(false);
|
item.SetIconActive(false);
|
||||||
serie.gaugeAxis.AddLabelObject(item);
|
serie.gaugeAxis.AddLabelObject(item);
|
||||||
}
|
}
|
||||||
UpdateAxisLabel(serie);
|
UpdateAxisLabel(serie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,11 +130,12 @@ namespace XCharts
|
|||||||
|
|
||||||
private void DrawGauge(VertexHelper vh, Serie serie)
|
private void DrawGauge(VertexHelper vh, Serie serie)
|
||||||
{
|
{
|
||||||
|
|
||||||
serie.UpdateCenter(chartWidth, chartHeight);
|
serie.UpdateCenter(chartWidth, chartHeight);
|
||||||
var destAngle = GetCurrAngle(serie, true);
|
var destAngle = GetCurrAngle(serie, true);
|
||||||
serie.animation.InitProgress(0, serie.startAngle, destAngle);
|
serie.animation.InitProgress(0, serie.startAngle, destAngle);
|
||||||
|
//var currAngle = serie.animation.GetCurrDetail();
|
||||||
var currAngle = serie.animation.IsFinish() ? GetCurrAngle(serie, false) : serie.animation.GetCurrDetail();
|
var currAngle = serie.animation.IsFinish() ? GetCurrAngle(serie, false) : serie.animation.GetCurrDetail();
|
||||||
|
|
||||||
DrawProgressBar(vh, serie, currAngle);
|
DrawProgressBar(vh, serie, currAngle);
|
||||||
DrawStageColor(vh, serie);
|
DrawStageColor(vh, serie);
|
||||||
DrawLineStyle(vh, serie);
|
DrawLineStyle(vh, serie);
|
||||||
@@ -147,9 +148,7 @@ namespace XCharts
|
|||||||
CheckAnimation(serie);
|
CheckAnimation(serie);
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(destAngle - serie.startAngle);
|
||||||
float speed = (destAngle - serie.startAngle) / duration;
|
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
else if (NeedRefresh(serie))
|
else if (NeedRefresh(serie))
|
||||||
@@ -405,6 +404,10 @@ namespace XCharts
|
|||||||
|
|
||||||
private float GetCurrAngle(Serie serie, bool dest)
|
private float GetCurrAngle(Serie serie, bool dest)
|
||||||
{
|
{
|
||||||
|
if (serie.animation.HasFadeOut())
|
||||||
|
{
|
||||||
|
return serie.animation.GetCurrDetail();
|
||||||
|
}
|
||||||
float rangeValue = serie.max - serie.min;
|
float rangeValue = serie.max - serie.min;
|
||||||
float rangeAngle = serie.endAngle - serie.startAngle;
|
float rangeAngle = serie.endAngle - serie.startAngle;
|
||||||
float value = 0;
|
float value = 0;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace XCharts
|
|||||||
[NonSerialized] protected bool m_ReinitLabel = false;
|
[NonSerialized] protected bool m_ReinitLabel = false;
|
||||||
[NonSerialized] protected bool m_ReinitTitle = false;
|
[NonSerialized] protected bool m_ReinitTitle = false;
|
||||||
[NonSerialized] protected bool m_CheckAnimation = false;
|
[NonSerialized] protected bool m_CheckAnimation = false;
|
||||||
[NonSerialized] protected bool m_IsPlayingStartAnimation = false;
|
[NonSerialized] protected bool m_IsPlayingAnimation = false;
|
||||||
[NonSerialized] protected List<string> m_LegendRealShowName = new List<string>();
|
[NonSerialized] protected List<string> m_LegendRealShowName = new List<string>();
|
||||||
|
|
||||||
protected Vector2 chartAnchorMax { get { return rectTransform.anchorMax; } }
|
protected Vector2 chartAnchorMax { get { return rectTransform.anchorMax; } }
|
||||||
@@ -92,8 +92,8 @@ namespace XCharts
|
|||||||
InitSerieLabel();
|
InitSerieLabel();
|
||||||
InitSerieTitle();
|
InitSerieTitle();
|
||||||
InitTooltip();
|
InitTooltip();
|
||||||
m_Series.AnimationStop();
|
m_Series.AnimationReset();
|
||||||
m_Series.AnimationStart();
|
m_Series.AnimationFadeIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Start()
|
protected override void Start()
|
||||||
@@ -569,7 +569,7 @@ namespace XCharts
|
|||||||
if (!m_CheckAnimation)
|
if (!m_CheckAnimation)
|
||||||
{
|
{
|
||||||
m_CheckAnimation = true;
|
m_CheckAnimation = true;
|
||||||
m_Series.AnimationStart();
|
m_Series.AnimationFadeIn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
base.DrawChart(vh);
|
base.DrawChart(vh);
|
||||||
if (!m_CheckMinMaxValue) return;
|
if (!m_CheckMinMaxValue) return;
|
||||||
m_IsPlayingStartAnimation = false;
|
m_IsPlayingAnimation = false;
|
||||||
bool yCategory = m_YAxises[0].IsCategory() || m_YAxises[1].IsCategory();
|
bool yCategory = m_YAxises[0].IsCategory() || m_YAxises[1].IsCategory();
|
||||||
m_Series.GetStackSeries(ref m_StackSeries);
|
m_Series.GetStackSeries(ref m_StackSeries);
|
||||||
int seriesCount = m_StackSeries.Count;
|
int seriesCount = m_StackSeries.Count;
|
||||||
@@ -846,8 +846,8 @@ namespace XCharts
|
|||||||
if (tempMinValue != axis.runtimeMinValue || tempMaxValue != axis.runtimeMaxValue)
|
if (tempMinValue != axis.runtimeMinValue || tempMaxValue != axis.runtimeMaxValue)
|
||||||
{
|
{
|
||||||
m_CheckMinMaxValue = true;
|
m_CheckMinMaxValue = true;
|
||||||
axis.runtimeMinValue = tempMinValue;
|
axis.UpdateMinValue(tempMinValue, !m_IsPlayingAnimation);
|
||||||
axis.runtimeMaxValue = tempMaxValue;
|
axis.UpdateMaxValue(tempMaxValue, !m_IsPlayingAnimation);
|
||||||
axis.runtimeZeroXOffset = 0;
|
axis.runtimeZeroXOffset = 0;
|
||||||
axis.runtimeZeroYOffset = 0;
|
axis.runtimeZeroYOffset = 0;
|
||||||
if (tempMinValue != 0 || tempMaxValue != 0)
|
if (tempMinValue != 0 || tempMaxValue != 0)
|
||||||
@@ -873,7 +873,7 @@ namespace XCharts
|
|||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (axis.IsValueChanging(500) && !m_IsPlayingStartAnimation)
|
if (axis.IsValueChanging(500) && !m_IsPlayingAnimation)
|
||||||
{
|
{
|
||||||
float coordinateWidth = axis is XAxis ? this.coordinateWidth : coordinateHeight;
|
float coordinateWidth = axis is XAxis ? this.coordinateWidth : coordinateHeight;
|
||||||
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
var isPercentStack = m_Series.IsPercentStack(SerieType.Bar);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace XCharts
|
|||||||
protected void DrawYBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
protected void DrawYBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.name)) return;
|
if (!IsActive(serie.name)) return;
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
if (!yAxis.show) yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
|
if (!yAxis.show) yAxis = m_YAxises[(serie.axisIndex + 1) % m_YAxises.Count];
|
||||||
@@ -44,9 +45,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
var isPercentStack = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
|
var isPercentStack = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
|
||||||
bool dataChanging = false;
|
bool dataChanging = false;
|
||||||
float updateDuration = serie.animation.GetUpdateAnimationDuration();
|
float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
float xMinValue = xAxis.GetCurrMinValue(updateDuration);
|
float xMinValue = xAxis.GetCurrMinValue(dataChangeDuration);
|
||||||
float xMaxValue = xAxis.GetCurrMaxValue(updateDuration);
|
float xMaxValue = xAxis.GetCurrMaxValue(dataChangeDuration);
|
||||||
for (int i = serie.minShow; i < maxCount; i++)
|
for (int i = serie.minShow; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (i >= seriesHig.Count)
|
if (i >= seriesHig.Count)
|
||||||
@@ -55,7 +56,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
var serieData = showData[i];
|
var serieData = showData[i];
|
||||||
serieData.canShowLabel = true;
|
serieData.canShowLabel = true;
|
||||||
float value = showData[i].GetCurrData(1, updateDuration);
|
float value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
if (showData[i].IsDataChanged()) dataChanging = true;
|
if (showData[i].IsDataChanged()) dataChanging = true;
|
||||||
float pX = seriesHig[i] + coordinateX + xAxis.runtimeZeroXOffset + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + xAxis.runtimeZeroXOffset + yAxis.axisLine.width;
|
||||||
float pY = coordinateY + +i * categoryWidth;
|
float pY = coordinateY + +i * categoryWidth;
|
||||||
@@ -117,23 +118,11 @@ namespace XCharts
|
|||||||
|
|
||||||
private float CheckAnimation(Serie serie, int dataIndex, float barHig)
|
private float CheckAnimation(Serie serie, int dataIndex, float barHig)
|
||||||
{
|
{
|
||||||
float currHig = barHig;
|
float currHig = serie.animation.CheckBarProgress(dataIndex,barHig);
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
if (serie.animation.IsInDelay()) currHig = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var speed = serie.animation.duration > 0 ? barHig / serie.animation.duration * 1000 : barHig;
|
|
||||||
currHig = serie.animation.GetDataState(dataIndex) + speed * Time.deltaTime;
|
|
||||||
serie.animation.SetDataState(dataIndex, currHig);
|
|
||||||
if (Mathf.Abs(currHig) >= Mathf.Abs(barHig))
|
|
||||||
{
|
|
||||||
serie.animation.End();
|
|
||||||
currHig = barHig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
m_IsPlayingStartAnimation = true;
|
m_IsPlayingAnimation = true;
|
||||||
}
|
}
|
||||||
return currHig;
|
return currHig;
|
||||||
}
|
}
|
||||||
@@ -141,6 +130,7 @@ namespace XCharts
|
|||||||
protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
protected void DrawXBarSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.name)) return;
|
if (!IsActive(serie.name)) return;
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var showData = serie.GetDataList(m_DataZoom);
|
var showData = serie.GetDataList(m_DataZoom);
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
@@ -167,16 +157,16 @@ namespace XCharts
|
|||||||
|
|
||||||
var isPercentStack = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
|
var isPercentStack = m_Series.IsPercentStack(serie.stack, SerieType.Bar);
|
||||||
bool dataChanging = false;
|
bool dataChanging = false;
|
||||||
float updateDuration = serie.animation.GetUpdateAnimationDuration();
|
float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
float yMinValue = yAxis.GetCurrMinValue(updateDuration);
|
float yMinValue = yAxis.GetCurrMinValue(dataChangeDuration);
|
||||||
float yMaxValue = yAxis.GetCurrMaxValue(updateDuration);
|
float yMaxValue = yAxis.GetCurrMaxValue(dataChangeDuration);
|
||||||
for (int i = serie.minShow; i < maxCount; i++)
|
for (int i = serie.minShow; i < maxCount; i++)
|
||||||
{
|
{
|
||||||
if (i >= seriesHig.Count)
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
seriesHig.Add(0);
|
seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = showData[i].GetCurrData(1, updateDuration);
|
float value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
if (showData[i].IsDataChanged()) dataChanging = true;
|
if (showData[i].IsDataChanged()) dataChanging = true;
|
||||||
float pX = coordinateX + i * categoryWidth;
|
float pX = coordinateX + i * categoryWidth;
|
||||||
float zeroY = coordinateY + yAxis.runtimeZeroYOffset;
|
float zeroY = coordinateY + yAxis.runtimeZeroYOffset;
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ namespace XCharts
|
|||||||
|
|
||||||
protected void DrawHeatmapSerie(VertexHelper vh, int colorIndex, Serie serie)
|
protected void DrawHeatmapSerie(VertexHelper vh, int colorIndex, Serie serie)
|
||||||
{
|
{
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
var xCount = xAxis.data.Count;
|
var xCount = xAxis.data.Count;
|
||||||
@@ -135,7 +136,7 @@ namespace XCharts
|
|||||||
serie.dataPoints.Clear();
|
serie.dataPoints.Clear();
|
||||||
serie.animation.InitProgress(1, 0, xCount);
|
serie.animation.InitProgress(1, 0, xCount);
|
||||||
var animationIndex = serie.animation.GetCurrIndex();
|
var animationIndex = serie.animation.GetCurrIndex();
|
||||||
var updateDuration = serie.animation.GetUpdateAnimationDuration();
|
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
for (int i = 0; i < xCount; i++)
|
for (int i = 0; i < xCount; i++)
|
||||||
{
|
{
|
||||||
@@ -146,7 +147,7 @@ namespace XCharts
|
|||||||
var serieData = dataList[dataIndex];
|
var serieData = dataList[dataIndex];
|
||||||
var dimension = m_VisualMap.enable && m_VisualMap.dimension > 0 ? m_VisualMap.dimension - 1 :
|
var dimension = m_VisualMap.enable && m_VisualMap.dimension > 0 ? m_VisualMap.dimension - 1 :
|
||||||
serieData.data.Count - 1;
|
serieData.data.Count - 1;
|
||||||
var value = serieData.GetCurrData(dimension, updateDuration);
|
var value = serieData.GetCurrData(dimension, dataChangeDuration);
|
||||||
if (serieData.IsDataChanged()) dataChanging = true;
|
if (serieData.IsDataChanged()) dataChanging = true;
|
||||||
var pos = new Vector3(zeroX + (i + 0.5f) * xWidth, zeroY + (j + 0.5f) * yWidth);
|
var pos = new Vector3(zeroX + (i + 0.5f) * xWidth, zeroY + (j + 0.5f) * yWidth);
|
||||||
serie.dataPoints.Add(pos);
|
serie.dataPoints.Add(pos);
|
||||||
@@ -183,10 +184,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(xCount);
|
||||||
float speed = xCount / duration;
|
m_IsPlayingAnimation = true;
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
m_IsPlayingStartAnimation = true;
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
if (dataChanging)
|
if (dataChanging)
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ namespace XCharts
|
|||||||
protected void DrawXLineSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
protected void DrawXLineSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.index)) return;
|
if (!IsActive(serie.index)) return;
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var showData = serie.GetDataList(m_DataZoom);
|
var showData = serie.GetDataList(m_DataZoom);
|
||||||
if (showData.Count <= 0) return;
|
if (showData.Count <= 0) return;
|
||||||
Color lineColor = serie.GetLineColor(m_ThemeInfo, colorIndex, false);
|
Color lineColor = serie.GetLineColor(m_ThemeInfo, colorIndex, false);
|
||||||
@@ -114,7 +115,7 @@ namespace XCharts
|
|||||||
var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage :
|
var totalAverage = serie.sampleAverage > 0 ? serie.sampleAverage :
|
||||||
DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
|
DataAverage(ref showData, serie.sampleType, serie.minShow, maxCount, rate);
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
var updateDuration = serie.animation.GetUpdateAnimationDuration();
|
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
for (i = serie.minShow; i < maxCount; i += rate)
|
for (i = serie.minShow; i < maxCount; i += rate)
|
||||||
{
|
{
|
||||||
if (i == maxCount - 1) includeLastData = true;
|
if (i == maxCount - 1) includeLastData = true;
|
||||||
@@ -123,9 +124,9 @@ namespace XCharts
|
|||||||
for (int j = 0; j < rate; j++) seriesHig.Add(0);
|
for (int j = 0; j < rate; j++) seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float yValue = SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage,
|
float yValue = SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage,
|
||||||
i, updateDuration, ref dataChanging);
|
i, dataChangeDuration, ref dataChanging);
|
||||||
seriesHig[i] += GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, seriesHig[i], ref np,
|
seriesHig[i] += GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, seriesHig[i], ref np,
|
||||||
updateDuration);
|
dataChangeDuration);
|
||||||
serie.dataPoints.Add(np);
|
serie.dataPoints.Add(np);
|
||||||
}
|
}
|
||||||
if (dataChanging)
|
if (dataChanging)
|
||||||
@@ -136,9 +137,9 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
i = maxCount - 1;
|
i = maxCount - 1;
|
||||||
seriesHig.Add(0);
|
seriesHig.Add(0);
|
||||||
float yValue = showData[i].GetCurrData(1, updateDuration);
|
float yValue = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
seriesHig[i] += GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, seriesHig[i], ref np,
|
seriesHig[i] += GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, seriesHig[i], ref np,
|
||||||
updateDuration);
|
dataChangeDuration);
|
||||||
serie.dataPoints.Add(np);
|
serie.dataPoints.Add(np);
|
||||||
}
|
}
|
||||||
if (serie.dataPoints.Count <= 0)
|
if (serie.dataPoints.Count <= 0)
|
||||||
@@ -155,8 +156,8 @@ namespace XCharts
|
|||||||
if (serie.minShow > 0 && serie.minShow < showData.Count)
|
if (serie.minShow > 0 && serie.minShow < showData.Count)
|
||||||
{
|
{
|
||||||
i = serie.minShow - 1;
|
i = serie.minShow - 1;
|
||||||
float yValue = showData[i].GetCurrData(1, updateDuration);
|
float yValue = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref firstLastPos, updateDuration);
|
GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref firstLastPos, dataChangeDuration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -165,8 +166,8 @@ namespace XCharts
|
|||||||
if (serie.maxShow > 0 && serie.maxShow < showData.Count)
|
if (serie.maxShow > 0 && serie.maxShow < showData.Count)
|
||||||
{
|
{
|
||||||
i = serie.maxShow;
|
i = serie.maxShow;
|
||||||
float yValue = showData[i].GetCurrData(1, updateDuration);
|
float yValue = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref lastNextPos, updateDuration);
|
GetDataPoint(xAxis, yAxis, showData, yValue, startX, i, scaleWid, 0, ref lastNextPos, dataChangeDuration);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -221,12 +222,9 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(totalDetailProgress);
|
||||||
float speed = totalDetailProgress / duration;
|
serie.animation.CheckSymbol(serie.symbol.size);
|
||||||
float symbolSpeed = serie.symbol.size / duration;
|
m_IsPlayingAnimation = true;
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
serie.animation.CheckSymbol(Time.deltaTime * symbolSpeed, serie.symbol.size);
|
|
||||||
m_IsPlayingStartAnimation = true;
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,12 +245,12 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float SampleValue(ref List<SerieData> showData, SampleType sampleType, int rate,
|
private float SampleValue(ref List<SerieData> showData, SampleType sampleType, int rate,
|
||||||
int minCount, int maxCount, float totalAverage, int index, float updateDuration, ref bool dataChanging)
|
int minCount, int maxCount, float totalAverage, int index, float dataChangeDuration, ref bool dataChanging)
|
||||||
{
|
{
|
||||||
if (rate <= 1 || index == minCount)
|
if (rate <= 1 || index == minCount)
|
||||||
{
|
{
|
||||||
if (showData[index].IsDataChanged()) dataChanging = true;
|
if (showData[index].IsDataChanged()) dataChanging = true;
|
||||||
return showData[index].GetCurrData(1, updateDuration);
|
return showData[index].GetCurrData(1, dataChangeDuration);
|
||||||
}
|
}
|
||||||
switch (sampleType)
|
switch (sampleType)
|
||||||
{
|
{
|
||||||
@@ -261,7 +259,7 @@ namespace XCharts
|
|||||||
float total = 0;
|
float total = 0;
|
||||||
for (int i = index; i > index - rate; i--)
|
for (int i = index; i > index - rate; i--)
|
||||||
{
|
{
|
||||||
total += showData[i].GetCurrData(1, updateDuration);
|
total += showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
if (showData[i].IsDataChanged()) dataChanging = true;
|
if (showData[i].IsDataChanged()) dataChanging = true;
|
||||||
}
|
}
|
||||||
if (sampleType == SampleType.Average) return total / rate;
|
if (sampleType == SampleType.Average) return total / rate;
|
||||||
@@ -270,7 +268,7 @@ namespace XCharts
|
|||||||
float max = float.MinValue;
|
float max = float.MinValue;
|
||||||
for (int i = index; i > index - rate; i--)
|
for (int i = index; i > index - rate; i--)
|
||||||
{
|
{
|
||||||
var value = showData[i].GetCurrData(1, updateDuration);
|
var value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
if (showData[i].IsDataChanged()) dataChanging = true;
|
if (showData[i].IsDataChanged()) dataChanging = true;
|
||||||
}
|
}
|
||||||
@@ -279,7 +277,7 @@ namespace XCharts
|
|||||||
float min = float.MaxValue;
|
float min = float.MaxValue;
|
||||||
for (int i = index; i > index - rate; i--)
|
for (int i = index; i > index - rate; i--)
|
||||||
{
|
{
|
||||||
var value = showData[i].GetCurrData(1, updateDuration);
|
var value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
if (showData[i].IsDataChanged()) dataChanging = true;
|
if (showData[i].IsDataChanged()) dataChanging = true;
|
||||||
}
|
}
|
||||||
@@ -290,7 +288,7 @@ namespace XCharts
|
|||||||
total = 0;
|
total = 0;
|
||||||
for (int i = index; i > index - rate; i--)
|
for (int i = index; i > index - rate; i--)
|
||||||
{
|
{
|
||||||
var value = showData[i].GetCurrData(1, updateDuration);
|
var value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
total += value;
|
total += value;
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
@@ -301,7 +299,7 @@ namespace XCharts
|
|||||||
else return min;
|
else return min;
|
||||||
}
|
}
|
||||||
if (showData[index].IsDataChanged()) dataChanging = true;
|
if (showData[index].IsDataChanged()) dataChanging = true;
|
||||||
return showData[index].GetCurrData(1, updateDuration);
|
return showData[index].GetCurrData(1, dataChangeDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float GetDataPoint(Axis xAxis, Axis yAxis, List<SerieData> showData, float yValue, float startX, int i,
|
private float GetDataPoint(Axis xAxis, Axis yAxis, List<SerieData> showData, float yValue, float startX, int i,
|
||||||
@@ -365,6 +363,7 @@ namespace XCharts
|
|||||||
protected void DrawYLineSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
protected void DrawYLineSerie(VertexHelper vh, Serie serie, int colorIndex, ref List<float> seriesHig)
|
||||||
{
|
{
|
||||||
if (!IsActive(serie.index)) return;
|
if (!IsActive(serie.index)) return;
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var showData = serie.GetDataList(m_DataZoom);
|
var showData = serie.GetDataList(m_DataZoom);
|
||||||
Vector3 lp = Vector3.zero;
|
Vector3 lp = Vector3.zero;
|
||||||
Vector3 np = Vector3.zero;
|
Vector3 np = Vector3.zero;
|
||||||
@@ -399,16 +398,16 @@ namespace XCharts
|
|||||||
if (sampleDist > 0) rate = (int)((maxCount - serie.minShow) / (coordinateWidth / sampleDist));
|
if (sampleDist > 0) rate = (int)((maxCount - serie.minShow) / (coordinateWidth / sampleDist));
|
||||||
if (rate < 1) rate = 1;
|
if (rate < 1) rate = 1;
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
float updateDuration = serie.animation.GetUpdateAnimationDuration();
|
float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
float xMinValue = xAxis.GetCurrMinValue(updateDuration);
|
float xMinValue = xAxis.GetCurrMinValue(dataChangeDuration);
|
||||||
float xMaxValue = xAxis.GetCurrMaxValue(updateDuration);
|
float xMaxValue = xAxis.GetCurrMaxValue(dataChangeDuration);
|
||||||
for (i = serie.minShow; i < maxCount; i += rate)
|
for (i = serie.minShow; i < maxCount; i += rate)
|
||||||
{
|
{
|
||||||
if (i >= seriesHig.Count)
|
if (i >= seriesHig.Count)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < rate; j++) seriesHig.Add(0);
|
for (int j = 0; j < rate; j++) seriesHig.Add(0);
|
||||||
}
|
}
|
||||||
float value = showData[i].GetCurrData(1, updateDuration);
|
float value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
float pY = startY + i * scaleWid;
|
float pY = startY + i * scaleWid;
|
||||||
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
||||||
float dataHig = 0;
|
float dataHig = 0;
|
||||||
@@ -435,7 +434,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
i = maxCount - 1;
|
i = maxCount - 1;
|
||||||
seriesHig.Add(0);
|
seriesHig.Add(0);
|
||||||
float value = showData[i].GetCurrData(1, updateDuration);
|
float value = showData[i].GetCurrData(1, dataChangeDuration);
|
||||||
float pY = startY + i * scaleWid;
|
float pY = startY + i * scaleWid;
|
||||||
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
float pX = seriesHig[i] + coordinateX + yAxis.axisLine.width;
|
||||||
float dataHig = 0;
|
float dataHig = 0;
|
||||||
@@ -517,12 +516,10 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
float total = totalDetailProgress - dataCount * serie.lineStyle.width * 0.5f;
|
||||||
float speed = (totalDetailProgress - dataCount * serie.lineStyle.width * 0.5f) / duration;
|
serie.animation.CheckProgress(total);
|
||||||
float symbolSpeed = serie.symbol.size / duration;
|
serie.animation.CheckSymbol(serie.symbol.size);
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
m_IsPlayingAnimation = true;
|
||||||
serie.animation.CheckSymbol(Time.deltaTime * symbolSpeed, serie.symbol.size);
|
|
||||||
m_IsPlayingStartAnimation = true;
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ namespace XCharts
|
|||||||
{
|
{
|
||||||
protected void DrawScatterSerie(VertexHelper vh, int colorIndex, Serie serie)
|
protected void DrawScatterSerie(VertexHelper vh, int colorIndex, Serie serie)
|
||||||
{
|
{
|
||||||
|
if (serie.animation.HasFadeOut()) return;
|
||||||
var yAxis = m_YAxises[serie.axisIndex];
|
var yAxis = m_YAxises[serie.axisIndex];
|
||||||
var xAxis = m_XAxises[serie.axisIndex];
|
var xAxis = m_XAxises[serie.axisIndex];
|
||||||
var color = serie.symbol.color != Color.clear ? serie.symbol.color : (Color)m_ThemeInfo.GetColor(colorIndex);
|
var color = serie.symbol.color != Color.clear ? serie.symbol.color : (Color)m_ThemeInfo.GetColor(colorIndex);
|
||||||
@@ -23,13 +24,13 @@ namespace XCharts
|
|||||||
: serie.dataCount;
|
: serie.dataCount;
|
||||||
serie.animation.InitProgress(1, 0, 1);
|
serie.animation.InitProgress(1, 0, 1);
|
||||||
var rate = serie.animation.GetCurrRate();
|
var rate = serie.animation.GetCurrRate();
|
||||||
var updateDuration = serie.animation.GetUpdateAnimationDuration();
|
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
for (int n = serie.minShow; n < maxCount; n++)
|
for (int n = serie.minShow; n < maxCount; n++)
|
||||||
{
|
{
|
||||||
var serieData = serie.GetDataList(m_DataZoom)[n];
|
var serieData = serie.GetDataList(m_DataZoom)[n];
|
||||||
float xValue = serieData.GetCurrData(0, updateDuration);
|
float xValue = serieData.GetCurrData(0, dataChangeDuration);
|
||||||
float yValue = serieData.GetCurrData(1, updateDuration);
|
float yValue = serieData.GetCurrData(1, dataChangeDuration);
|
||||||
if (serieData.IsDataChanged()) dataChanging = true;
|
if (serieData.IsDataChanged()) dataChanging = true;
|
||||||
float pX = coordinateX + xAxis.axisLine.width;
|
float pX = coordinateX + xAxis.axisLine.width;
|
||||||
float pY = coordinateY + yAxis.axisLine.width;
|
float pY = coordinateY + yAxis.axisLine.width;
|
||||||
@@ -66,10 +67,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(1);
|
||||||
float speed = 1 / duration;
|
m_IsPlayingAnimation = true;
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
m_IsPlayingStartAnimation = true;
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
if (dataChanging)
|
if (dataChanging)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace XCharts
|
|||||||
serie.index = i;
|
serie.index = i;
|
||||||
var data = serie.data;
|
var data = serie.data;
|
||||||
serie.animation.InitProgress(data.Count, 0, 360);
|
serie.animation.InitProgress(data.Count, 0, 360);
|
||||||
if (!serie.show)
|
if (!serie.show || serie.animation.HasFadeOut())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -77,13 +77,12 @@ namespace XCharts
|
|||||||
sd.canShowLabel = false;
|
sd.canShowLabel = false;
|
||||||
}
|
}
|
||||||
bool dataChanging = false;
|
bool dataChanging = false;
|
||||||
float updateDuration = serie.animation.GetUpdateAnimationDuration();
|
float dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
for (int n = 0; n < data.Count; n++)
|
for (int n = 0; n < data.Count; n++)
|
||||||
{
|
{
|
||||||
if (!serie.animation.NeedAnimation(n)) break;
|
|
||||||
var serieData = data[n];
|
var serieData = data[n];
|
||||||
serieData.index = n;
|
serieData.index = n;
|
||||||
float value = serieData.GetCurrData(1, updateDuration);
|
float value = serieData.GetCurrData(1, dataChangeDuration);
|
||||||
if (serieData.IsDataChanged()) dataChanging = true;
|
if (serieData.IsDataChanged()) dataChanging = true;
|
||||||
serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
|
serieNameCount = m_LegendRealShowName.IndexOf(serieData.legendName);
|
||||||
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
Color color = m_ThemeInfo.GetColor(serieNameCount);
|
||||||
@@ -164,11 +163,8 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(360);
|
||||||
float speed = 360 / duration;
|
serie.animation.CheckSymbol(serie.symbol.size);
|
||||||
float symbolSpeed = serie.symbol.size / duration;
|
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
serie.animation.CheckSymbol(Time.deltaTime * symbolSpeed, serie.symbol.size);
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
if (dataChanging)
|
if (dataChanging)
|
||||||
|
|||||||
@@ -198,13 +198,13 @@ namespace XCharts
|
|||||||
var angle = 2 * Mathf.PI / indicatorNum;
|
var angle = 2 * Mathf.PI / indicatorNum;
|
||||||
Vector3 p = radar.runtimeCenterPos;
|
Vector3 p = radar.runtimeCenterPos;
|
||||||
serie.animation.InitProgress(1, 0, 1);
|
serie.animation.InitProgress(1, 0, 1);
|
||||||
if (!IsActive(i))
|
if (!IsActive(i) || serie.animation.HasFadeOut())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var rate = serie.animation.GetCurrRate();
|
var rate = serie.animation.GetCurrRate();
|
||||||
var dataChanging = false;
|
var dataChanging = false;
|
||||||
var updateDuration = serie.animation.GetUpdateAnimationDuration();
|
var dataChangeDuration = serie.animation.GetUpdateAnimationDuration();
|
||||||
for (int j = 0; j < serie.data.Count; j++)
|
for (int j = 0; j < serie.data.Count; j++)
|
||||||
{
|
{
|
||||||
var serieData = serie.data[j];
|
var serieData = serie.data[j];
|
||||||
@@ -249,7 +249,7 @@ namespace XCharts
|
|||||||
if (n >= serieData.data.Count) break;
|
if (n >= serieData.data.Count) break;
|
||||||
float min = radar.GetIndicatorMin(n);
|
float min = radar.GetIndicatorMin(n);
|
||||||
float max = radar.GetIndicatorMax(n);
|
float max = radar.GetIndicatorMax(n);
|
||||||
float value = serieData.GetCurrData(n, updateDuration);
|
float value = serieData.GetCurrData(n, dataChangeDuration);
|
||||||
if (serieData.IsDataChanged()) dataChanging = true;
|
if (serieData.IsDataChanged()) dataChanging = true;
|
||||||
if (max == 0)
|
if (max == 0)
|
||||||
{
|
{
|
||||||
@@ -304,9 +304,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
if (!serie.animation.IsFinish())
|
if (!serie.animation.IsFinish())
|
||||||
{
|
{
|
||||||
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
|
serie.animation.CheckProgress(1);
|
||||||
float speed = 1 / duration;
|
|
||||||
serie.animation.CheckProgress(Time.deltaTime * speed);
|
|
||||||
RefreshChart();
|
RefreshChart();
|
||||||
}
|
}
|
||||||
if (dataChanging)
|
if (dataChanging)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace XCharts
|
|||||||
public class XChartsMgr : MonoBehaviour
|
public class XChartsMgr : MonoBehaviour
|
||||||
{
|
{
|
||||||
public const string version = "1.2.0";
|
public const string version = "1.2.0";
|
||||||
public const int date = 20200213;
|
public const int date = 20200223;
|
||||||
|
|
||||||
[SerializeField] private string m_NowVersion;
|
[SerializeField] private string m_NowVersion;
|
||||||
[SerializeField] private string m_NewVersion;
|
[SerializeField] private string m_NewVersion;
|
||||||
|
|||||||
177
Assets/XChartsDemo/Runtime/Demo_Animation.cs
Normal file
177
Assets/XChartsDemo/Runtime/Demo_Animation.cs
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
/******************************************/
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) 2018 monitor1394 */
|
||||||
|
/* https://github.com/monitor1394 */
|
||||||
|
/* */
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
using XCharts;
|
||||||
|
|
||||||
|
namespace XChartsDemo
|
||||||
|
{
|
||||||
|
[DisallowMultipleComponent]
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
public class Demo_Animation : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private int m_FadeInDuration = 1000;
|
||||||
|
[SerializeField] private int m_FadeOutDuration = 1000;
|
||||||
|
[SerializeField] private int m_DataChangeDuration = 500;
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
InitCharts();
|
||||||
|
TryInitButton("buttons/btnFadeIn", AnimationFadeIn);
|
||||||
|
TryInitButton("buttons/btnFadeOut", AnimationFadeOut);
|
||||||
|
TryInitButton("buttons/btnDataAdd", AnimationDataAdd);
|
||||||
|
TryInitButton("buttons/btnDataChange", AnimationDataChange);
|
||||||
|
TryInitButton("buttons/btnPause", AnimationPause);
|
||||||
|
TryInitButton("buttons/btnResume", AnimationResume);
|
||||||
|
TryInitButton("buttons/btnReset", AnimationReset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InitCharts()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
foreach (var serie in chart.series.list)
|
||||||
|
{
|
||||||
|
serie.animation.fadeInDuration = m_FadeInDuration;
|
||||||
|
serie.animation.fadeOutDuration = m_FadeOutDuration;
|
||||||
|
serie.animation.dataChangeDuration = m_DataChangeDuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetInputField("settings/fadeIn/InputField", m_FadeInDuration, OnFadeInDurationChanged);
|
||||||
|
SetInputField("settings/fadeOut/InputField", m_FadeOutDuration, OnFadeOutDurationChanged);
|
||||||
|
SetInputField("settings/dataChange/InputField", m_DataChangeDuration, OnDataChangeDurationChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetInputField(string path, int value, UnityAction<string> act)
|
||||||
|
{
|
||||||
|
var input = transform.Find(path).gameObject.GetComponent<InputField>();
|
||||||
|
input.onEndEdit.AddListener(act);
|
||||||
|
input.text = value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
Button TryInitButton(string name, UnityAction act)
|
||||||
|
{
|
||||||
|
var trans = transform.Find(name);
|
||||||
|
if (trans)
|
||||||
|
{
|
||||||
|
var btn = trans.gameObject.GetComponent<Button>();
|
||||||
|
btn.onClick.AddListener(act);
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationFadeIn()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationFadeIn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationFadeOut()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationFadeOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationDataAdd()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationFadeOut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationDataChange()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
var dataCount = chart.series.list[0].dataCount;
|
||||||
|
var index = UnityEngine.Random.Range(0, dataCount);
|
||||||
|
chart.UpdateData(0, index, UnityEngine.Random.Range(1, 100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationPause()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationPause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationResume()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationResume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationReset()
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
chart.AnimationReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnFadeInDurationChanged(string content)
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
m_FadeInDuration = int.Parse(content);
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
foreach (var serie in chart.series.list)
|
||||||
|
{
|
||||||
|
serie.animation.fadeInDuration = m_FadeInDuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnFadeOutDurationChanged(string content)
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
m_FadeOutDuration = int.Parse(content);
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
foreach (var serie in chart.series.list)
|
||||||
|
{
|
||||||
|
serie.animation.fadeOutDuration = m_FadeOutDuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDataChangeDurationChanged(string content)
|
||||||
|
{
|
||||||
|
var charts = transform.GetComponentsInChildren<BaseChart>();
|
||||||
|
m_DataChangeDuration = int.Parse(content);
|
||||||
|
foreach (var chart in charts)
|
||||||
|
{
|
||||||
|
foreach (var serie in chart.series.list)
|
||||||
|
{
|
||||||
|
serie.animation.dataChangeDuration = m_DataChangeDuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/XChartsDemo/Runtime/Demo_Animation.cs.meta
Normal file
11
Assets/XChartsDemo/Runtime/Demo_Animation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 13a697cc1196d43fdb8f329026a721e5
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
84451
Assets/XChartsDemo/xcharts_animation.unity
Normal file
84451
Assets/XChartsDemo/xcharts_animation.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/XChartsDemo/xcharts_animation.unity.meta
Normal file
7
Assets/XChartsDemo/xcharts_animation.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a8890fea0a5384d328f22e9738289cc9
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user