mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
优化Tooltip设置itemFormatter时显示系列颜色
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
* (2020.01.20) 优化`Tooltip`设置`itemFormatter`时显示系列颜色
|
||||||
* (2020.01.20) 增加`Radar`雷达图在`inspector`配置`areaStyle`的支持
|
* (2020.01.20) 增加`Radar`雷达图在`inspector`配置`areaStyle`的支持
|
||||||
* (2020.01.15) 发布`v1.2.0`版本
|
* (2020.01.15) 发布`v1.2.0`版本
|
||||||
* (2020.01.15) 增加`AxisLabel`格式化为整数的支持(`{value:f0}`)
|
* (2020.01.15) 增加`AxisLabel`格式化为整数的支持(`{value:f0}`)
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ namespace XCharts
|
|||||||
return string.IsNullOrEmpty(m_Formatter) && string.IsNullOrEmpty(m_ItemFormatter);
|
return string.IsNullOrEmpty(m_Formatter) && string.IsNullOrEmpty(m_ItemFormatter);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal string GetFormatterContent(int dataIndex, Series series, string category, DataZoom dataZoom = null)
|
internal string GetFormatterContent(int dataIndex, Series series, string category,ThemeInfo themeInfo = null, DataZoom dataZoom = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(m_Formatter))
|
if (string.IsNullOrEmpty(m_Formatter))
|
||||||
{
|
{
|
||||||
@@ -400,6 +400,7 @@ namespace XCharts
|
|||||||
content = content.Replace("{c}", ChartCached.FloatToStr(serieData.GetData(1), 0, m_ForceENotation));
|
content = content.Replace("{c}", ChartCached.FloatToStr(serieData.GetData(1), 0, m_ForceENotation));
|
||||||
content = content.Replace("{d}", ChartCached.FloatToStr(percent, 1));
|
content = content.Replace("{d}", ChartCached.FloatToStr(percent, 1));
|
||||||
if (!first) sb.Append("\n");
|
if (!first) sb.Append("\n");
|
||||||
|
sb.Append("<color=#").Append(themeInfo.GetColorStr(i)).Append(">● </color>");
|
||||||
sb.Append(content);
|
sb.Append(content);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ namespace XCharts
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var category = tempAxis.GetData(index, m_DataZoom);
|
var category = tempAxis.GetData(index, m_DataZoom);
|
||||||
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, category, m_DataZoom));
|
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, category, m_ThemeInfo, m_DataZoom));
|
||||||
}
|
}
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
if (pos.x + m_Tooltip.runtimeWidth > chartWidth)
|
||||||
|
|||||||
@@ -596,7 +596,7 @@ namespace XCharts
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, null));
|
m_Tooltip.UpdateContentText(m_Tooltip.GetFormatterContent(index, m_Series, null, m_ThemeInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = m_Tooltip.GetContentPos();
|
var pos = m_Tooltip.GetContentPos();
|
||||||
|
|||||||
Reference in New Issue
Block a user