完善SerieSymbol以支持象形柱图PictorialBarChart扩展

This commit is contained in:
monitor1394
2021-07-22 08:11:12 +08:00
parent f452905f7a
commit 16d6a5a3a0
9 changed files with 100 additions and 11 deletions

View File

@@ -163,7 +163,7 @@ namespace XCharts
foreach (var draw in m_ComponentHandlers) draw.Update();
}
internal Painter GetPainter(int index)
public Painter GetPainter(int index)
{
if (index >= 0 && index < m_PainterList.Count)
{

View File

@@ -56,7 +56,7 @@ namespace XCharts
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
protected Vector2 graphPivot { get { return m_GraphPivot; } }
internal HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
public HideFlags chartHideFlags { get { return m_DebugMode ? HideFlags.None : HideFlags.HideInHierarchy; } }
private ScrollRect m_ScrollRect;

View File

@@ -387,7 +387,8 @@ namespace XCharts
return ChartHelper.GetOrAddComponent<Painter>(painterObj);
}
public static Image AddIcon(string name, Transform parent, float width, float height)
public static Image AddIcon(string name, Transform parent, float width, float height, Sprite sprite = null,
Image.Type type = Image.Type.Simple)
{
var anchorMax = new Vector2(0.5f, 0.5f);
var anchorMin = new Vector2(0.5f, 0.5f);
@@ -396,6 +397,15 @@ namespace XCharts
GameObject iconObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
var img = GetOrAddComponent<Image>(iconObj);
img.raycastTarget = false;
img.type = type;
if (sprite != null)
{
img.sprite = sprite;
if (width == 0 || height == 0)
{
img.SetNativeSize();
}
}
return img;
}