mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 09:50:15 +00:00
[optimaze][label] icon and emphasis label
This commit is contained in:
@@ -53,7 +53,8 @@
|
|||||||
|
|
||||||
## master
|
## 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.10) 增加`Legend`的`AxisLabel`支持`autoColor`
|
||||||
* (2022.06.08) 修复`Axis`的`AxisLabel`在设置不显示时还显示首尾两个`label`的问题
|
* (2022.06.08) 修复`Axis`的`AxisLabel`在设置不显示时还显示首尾两个`label`的问题
|
||||||
|
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
m_IconImage.sprite = sprite == null ? iconStyle.sprite : sprite;
|
m_IconImage.sprite = sprite == null ? iconStyle.sprite : sprite;
|
||||||
m_IconImage.color = iconStyle.color;
|
m_IconImage.color = iconStyle.color;
|
||||||
|
m_IconImage.type = iconStyle.type;
|
||||||
m_IconRect.sizeDelta = new Vector2(iconStyle.width, iconStyle.height);
|
m_IconRect.sizeDelta = new Vector2(iconStyle.width, iconStyle.height);
|
||||||
m_IconOffest = iconStyle.offset;
|
m_IconOffest = iconStyle.offset;
|
||||||
m_Align = iconStyle.align;
|
m_Align = iconStyle.align;
|
||||||
|
|||||||
@@ -240,13 +240,11 @@ namespace XCharts.Runtime
|
|||||||
if (count == -1) count = serie.dataCount;
|
if (count == -1) count = serie.dataCount;
|
||||||
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
|
||||||
if (serieLabel == null)
|
if (serieLabel == null)
|
||||||
return false;
|
{
|
||||||
|
serieLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
|
||||||
var serieEmphasisLabel = SerieHelper.GetSerieEmphasisLabel(serie, serieData);
|
if (serieLabel == null || !serieLabel.show)
|
||||||
|
return false;
|
||||||
if (!serieLabel.show &&
|
}
|
||||||
(serieEmphasisLabel == null || !serieEmphasisLabel.show))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var dataAutoColor = GetSerieDataAutoColor(serieData);
|
var dataAutoColor = GetSerieDataAutoColor(serieData);
|
||||||
serieData.context.dataLabels.Clear();
|
serieData.context.dataLabels.Clear();
|
||||||
@@ -404,6 +402,7 @@ namespace XCharts.Runtime
|
|||||||
labelObject.SetActive(!isIgnore);
|
labelObject.SetActive(!isIgnore);
|
||||||
labelObject.SetText(content);
|
labelObject.SetText(content);
|
||||||
labelObject.SetPosition(serieData.context.dataPoints[i] + offset);
|
labelObject.SetPosition(serieData.context.dataPoints[i] + offset);
|
||||||
|
labelObject.UpdateIcon(currLabel.icon);
|
||||||
if (currLabel.textStyle.autoColor)
|
if (currLabel.textStyle.autoColor)
|
||||||
{
|
{
|
||||||
var dataAutoColor = GetSerieDataAutoColor(serieData);
|
var dataAutoColor = GetSerieDataAutoColor(serieData);
|
||||||
@@ -422,7 +421,7 @@ namespace XCharts.Runtime
|
|||||||
SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
|
SerieLabelHelper.GetFormatterContent(serie, serieData, value, total,
|
||||||
currLabel, color);
|
currLabel, color);
|
||||||
serieData.SetLabelActive(!isIgnore);
|
serieData.SetLabelActive(!isIgnore);
|
||||||
|
serieData.labelObject.UpdateIcon(currLabel.icon);
|
||||||
serieData.labelObject.SetText(content);
|
serieData.labelObject.SetText(content);
|
||||||
UpdateLabelPosition(serieData, currLabel);
|
UpdateLabelPosition(serieData, currLabel);
|
||||||
if (currLabel.textStyle.autoColor)
|
if (currLabel.textStyle.autoColor)
|
||||||
|
|||||||
Reference in New Issue
Block a user