mirror of
https://github.com/woheller69/solxpect.git
synced 2025-12-16 09:20:12 +01:00
limit number of y-axis labels
This commit is contained in:
parent
3314f624da
commit
b6838569ab
1 changed files with 7 additions and 6 deletions
|
|
@ -361,15 +361,16 @@ public class CityWeatherAdapter extends RecyclerView.Adapter<CityWeatherAdapter.
|
|||
if (energyDay>energyMax) energyMax=energyDay;
|
||||
}
|
||||
|
||||
//Calculate step size. Target: 4 <= steps < 10, but step size must integer >= 1
|
||||
//Calculate step size. Target: 4 <= steps <= 7, but step size must integer >= 1
|
||||
int stepSize = 1;
|
||||
int numSteps;
|
||||
|
||||
do {
|
||||
numSteps = (int) (energyMax / stepSize);
|
||||
if (numSteps > 10) stepSize *=10;
|
||||
else if (numSteps < 4) stepSize /=2;
|
||||
} while (numSteps > 10 || numSteps < 4 && stepSize>0);
|
||||
do {
|
||||
numSteps = (int) (energyMax / stepSize);
|
||||
if (numSteps > 10) stepSize *=10;
|
||||
else if (numSteps > 7) stepSize *=2;
|
||||
else if (numSteps < 4) stepSize /=2;
|
||||
} while (numSteps > 7 || numSteps < 4 && stepSize>0);
|
||||
|
||||
if (stepSize<1) stepSize=1; //Step size must be integer, min 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue