private void InitAxisLabel() { var labelObject = ChartHelper.AddObject(s_AxisLabelObjectName, transform, m_ChartMinAnchor, m_ChartMaxAnchor, m_ChartPivot, m_ChartSizeDelta); SerieLabelPool.ReleaseAll(labelObject.transform); for (int i = 0; i < m_Series.Count; i++) { var serie = m_Series.list[i]; var serieLabel = serie.gaugeAxis.axisLabel; var count = serie.splitNumber > 36 ? 36 : (serie.splitNumber + 1); var startAngle = serie.startAngle; serie.gaugeAxis.ClearLabelObject(); SerieHelper.UpdateCenter(serie, chartPosition, chartWidth, chartHeight); for (int j = 0; j < count; j++) { var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, i, j); var color = Color.grey; var labelObj = SerieLabelPool.Get(textName, labelObject.transform, serieLabel, m_ThemeInfo.font, color, 100, 100); var iconImage = labelObj.transform.Find("Icon").GetComponent <Image>(); var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0; var item = new LabelObject(); item.SetLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom); item.SetIcon(iconImage); item.SetIconActive(false); serie.gaugeAxis.AddLabelObject(item); } UpdateAxisLabel(serie); } }
protected void AddSerieLabel(Serie serie, SerieData serieData, int count = -1) { if (m_SerieLabelRoot == null) { return; } if (count == -1) { count = serie.dataCount; } var serieLabel = SerieHelper.GetSerieLabel(serie, serieData); if (serie.IsPerformanceMode()) { return; } if (!serieLabel.show) { return; } var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index); var color = Color.grey; if (serie.type == SerieType.Pie) { color = (serieLabel.position == SerieLabel.Position.Inside) ? Color.white : (Color)m_ThemeInfo.GetColor(count); } else { color = !ChartHelper.IsClearColor(serieLabel.color) ? serieLabel.color : (Color)m_ThemeInfo.GetColor(serie.index); } var labelObj = SerieLabelPool.Get(textName, m_SerieLabelRoot.transform, serieLabel, m_ThemeInfo.font, color, serieData.iconStyle.width, serieData.iconStyle.height); var iconImage = labelObj.transform.Find("Icon").GetComponent <Image>(); var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0; var item = new LabelObject(); item.SetLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom); item.SetIcon(iconImage); item.SetIconActive(false); serieData.labelObject = item; }