Skip to content

Commit

Permalink
Make min/max axis labels configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Jan 23, 2020
1 parent f95f7d7 commit 4d9557c
Showing 1 changed file with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,39 @@ public abstract class AxisBase extends ComponentBase {
*/
public float mAxisRange = 0f;

private int mAxisMinLabels = 2;
private int mAxisMaxLabels = 25;

/**
* The minumum number of labels on the axis
*/
public int getAxisMinLabels() {
return mAxisMinLabels;
}

/**
* The minumum number of labels on the axis
*/
public void setAxisMinLabels(int labels) {
if (labels > 0)
mAxisMinLabels = labels;
}

/**
* The maximum number of labels on the axis
*/
public int getAxisMaxLabels() {
return mAxisMaxLabels;
}

/**
* The maximum number of labels on the axis
*/
public void setAxisMaxLabels(int labels) {
if (labels > 0)
mAxisMaxLabels = labels;
}

/**
* default constructor
*/
Expand Down Expand Up @@ -314,10 +347,10 @@ public boolean isDrawLabelsEnabled() {
*/
public void setLabelCount(int count) {

if (count > 25)
count = 25;
if (count < 2)
count = 2;
if (count > getAxisMaxLabels())
count = getAxisMaxLabels();
if (count < getAxisMinLabels())
count = getAxisMinLabels();

mLabelCount = count;
mForceLabels = false;
Expand Down

0 comments on commit 4d9557c

Please sign in to comment.