mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
重构VisualMap和DataZoom
This commit is contained in:
@@ -70,6 +70,18 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public Settings settings { get { return m_Settings; } }
|
||||
/// <summary>
|
||||
/// dataZoom component.
|
||||
/// 区域缩放组件。
|
||||
/// </summary>
|
||||
public DataZoom dataZoom { get { return m_DataZooms.Count > 0 ? m_DataZooms[0] : null; } }
|
||||
public List<DataZoom> dataZooms { get { return m_DataZooms; } }
|
||||
/// <summary>
|
||||
/// visualMap component.
|
||||
/// 视觉映射组件。
|
||||
/// </summary>
|
||||
public VisualMap visualMap { get { return m_VisualMaps.Count > 0 ? m_VisualMaps[0] : null; } }
|
||||
public List<VisualMap> visualMaps { get { return m_VisualMaps; } }
|
||||
/// <summary>
|
||||
/// The x of chart.
|
||||
/// 图表的X
|
||||
/// </summary>
|
||||
|
||||
@@ -163,5 +163,16 @@ namespace XCharts
|
||||
ChartHelper.DestroyAllChildren(transform);
|
||||
//SetAllComponentDirty();
|
||||
}
|
||||
|
||||
public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)
|
||||
{
|
||||
var cam = canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.worldCamera;
|
||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||
screenPoint, cam, out chartPoint))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,16 +33,7 @@ namespace XCharts
|
||||
/// 两个y轴。
|
||||
/// </summary>
|
||||
public List<YAxis> yAxes { get { return m_YAxes; } }
|
||||
/// <summary>
|
||||
/// dataZoom component.
|
||||
/// 区域缩放组件。
|
||||
/// </summary>
|
||||
public DataZoom dataZoom { get { return m_DataZooms.Count > 0 ? m_DataZooms[0] : null; } }
|
||||
/// <summary>
|
||||
/// visualMap component.
|
||||
/// 视觉映射组件。
|
||||
/// </summary>
|
||||
public VisualMap visualMap { get { return m_VisualMaps.Count > 0 ? m_VisualMaps[0] : null; } }
|
||||
|
||||
/// <summary>
|
||||
/// X轴(下)
|
||||
/// </summary>
|
||||
@@ -204,7 +195,13 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public void RefreshDataZoom()
|
||||
{
|
||||
RefreshDataZoomLabel();
|
||||
foreach (var handler in m_ComponentHandlers)
|
||||
{
|
||||
if (handler is DataZoomHandler)
|
||||
{
|
||||
(handler as DataZoomHandler).RefreshDataZoomLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user