[feature][formatter] support {d3}

This commit is contained in:
monitor1394
2022-08-25 13:37:36 +08:00
parent 34dd3d1c4e
commit 9552e877ce
3 changed files with 5 additions and 1 deletions

View File

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