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

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

View File

@@ -1,6 +1,7 @@
# 更新日志
* (2020.06.04) 优化`Tooltip``formatter`支持`{.1}`通配符
* (2020.06.04) 优化`Legend`数量过多时自动换行显示
* (2020.06.03) 发布`v1.5.1`版本
* (2020.06.02) 增加`Radar``ceilRate`,设置最大最小值的取整倍率

View File

@@ -200,9 +200,10 @@
* `{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}"`
* `titleFormatter`:提示框标题内容的字符串模版格式器。支持用 `\n` 换行。仅当`itemFormatter`生效时才有效。

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')
{