Esempio n. 1
0
 private void InitMarkLineLabel(Serie serie, MarkLineData data, Color serieColor)
 {
     data.painter          = chart.m_PainterTop;
     data.refreshComponent = delegate()
     {
         var label    = data.label;
         var textName = string.Format("markLine_{0}_{1}", serie.index, data.index);
         var color    = !ChartHelper.IsClearColor(label.textStyle.color) ? label.textStyle.color : chart.theme.axis.textColor;
         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 item       = new ChartLabel();
         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));
         data.runtimeLabel = item;
     };
     data.refreshComponent();
 }
Esempio n. 2
0
 public void Update()
 {
     if (m_RefreshLabel)
     {
         m_RefreshLabel = false;
         foreach (var serie in chart.series.list)
         {
             if (!serie.show || !serie.markLine.show)
             {
                 continue;
             }
             foreach (var data in serie.markLine.data)
             {
                 if (data.runtimeLabel != null)
                 {
                     data.runtimeLabel.SetPosition(MarkLineHelper.GetLabelPosition(data));
                     data.runtimeLabel.SetText(MarkLineHelper.GetFormatterContent(serie, data));
                 }
             }
         }
     }
 }