mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
优化Log对数轴
This commit is contained in:
@@ -828,6 +828,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public double GetLogMinIndex()
|
||||
{
|
||||
if (context.minValue <= 0 || context.minValue == 1)
|
||||
return 0;
|
||||
return logBaseE ?
|
||||
Math.Log(context.minValue) :
|
||||
Math.Log(context.minValue, logBase);
|
||||
@@ -835,6 +837,8 @@ namespace XCharts.Runtime
|
||||
|
||||
public double GetLogMaxIndex()
|
||||
{
|
||||
if (context.maxValue <= 0 || context.maxValue == 1)
|
||||
return 0;
|
||||
return logBaseE ?
|
||||
Math.Log(context.maxValue) :
|
||||
Math.Log(context.maxValue, logBase);
|
||||
|
||||
@@ -344,7 +344,8 @@ namespace XCharts.Runtime
|
||||
int maxSplit = 0;
|
||||
maxValue = ChartHelper.GetMaxLogValue(maxValue, axis.logBase, axis.logBaseE, out maxSplit);
|
||||
minValue = ChartHelper.GetMinLogValue(minValue, axis.logBase, axis.logBaseE, out minSplit);
|
||||
var splitNumber = (minSplit > 0 && maxSplit > 0) ? (maxSplit + minSplit - 1) : (maxSplit + minSplit);
|
||||
|
||||
var splitNumber = maxSplit + minSplit;
|
||||
if (splitNumber > 15)
|
||||
splitNumber = 15;
|
||||
axis.splitNumber = splitNumber;
|
||||
|
||||
Reference in New Issue
Block a user