优化AxisMinMax类型范围计算

This commit is contained in:
monitor1394
2023-05-04 23:33:45 +08:00
parent 2d35f77740
commit a9c801c077
4 changed files with 49 additions and 31 deletions

View File

@@ -347,9 +347,13 @@ namespace XCharts.Runtime
public virtual string GetFormatterContent(int labelIndex, double value, double minValue, double maxValue, bool isLog = false)
{
var newNumericFormatter = numericFormatter;
if (string.IsNullOrEmpty(newNumericFormatter) && !isLog)
if (value == 0)
{
newNumericFormatter = MathUtil.IsInteger(maxValue) ? "0" : "f" + MathUtil.GetPrecision(maxValue);
newNumericFormatter = "f0";
}
else if (string.IsNullOrEmpty(newNumericFormatter) && !isLog)
{
newNumericFormatter = MathUtil.IsInteger(maxValue) ? "f0" : "f" + MathUtil.GetPrecision(maxValue);
}
if (string.IsNullOrEmpty(m_Formatter))
{