mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
3.0 - guage chart
This commit is contained in:
@@ -86,6 +86,10 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public Action<VertexHelper> onCustomDrawTop { set { m_OnCustomDrawTopCallback = value; } }
|
||||
/// <summary>
|
||||
/// 自定义仪表盘指针绘制回调。参数:SerieIndex,SerieDataIndex,currAngle
|
||||
/// </summary>
|
||||
public Action<VertexHelper, int, int, float> onCustomDrawGagugePointer { set { m_OnCustomDrawGagugePointerCallback = value; } get { return m_OnCustomDrawGagugePointerCallback; } }
|
||||
/// <summary>
|
||||
/// the callback function of click pie area.
|
||||
/// 点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex
|
||||
/// </summary>
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace XCharts
|
||||
protected Action<VertexHelper> m_OnCustomDrawTopCallback;
|
||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieBeforeCallback;
|
||||
protected Action<VertexHelper, Serie> m_OnCustomDrawSerieAfterCallback;
|
||||
protected Action<VertexHelper, int, int, float> m_OnCustomDrawGagugePointerCallback;
|
||||
protected Action<PointerEventData, int, int> m_OnPointerClickPie;
|
||||
protected Action<PointerEventData, int> m_OnPointerClickBar;
|
||||
protected Action<Axis, double> m_OnUpdateAxisPointer;
|
||||
|
||||
@@ -188,8 +188,10 @@ namespace XCharts
|
||||
m_LabelRect.sizeDelta = newSize;
|
||||
if (m_LabelBackgroundRect != null)
|
||||
m_LabelBackgroundRect.sizeDelta = newSize;
|
||||
|
||||
if (!isIconActive && m_ObjectRect != null)
|
||||
m_ObjectRect.sizeDelta = newSize;
|
||||
AdjustIconPos();
|
||||
|
||||
}
|
||||
return sizeChange;
|
||||
}
|
||||
|
||||
@@ -415,6 +415,21 @@ namespace XCharts
|
||||
return label;
|
||||
}
|
||||
|
||||
public static ChartLabel AddDefaultChartLabel(string name, Transform parent,
|
||||
Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta, TextStyle textStyle, ComponentTheme theme,
|
||||
string content)
|
||||
{
|
||||
var labelObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta);
|
||||
var label = GetOrAddComponent<ChartLabel>(labelObj);
|
||||
label.label = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme);
|
||||
label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, 0, 0);
|
||||
label.SetAutoSize(true);
|
||||
label.label.SetActive(true);
|
||||
label.SetText(content);
|
||||
label.color = textStyle.color;
|
||||
return label;
|
||||
}
|
||||
|
||||
internal static GameObject AddSerieLabel(string name, Transform parent, float width, float height,
|
||||
Color color, TextStyle textStyle, ThemeStyle theme)
|
||||
{
|
||||
@@ -906,5 +921,11 @@ namespace XCharts
|
||||
{
|
||||
return !ChartHelper.IsClearColor(color) && color.a == 0;
|
||||
}
|
||||
|
||||
public static float GetActualValue(float valueOrRate, float total)
|
||||
{
|
||||
if (valueOrRate >= -1.5f && valueOrRate <= 1.5f) return valueOrRate * total;
|
||||
else return valueOrRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user