mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
[feature][formatter] support {d3}
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2022.08.25) 增加`formatter`对`{d3}`指定维度数据百分比的支持
|
||||
* (2022.08.24) 修复`ScatterChart`的`label`不刷新的问题
|
||||
* (2022.08.24) 修复`MarkLine`的`label`某些情况下显示异常的问题
|
||||
|
||||
|
||||
@@ -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