mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
增加Axis的MinMaxAuto范围类型
This commit is contained in:
@@ -59,7 +59,12 @@ namespace XCharts.Runtime
|
||||
/// Customize the minimum and maximum.
|
||||
/// |自定义最小值最大值。
|
||||
/// </summary>
|
||||
Custom
|
||||
Custom,
|
||||
/// <summary>
|
||||
/// [since("v3.7.0")]minimum - maximum, automatically calculate the appropriate values.
|
||||
/// |[since("v3.7.0")]最小值-最大值。自动计算合适的值。
|
||||
/// </summary>
|
||||
MinMaxAuto,
|
||||
}
|
||||
/// <summary>
|
||||
/// the position of axis in grid.
|
||||
|
||||
@@ -393,7 +393,14 @@ namespace XCharts.Runtime
|
||||
break;
|
||||
|
||||
case Axis.AxisMinMaxType.MinMax:
|
||||
if (ceilRate != 0)
|
||||
{
|
||||
minValue = ChartHelper.GetMinCeilRate(minValue, ceilRate);
|
||||
maxValue = ChartHelper.GetMaxCeilRate(maxValue, ceilRate);
|
||||
}
|
||||
break;
|
||||
|
||||
case Axis.AxisMinMaxType.MinMaxAuto:
|
||||
minValue = needFormat ? ChartHelper.GetMinDivisibleValue(minValue, ceilRate) : minValue;
|
||||
maxValue = needFormat ? ChartHelper.GetMaxDivisibleValue(maxValue, ceilRate) : maxValue;
|
||||
break;
|
||||
|
||||
@@ -692,8 +692,8 @@ namespace XCharts.Runtime
|
||||
intvalue = (int)(max * Mathf.Pow(10, count));
|
||||
}
|
||||
var pow = Mathf.Pow(10, count);
|
||||
var value = (max > 0) ? (int)((max * pow + 1)) / pow :
|
||||
(int)((max * pow - 1)) / pow;
|
||||
var value = max > 0 ? (int)((max * (pow + 1))) / pow :
|
||||
(int)((max * (pow - 1))) / pow;
|
||||
return GetMaxCeilRate(value, ceilRate);
|
||||
}
|
||||
if (ceilRate == 0)
|
||||
@@ -757,8 +757,8 @@ namespace XCharts.Runtime
|
||||
intvalue = (int)(min * Mathf.Pow(10, count));
|
||||
}
|
||||
var pow = Mathf.Pow(10, count);
|
||||
var value = (min > 0) ? (int)((min * pow + 1)) / pow :
|
||||
(int)((min * pow - 1)) / pow;
|
||||
var value = min > 0 ? ((int)(min * (pow - 1))) / pow :
|
||||
((int)(min * (pow + 1))) / pow;
|
||||
return GetMinCeilRate(value, ceilRate);
|
||||
}
|
||||
if (ceilRate == 0)
|
||||
|
||||
Reference in New Issue
Block a user