mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
add delegate callback function for legend
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
|
||||
## branch-2.0
|
||||
|
||||
* (2022.05.03) Added `onLegendClick`, `onLegendEnter` and `onLegendExit` delegate callbacks for `Legend`
|
||||
* (2022.04.21) Fixed bug #192 with `RingChart` `Tooltip` exception
|
||||
* (2022.04.21) Fixed error when setting `minShowNum` in `DataZoom`
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
## branch-2.0
|
||||
|
||||
* (2022.05.03) 增加`Legend`的`onLegendClick`,`onLegendEnter`和`onLegendExit`委托回调
|
||||
* (2022.04.21) 修复`RingChart`的`Tooltip`异常的问题 #192
|
||||
* (2022.04.21) 修复`DataZoom`设置`minShowNum`时可能会报错的问题
|
||||
|
||||
|
||||
@@ -132,7 +132,21 @@ namespace XCharts
|
||||
/// 点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex
|
||||
/// </summary>
|
||||
public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } }
|
||||
|
||||
/// <summary>
|
||||
/// the callback function of click legend.
|
||||
/// 点击图例按钮回调。参数:legendIndex, legendName, show
|
||||
/// </summary>
|
||||
public Action<int, string, bool> onLegendClick { set { m_OnLegendClick = value; } }
|
||||
/// <summary>
|
||||
/// the callback function of enter legend.
|
||||
/// 鼠标进入图例回调。参数:legendIndex, legendName
|
||||
/// </summary>
|
||||
public Action<int, string> onLegendEnter { set { m_OnLegendEnter = value; } }
|
||||
/// <summary>
|
||||
/// the callback function of exit legend.
|
||||
/// 鼠标退出图例回调。参数:legendIndex, legendName
|
||||
/// </summary>
|
||||
public Action<int, string> onLegendExit { set { m_OnLegendExit = value; } }
|
||||
/// <summary>
|
||||
/// Redraw chart in next frame.
|
||||
/// 在下一帧刷新图表。
|
||||
|
||||
@@ -74,6 +74,9 @@ namespace XCharts
|
||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieBeforeCallback;
|
||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieAfterCallback;
|
||||
protected Action<PointerEventData, int, int> m_OnPointerClickPie;
|
||||
protected Action<int, string, bool> m_OnLegendClick;
|
||||
protected Action<int, string> m_OnLegendEnter;
|
||||
protected Action<int, string> m_OnLegendExit;
|
||||
|
||||
protected bool m_RefreshLabel = false;
|
||||
internal bool m_ReinitLabel = false;
|
||||
@@ -847,6 +850,8 @@ namespace XCharts
|
||||
}
|
||||
OnYMaxValueChanged();
|
||||
}
|
||||
if(m_OnLegendClick != null)
|
||||
m_OnLegendClick(index, legendName, show);
|
||||
}
|
||||
|
||||
protected virtual void OnLegendButtonEnter(int index, string legendName)
|
||||
@@ -862,6 +867,8 @@ namespace XCharts
|
||||
RefreshPainter(serie);
|
||||
}
|
||||
}
|
||||
if(m_OnLegendEnter != null)
|
||||
m_OnLegendEnter(index, legendName);
|
||||
}
|
||||
|
||||
protected virtual void OnLegendButtonExit(int index, string legendName)
|
||||
@@ -877,6 +884,8 @@ namespace XCharts
|
||||
RefreshPainter(serie);
|
||||
}
|
||||
}
|
||||
if(m_OnLegendExit != null)
|
||||
m_OnLegendExit(index, legendName);
|
||||
}
|
||||
|
||||
protected virtual void UpdateTooltip()
|
||||
|
||||
Reference in New Issue
Block a user