private void InitMarkLineLabel(Serie serie, MarkLineData data, Color serieColor) { data.painter = chart.m_PainterUpper; data.refreshComponent = delegate() { var textName = string.Format("markLine_{0}_{1}", serie.index, data.index); var content = MarkLineHelper.GetFormatterContent(serie, data); var label = ChartHelper.AddChartLabel(textName, m_MarkLineLabelRoot.transform, data.label, chart.theme.axis, content, Color.clear, TextAnchor.MiddleCenter); label.SetIconActive(false); label.SetActive(data.label.show); label.SetPosition(MarkLineHelper.GetLabelPosition(data)); data.runtimeLabel = label; }; data.refreshComponent(); }
public override void Update() { if (m_RefreshLabel) { m_RefreshLabel = false; var serie = chart.GetSerie(component.serieIndex); if (!serie.show || !component.show) { return; } foreach (var data in component.data) { if (data.runtimeLabel != null) { data.runtimeLabel.SetActive(data.label.show); data.runtimeLabel.SetPosition(MarkLineHelper.GetLabelPosition(data)); data.runtimeLabel.SetText(MarkLineHelper.GetFormatterContent(serie, data)); } } } }