mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
优化Tooltip的formatter支持{.1}类型的通配符
This commit is contained in:
@@ -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`,设置最大最小值的取整倍率
|
||||
|
||||
@@ -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`生效时才有效。
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user