This commit is contained in:
monitor1394
2022-03-29 22:06:10 +08:00
parent b784900fda
commit 1ad87920d0
17 changed files with 130 additions and 117 deletions

View File

@@ -78,12 +78,14 @@ namespace XCharts.Runtime
var element = ChartHelper.AddSerieLabel(textName, m_MarkLineLabelRoot.transform, label.backgroundWidth,
label.backgroundHeight, color, label.textStyle, chart.theme);
var isAutoSize = label.backgroundWidth == 0 || label.backgroundHeight == 0;
var backgroundColor = label.textStyle.GetBackgroundColor(chart.GetChartBackgroundColor());
var item = ChartHelper.GetOrAddComponent<ChartLabel>(element);
item.SetLabel(element, isAutoSize, label.paddingLeftRight, label.paddingTopBottom);
item.SetIconActive(false);
item.SetActive(data.label.show);
item.SetPosition(MarkLineHelper.GetLabelPosition(data));
item.SetText(MarkLineHelper.GetFormatterContent(serie, data));
item.color = backgroundColor;
data.runtimeLabel = item;
};
data.refreshComponent();