3.0 - guage chart

This commit is contained in:
monitor1394
2022-02-19 17:35:22 +08:00
parent a19b796a02
commit ce5aeb2d98
41 changed files with 266 additions and 337 deletions

View File

@@ -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;
}
}
}