mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
修复BarChart的onSerieEnter和onSerieExit回调无效的问题
This commit is contained in:
@@ -71,9 +71,11 @@ slug: /changelog
|
|||||||
|
|
||||||
* 重构和完善动画系统,增加`新增动画`和`交互动画`的支持
|
* 重构和完善动画系统,增加`新增动画`和`交互动画`的支持
|
||||||
* 完善`PieChart`的动画交互表现
|
* 完善`PieChart`的动画交互表现
|
||||||
|
* 增加`Symbol`的`EmptyTriangle`、`EmptyDiamond`、`Plus`、`Minus`四种新标记
|
||||||
|
|
||||||
日志详情:
|
日志详情:
|
||||||
|
|
||||||
|
* (2023.08.02) 修复`BarChart`的`onSerieEnter`和`onSerieExit`回调无效的问题
|
||||||
* (2023.08.02) 增加`Symbol`的`Plus`加号和`Minus`减号的支持
|
* (2023.08.02) 增加`Symbol`的`Plus`加号和`Minus`减号的支持
|
||||||
* (2023.07.31) 增加`Symbol`的`EmptyTriangle`和`EmptyDiamond`的支持,优化`Symbol`表现效果
|
* (2023.07.31) 增加`Symbol`的`EmptyTriangle`和`EmptyDiamond`的支持,优化`Symbol`表现效果
|
||||||
* (2023.07.31) 优化`Line`的默认配置效果
|
* (2023.07.31) 优化`Line`的默认配置效果
|
||||||
|
|||||||
@@ -502,7 +502,9 @@ namespace XCharts.Runtime
|
|||||||
var axis = component as Axis;
|
var axis = component as Axis;
|
||||||
if (axis.gridIndex == gridIndex && axis.IsCategory())
|
if (axis.gridIndex == gridIndex && axis.IsCategory())
|
||||||
{
|
{
|
||||||
dataIndex = axis.context.dataZoomStartIndex + (int)axis.context.pointerValue;
|
dataIndex = double.IsNaN(axis.context.pointerValue)
|
||||||
|
? axis.context.dataZoomStartIndex
|
||||||
|
: axis.context.dataZoomStartIndex + (int)axis.context.pointerValue;
|
||||||
category = axis.GetData(dataIndex);
|
category = axis.GetData(dataIndex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,8 +192,9 @@ namespace XCharts.Runtime
|
|||||||
CheckPainter();
|
CheckPainter();
|
||||||
CheckRefreshChart();
|
CheckRefreshChart();
|
||||||
Internal_CheckAnimation();
|
Internal_CheckAnimation();
|
||||||
foreach (var handler in m_SerieHandlers) handler.Update();
|
foreach (var handler in m_SerieHandlers) handler.BeforeUpdate();
|
||||||
foreach (var handler in m_ComponentHandlers) handler.Update();
|
foreach (var handler in m_ComponentHandlers) handler.Update();
|
||||||
|
foreach (var handler in m_SerieHandlers) handler.Update();
|
||||||
m_DebugInfo.Update();
|
m_DebugInfo.Update();
|
||||||
if (m_OnUpdate != null)
|
if (m_OnUpdate != null)
|
||||||
m_OnUpdate();
|
m_OnUpdate();
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace XCharts.Runtime
|
|||||||
public virtual void InitComponent() { }
|
public virtual void InitComponent() { }
|
||||||
public virtual void RemoveComponent() { }
|
public virtual void RemoveComponent() { }
|
||||||
public virtual void CheckComponent(StringBuilder sb) { }
|
public virtual void CheckComponent(StringBuilder sb) { }
|
||||||
|
public virtual void BeforeUpdate() { }
|
||||||
public virtual void Update() { }
|
public virtual void Update() { }
|
||||||
public virtual void DrawBase(VertexHelper vh) { }
|
public virtual void DrawBase(VertexHelper vh) { }
|
||||||
public virtual void DrawSerie(VertexHelper vh) { }
|
public virtual void DrawSerie(VertexHelper vh) { }
|
||||||
@@ -66,6 +67,8 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
private float[] m_LastRadius = new float[2] { 0, 0 };
|
private float[] m_LastRadius = new float[2] { 0, 0 };
|
||||||
private float[] m_LastCenter = new float[2] { 0, 0 };
|
private float[] m_LastCenter = new float[2] { 0, 0 };
|
||||||
|
private bool m_LastPointerEnter;
|
||||||
|
private int m_LastPointerDataIndex;
|
||||||
|
|
||||||
public T serie { get; internal set; }
|
public T serie { get; internal set; }
|
||||||
public GameObject labelObject { get { return m_SerieLabelRoot; } }
|
public GameObject labelObject { get { return m_SerieLabelRoot; } }
|
||||||
@@ -78,6 +81,12 @@ namespace XCharts.Runtime
|
|||||||
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
AnimationStyleHelper.UpdateSerieAnimation(serie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void BeforeUpdate()
|
||||||
|
{
|
||||||
|
m_LastPointerEnter = serie.context.pointerEnter;
|
||||||
|
m_LastPointerDataIndex = serie.context.pointerItemDataIndex;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
CheckConfigurationChanged();
|
CheckConfigurationChanged();
|
||||||
@@ -163,12 +172,11 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
private void UpdateSerieContextInternal()
|
private void UpdateSerieContextInternal()
|
||||||
{
|
{
|
||||||
var lastEnter = serie.context.pointerEnter;
|
|
||||||
var lastDataIndex = serie.context.pointerItemDataIndex;
|
|
||||||
UpdateSerieContext();
|
UpdateSerieContext();
|
||||||
m_ForceUpdateSerieContext = false;
|
m_ForceUpdateSerieContext = false;
|
||||||
if (lastEnter != serie.context.pointerEnter || lastDataIndex != serie.context.pointerItemDataIndex)
|
if (m_LastPointerEnter != serie.context.pointerEnter || m_LastPointerDataIndex != serie.context.pointerItemDataIndex)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (chart.onSerieEnter != null || chart.onSerieExit != null || serie.onEnter != null || serie.onExit != null)
|
if (chart.onSerieEnter != null || chart.onSerieExit != null || serie.onEnter != null || serie.onExit != null)
|
||||||
{
|
{
|
||||||
var dataIndex = GetPointerItemDataIndex();
|
var dataIndex = GetPointerItemDataIndex();
|
||||||
@@ -182,7 +190,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
data.dataIndex = lastDataIndex;
|
data.dataIndex = m_LastPointerDataIndex;
|
||||||
if (serie.onExit != null) serie.onExit(data);
|
if (serie.onExit != null) serie.onExit(data);
|
||||||
if (chart.onSerieExit != null) chart.onSerieExit(data);
|
if (chart.onSerieExit != null) chart.onSerieExit(data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user