[optimaze][label] icon and emphasis label

This commit is contained in:
monitor1394
2022-06-14 07:28:24 +08:00
parent e8c46b676f
commit c24d89c8ab
3 changed files with 10 additions and 9 deletions

View File

@@ -53,7 +53,8 @@
## master
* (2022.06.14) 优化`Background`,参数`hideThemeBackgroundColor`重命名为`autoColor`
* (2022.06.14) 优化`SerieLabelStyle`,支持动态调整`Icon`
* (2022.06.13) 优化`Background`,参数`hideThemeBackgroundColor`重命名为`autoColor`
* (2022.06.10) 增加`Legend``AxisLabel`支持`autoColor`
* (2022.06.08) 修复`Axis``AxisLabel`在设置不显示时还显示首尾两个`label`的问题

View File

@@ -137,6 +137,7 @@ namespace XCharts.Runtime
{
m_IconImage.sprite = sprite == null ? iconStyle.sprite : sprite;
m_IconImage.color = iconStyle.color;
m_IconImage.type = iconStyle.type;
m_IconRect.sizeDelta = new Vector2(iconStyle.width, iconStyle.height);
m_IconOffest = iconStyle.offset;
m_Align = iconStyle.align;

View File

@@ -240,13 +240,11 @@ namespace XCharts.Runtime
if (count == -1) count = serie.dataCount;
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
if (serieLabel == null)
return false;
var serieEmphasisLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
if (!serieLabel.show &&
(serieEmphasisLabel == null || !serieEmphasisLabel.show))
return false;
{
serieLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
if (serieLabel == null || !serieLabel.show)
return false;
}
var dataAutoColor = GetSerieDataAutoColor(serieData);
serieData.context.dataLabels.Clear();
@@ -404,6 +402,7 @@ namespace XCharts.Runtime
labelObject.SetActive(!isIgnore);
labelObject.SetText(content);
labelObject.SetPosition(serieData.context.dataPoints[i] + offset);
labelObject.UpdateIcon(currLabel.icon);
if (currLabel.textStyle.autoColor)
{
var dataAutoColor = GetSerieDataAutoColor(serieData);
@@ -422,7 +421,7 @@ namespace XCharts.Runtime
SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
currLabel, color);
serieData.SetLabelActive(!isIgnore);
serieData.labelObject.UpdateIcon(currLabel.icon);
serieData.labelObject.SetText(content);
UpdateLabelPosition(serieData, currLabel);
if (currLabel.textStyle.autoColor)