优化Tooltipformatter支持{.1}类型的通配符

This commit is contained in:
monitor1394
2020-06-04 07:22:58 +08:00
parent b0866b3900
commit c18a7b99cb
4 changed files with 13 additions and 7 deletions

View File

@@ -101,9 +101,10 @@ namespace XCharts
/// {b}为数据项名serieData的name或者类目值如折线图的X轴
/// {c}为数值。
/// {d}为百分比值,注意不带%号。
/// {a1}、{b1}、{c1}表示指定index为1的serie{a}默认index为0的serie
/// {.1}表示指定index为1的serie对应颜色的圆点
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie{a}默认index为0的serie。
/// {c1:2}表示索引为1的serie的数据项的第3个数据index为2
/// {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据。
/// {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(一个数据项有多个数据)
/// {d1:2:f2}表示单独指定了数值的格式化字符串为f2不指定时用numericFormatter
/// 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:1f1}"
/// </summary>

View File

@@ -313,11 +313,14 @@ namespace XCharts
}
if (p == '.')
{
if (argsCount == 1)
var bIndex = targetIndex;
if (argsCount >= 2)
{
content = content.Replace(old, ChartCached.ColorToDotStr(themeInfo.GetColor(targetIndex)));
foundDot = true;
var args1Str = args[1].ToString();
if (s_RegexN.IsMatch(args1Str)) bIndex = int.Parse(args1Str);
}
content = content.Replace(old, ChartCached.ColorToDotStr(themeInfo.GetColor(bIndex)));
foundDot = true;
}
else if (p == 'a' || p == 'A')
{