mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
完善SerieSymbol以支持象形柱图PictorialBarChart扩展
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2021.07.22) Improved `SerieSymbol` to support `PictorialBarchart` extension
|
||||||
* (2021.07.19) Fixed issue where `Tooltip` was not displayed on `WdbGL` platform
|
* (2021.07.19) Fixed issue where `Tooltip` was not displayed on `WdbGL` platform
|
||||||
* (2021.07.18) Added `iconStyle` for serie
|
* (2021.07.18) Added `iconStyle` for serie
|
||||||
* (2021.07.15) Added `MarkLine` (#142)
|
* (2021.07.15) Added `MarkLine` (#142)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2021.07.22) 完善`SerieSymbol`以支持象形柱图`PictorialBarChart`扩展
|
||||||
* (2021.07.19) 修复`WdbGL`平台上`Tooltip`不显示的问题
|
* (2021.07.19) 修复`WdbGL`平台上`Tooltip`不显示的问题
|
||||||
* (2021.07.18) 增加`Serie`的`iconStyle`统一配置图标
|
* (2021.07.18) 增加`Serie`的`iconStyle`统一配置图标
|
||||||
* (2021.07.15) 增加`MarkLine`标线 (#142)
|
* (2021.07.15) 增加`MarkLine`标线 (#142)
|
||||||
|
|||||||
@@ -21,19 +21,28 @@ namespace XCharts
|
|||||||
if (MakeFoldout(prop, "m_Show"))
|
if (MakeFoldout(prop, "m_Show"))
|
||||||
{
|
{
|
||||||
++EditorGUI.indentLevel;
|
++EditorGUI.indentLevel;
|
||||||
|
var type = (SerieSymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
|
||||||
PropertyField(prop, "m_Type");
|
PropertyField(prop, "m_Type");
|
||||||
|
if (type == SerieSymbolType.Custom)
|
||||||
|
{
|
||||||
|
PropertyField(prop, "m_Image");
|
||||||
|
PropertyField(prop, "m_ImageType");
|
||||||
|
PropertyField(prop, "m_Width");
|
||||||
|
// PropertyField(prop, "m_Height");
|
||||||
|
// PropertyField(prop, "m_Offset");
|
||||||
|
}
|
||||||
PropertyField(prop, "m_Gap");
|
PropertyField(prop, "m_Gap");
|
||||||
PropertyField(prop, "m_SizeType");
|
PropertyField(prop, "m_SizeType");
|
||||||
switch ((SerieSymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
switch ((SerieSymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
|
||||||
{
|
{
|
||||||
case SerieSymbolSizeType.Custom:
|
case SerieSymbolSizeType.Custom:
|
||||||
PropertyField(prop, "m_Size");
|
PropertyField(prop, "m_Size");
|
||||||
PropertyField(prop, "m_SelectedSize");
|
PropertyField(prop, "m_SelectedSize");
|
||||||
break;
|
break;
|
||||||
case SerieSymbolSizeType.FromData:
|
case SerieSymbolSizeType.FromData:
|
||||||
PropertyField(prop, "m_DataIndex");
|
PropertyField(prop, "m_DataIndex");
|
||||||
PropertyField(prop, "m_DataScale");
|
PropertyField(prop, "m_DataScale");
|
||||||
PropertyField(prop, "m_SelectedDataScale");
|
PropertyField(prop, "m_SelectedDataScale");
|
||||||
break;
|
break;
|
||||||
case SerieSymbolSizeType.Callback:
|
case SerieSymbolSizeType.Callback:
|
||||||
break;
|
break;
|
||||||
@@ -41,6 +50,7 @@ namespace XCharts
|
|||||||
PropertyField(prop, "m_StartIndex");
|
PropertyField(prop, "m_StartIndex");
|
||||||
PropertyField(prop, "m_Interval");
|
PropertyField(prop, "m_Interval");
|
||||||
PropertyField(prop, "m_ForceShowLast");
|
PropertyField(prop, "m_ForceShowLast");
|
||||||
|
PropertyField(prop, "m_Repeat");
|
||||||
--EditorGUI.indentLevel;
|
--EditorGUI.indentLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ namespace XCharts
|
|||||||
|
|
||||||
public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)
|
public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)
|
||||||
{
|
{
|
||||||
#if UNITY_STANDALONE
|
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
|
||||||
screenPoint = Display.RelativeMouseAt(screenPoint);
|
var relative = Display.RelativeMouseAt(screenPoint);
|
||||||
|
if(relative != Vector3.zero)
|
||||||
|
screenPoint = relative;
|
||||||
#endif
|
#endif
|
||||||
var cam = canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.worldCamera;
|
var cam = canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : canvas.worldCamera;
|
||||||
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -176,6 +177,7 @@ namespace XCharts
|
|||||||
public float runtimeAngle { get; set; }
|
public float runtimeAngle { get; set; }
|
||||||
public Vector3 runtiemPieOffsetCenter { get; set; }
|
public Vector3 runtiemPieOffsetCenter { get; set; }
|
||||||
public float runtimeStackHig { get; set; }
|
public float runtimeStackHig { get; set; }
|
||||||
|
public Image runtimeSymbol { get; set; }
|
||||||
private List<double> m_PreviousData = new List<double>();
|
private List<double> m_PreviousData = new List<double>();
|
||||||
private List<float> m_DataUpdateTime = new List<float>();
|
private List<float> m_DataUpdateTime = new List<float>();
|
||||||
private List<bool> m_DataUpdateFlag = new List<bool>();
|
private List<bool> m_DataUpdateFlag = new List<bool>();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace XCharts
|
namespace XCharts
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,11 @@ namespace XCharts
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箭头。
|
/// 箭头。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Arrow
|
Arrow,
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义标记。
|
||||||
|
/// </summary>
|
||||||
|
Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -96,6 +101,12 @@ namespace XCharts
|
|||||||
[SerializeField] private int m_Interval;
|
[SerializeField] private int m_Interval;
|
||||||
[SerializeField] private bool m_ForceShowLast = false;
|
[SerializeField] private bool m_ForceShowLast = false;
|
||||||
[SerializeField] private float m_Gap = 0;
|
[SerializeField] private float m_Gap = 0;
|
||||||
|
[SerializeField] private float m_Width = 0f;
|
||||||
|
[SerializeField] private float m_Height = 0f;
|
||||||
|
[SerializeField] private bool m_Repeat = false;
|
||||||
|
[SerializeField] private Vector2 m_Offset = Vector2.zero;
|
||||||
|
[SerializeField] private Sprite m_Image;
|
||||||
|
[SerializeField] private Image.Type m_ImageType;
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
@@ -113,6 +124,12 @@ namespace XCharts
|
|||||||
m_Interval = 0;
|
m_Interval = 0;
|
||||||
m_ForceShowLast = false;
|
m_ForceShowLast = false;
|
||||||
m_Gap = 0;
|
m_Gap = 0;
|
||||||
|
m_Width = 0f;
|
||||||
|
m_Height = 0f;
|
||||||
|
m_Repeat = false;
|
||||||
|
m_Offset = Vector2.zero;
|
||||||
|
m_Image = null;
|
||||||
|
m_ImageType = Image.Type.Simple;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -241,6 +258,52 @@ namespace XCharts
|
|||||||
get { return m_Gap; }
|
get { return m_Gap; }
|
||||||
set { if (PropertyUtil.SetStruct(ref m_Gap, value)) SetVerticesDirty(); }
|
set { if (PropertyUtil.SetStruct(ref m_Gap, value)) SetVerticesDirty(); }
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 图形的宽。
|
||||||
|
/// </summary>
|
||||||
|
public float width
|
||||||
|
{
|
||||||
|
get { return m_Width; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Width, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 图形的高。
|
||||||
|
/// </summary>
|
||||||
|
public float height
|
||||||
|
{
|
||||||
|
get { return m_Height; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Height, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 图形是否重复。
|
||||||
|
/// </summary>
|
||||||
|
public bool repeat
|
||||||
|
{
|
||||||
|
get { return m_Repeat; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Repeat, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义的标记图形。
|
||||||
|
/// </summary>
|
||||||
|
public Sprite image
|
||||||
|
{
|
||||||
|
get { return m_Image; }
|
||||||
|
set { if (PropertyUtil.SetClass(ref m_Image, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
public Image.Type imageType
|
||||||
|
{
|
||||||
|
get { return m_ImageType; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_ImageType, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 图形的偏移。
|
||||||
|
/// </summary>
|
||||||
|
public Vector2 offset
|
||||||
|
{
|
||||||
|
get { return m_Offset; }
|
||||||
|
set { if (PropertyUtil.SetStruct(ref m_Offset, value)) SetAllDirty(); }
|
||||||
|
}
|
||||||
|
public Vector3 offset3 { get { return new Vector3(m_Offset.x, m_Offset.y, 0); } }
|
||||||
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
|
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the setting for effect scatter.
|
/// the setting for effect scatter.
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace XCharts
|
|||||||
foreach (var draw in m_ComponentHandlers) draw.Update();
|
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)
|
if (index >= 0 && index < m_PainterList.Count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace XCharts
|
|||||||
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
|
protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } }
|
||||||
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
|
protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } }
|
||||||
protected Vector2 graphPivot { get { return m_GraphPivot; } }
|
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;
|
private ScrollRect m_ScrollRect;
|
||||||
|
|
||||||
|
|||||||
@@ -387,7 +387,8 @@ namespace XCharts
|
|||||||
return ChartHelper.GetOrAddComponent<Painter>(painterObj);
|
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 anchorMax = new Vector2(0.5f, 0.5f);
|
||||||
var anchorMin = 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);
|
GameObject iconObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||||
var img = GetOrAddComponent<Image>(iconObj);
|
var img = GetOrAddComponent<Image>(iconObj);
|
||||||
img.raycastTarget = false;
|
img.raycastTarget = false;
|
||||||
|
img.type = type;
|
||||||
|
if (sprite != null)
|
||||||
|
{
|
||||||
|
img.sprite = sprite;
|
||||||
|
if (width == 0 || height == 0)
|
||||||
|
{
|
||||||
|
img.SetNativeSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user