mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-23 17:30:10 +00:00
[feature][formatter] support {d3}
This commit is contained in:
@@ -189,6 +189,7 @@ namespace XCharts.Runtime
|
||||
/// {g}为当前所指示的serie的数据总个数。</br>
|
||||
/// {c0}表示当前数据项维度为0的数据。</br>
|
||||
/// {c1}表示当前数据项维度为1的数据。</br>
|
||||
/// {d3}表示维度3的数据的百分比。它的分母是默认维度(一般是1维度)数据。</br>
|
||||
/// |表示多个列的分隔。<br>
|
||||
/// 示例:"{i}", "{.}|{a}|{c}", "{.}|{b}|{c2:f2}"
|
||||
/// </summary>
|
||||
|
||||
@@ -205,7 +205,9 @@ namespace XCharts.Runtime
|
||||
}
|
||||
else if (p == 'd' || p == 'D')
|
||||
{
|
||||
var rate = total == 0 ? 0 : value / total * 100;
|
||||
var rate = pIndex >= 0 && serieData != null ?
|
||||
(value == 0 ? 0 : serieData.GetData(pIndex) / value * 100) :
|
||||
(total == 0 ? 0 : value / total * 100);
|
||||
content = content.Replace(old, ChartCached.NumberToStr(rate, numericFormatter));
|
||||
}
|
||||
else if (p == 'c' || p == 'C')
|
||||
|
||||
Reference in New Issue
Block a user