mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-29 20:58:47 +00:00
增加Axis可通过设置IconStyle的color为clear来实现动态图标颜色的支持
This commit is contained in:
@@ -76,6 +76,7 @@ slug: /changelog
|
|||||||
|
|
||||||
日志详情:
|
日志详情:
|
||||||
|
|
||||||
|
* (2023.08.09) 增加`Axis`可通过设置`IconStyle`的`color`为`clear`来实现动态图标颜色的支持
|
||||||
* (2023.08.08) 增加`Pie`对`LabelLine`的`lineEndX`的支持
|
* (2023.08.08) 增加`Pie`对`LabelLine`的`lineEndX`的支持
|
||||||
* (2023.08.05) 整理`Examples`的代码,删除不必要的用例
|
* (2023.08.05) 整理`Examples`的代码,删除不必要的用例
|
||||||
* (2023.08.04) 增加`LabelLine`的`lineEndX`可设置引导线固定X位置的支持
|
* (2023.08.04) 增加`LabelLine`的`lineEndX`可设置引导线固定X位置的支持
|
||||||
|
|||||||
@@ -387,7 +387,8 @@ namespace XCharts
|
|||||||
new Vector2(textWidth, textHeight),
|
new Vector2(textWidth, textHeight),
|
||||||
axis, chart.theme.axis, labelName,
|
axis, chart.theme.axis, labelName,
|
||||||
Color.clear,
|
Color.clear,
|
||||||
defaultAlignment);
|
defaultAlignment,
|
||||||
|
chart.theme.GetColor(i));
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
axis.axisLabel.SetRelatedText(label.text, labelWidth);
|
axis.axisLabel.SetRelatedText(label.text, labelWidth);
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace XCharts.Runtime
|
|||||||
if (m_IconRect != null) m_IconRect.sizeDelta = new Vector3(width, height);
|
if (m_IconRect != null) m_IconRect.sizeDelta = new Vector3(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)
|
public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null, Color color = default(Color))
|
||||||
{
|
{
|
||||||
if (m_IconImage == null || iconStyle == null)
|
if (m_IconImage == null || iconStyle == null)
|
||||||
return;
|
return;
|
||||||
@@ -139,7 +139,7 @@ namespace XCharts.Runtime
|
|||||||
if (iconStyle.show)
|
if (iconStyle.show)
|
||||||
{
|
{
|
||||||
m_IconImage.sprite = sprite == null ? iconStyle.sprite : sprite;
|
m_IconImage.sprite = sprite == null ? iconStyle.sprite : sprite;
|
||||||
m_IconImage.color = iconStyle.color;
|
m_IconImage.color = ChartHelper.IsClearColor(iconStyle.color) ? color : iconStyle.color;
|
||||||
m_IconImage.type = iconStyle.type;
|
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;
|
||||||
|
|||||||
@@ -370,12 +370,12 @@ namespace XCharts.Runtime
|
|||||||
|
|
||||||
public static ChartLabel AddAxisLabelObject(int total, int index, string name, Transform parent,
|
public static ChartLabel AddAxisLabelObject(int total, int index, string name, Transform parent,
|
||||||
Vector2 sizeDelta, Axis axis, ComponentTheme theme,
|
Vector2 sizeDelta, Axis axis, ComponentTheme theme,
|
||||||
string content, Color autoColor, TextAnchor autoAlignment = TextAnchor.MiddleCenter)
|
string content, Color autoColor, TextAnchor autoAlignment = TextAnchor.MiddleCenter, Color32 iconDefaultColor = default(Color32))
|
||||||
{
|
{
|
||||||
var textStyle = axis.axisLabel.textStyle;
|
var textStyle = axis.axisLabel.textStyle;
|
||||||
var label = AddChartLabel(name, parent, axis.axisLabel, theme, content, autoColor, autoAlignment);
|
var label = AddChartLabel(name, parent, axis.axisLabel, theme, content, autoColor, autoAlignment);
|
||||||
var labelShow = axis.IsNeedShowLabel(index, total);
|
var labelShow = axis.IsNeedShowLabel(index, total);
|
||||||
label.UpdateIcon(axis.axisLabel.icon, axis.GetIcon(index));
|
label.UpdateIcon(axis.axisLabel.icon, axis.GetIcon(index), iconDefaultColor);
|
||||||
label.text.SetActive(labelShow);
|
label.text.SetActive(labelShow);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user