mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 07:50:16 +00:00
[improve][axis] improve max value and division of y axis
This commit is contained in:
@@ -233,7 +233,9 @@ namespace XCharts
|
||||
{
|
||||
var each = GetTick(range);
|
||||
tick = each;
|
||||
if (range / tick > 8)
|
||||
if (range / 4 % each == 0)
|
||||
tick = range / 4;
|
||||
else if (range / tick > 8)
|
||||
tick = 2 * each;
|
||||
else if (range / tick < 4)
|
||||
tick = each / 2;
|
||||
@@ -273,6 +275,7 @@ namespace XCharts
|
||||
private static double GetTick(double max)
|
||||
{
|
||||
if (max <= 1) return max / 5;
|
||||
if (max > 1 && max < 10) return 1;
|
||||
var bigger = Math.Ceiling(Math.Abs(max));
|
||||
int n = 1;
|
||||
while (bigger / (Mathf.Pow(10, n)) > 10)
|
||||
|
||||
Reference in New Issue
Block a user