mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
[optimaze][label] icon and emphasis label
This commit is contained in:
@@ -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`的问题
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user