增加TooltiptitleFormatter支持配置占位符{i}表示忽略不显示标题

This commit is contained in:
monitor1394
2020-06-11 07:44:11 +08:00
parent e8bbd2f801
commit 16b9c0aaed
4 changed files with 5 additions and 3 deletions

View File

@@ -111,7 +111,7 @@ namespace XCharts
/// </summary>
public string formatter { get { return m_Formatter; } set { m_Formatter = value; } }
/// <summary>
/// 提示框标题内容的字符串模版格式器。支持用 \n 换行。仅当itemFormatter生效时才有效。
/// 提示框标题内容的字符串模版格式器。支持用 \n 换行。仅当itemFormatter生效时才有效。可以单独设置占位符{i}表示忽略不显示title。
/// </summary>
public string titleFormatter { get { return m_TitleFormatter; } set { m_TitleFormatter = value; } }
/// <summary>

View File

@@ -236,7 +236,8 @@ namespace XCharts
needCategory = needCategory || (serie.type == SerieType.Line || serie.type == SerieType.Bar);
if (formatTitle)
{
FormatterHelper.ReplaceContent(ref title, dataIndex, tooltip.numericFormatter, null, series, themeInfo, category, dataZoom);
if (title.Equals("{i}")) title = string.Empty;
else FormatterHelper.ReplaceContent(ref title, dataIndex, tooltip.numericFormatter, null, series, themeInfo, category, dataZoom);
}
if (serie.show)
{