Skip to content

Commit

Permalink
Added feature that allows the label-count to be exactly set and evenl…
Browse files Browse the repository at this point in the history
…y distributed over the y-axis.
  • Loading branch information
PhilJay committed Jul 24, 2015
1 parent a09d6a7 commit d07ceda
Show file tree
Hide file tree
Showing 12 changed files with 779 additions and 743 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ protected void onCreate(Bundle savedInstanceState) {

YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(8);
leftAxis.setLabelCount(8, false);
leftAxis.setValueFormatter(custom);
leftAxis.setPosition(YAxisLabelPosition.OUTSIDE_CHART);
leftAxis.setSpaceTop(15f);

YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(8);
rightAxis.setLabelCount(8, false);
rightAxis.setValueFormatter(custom);
rightAxis.setSpaceTop(15f);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ protected void onCreate(Bundle savedInstanceState) {

YAxis leftAxis = mChart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(6);
leftAxis.setLabelCount(6, false);
leftAxis.setStartAtZero(false);
leftAxis.setAxisMinValue(-2.5f);
leftAxis.setAxisMaxValue(2.5f);

YAxis rightAxis = mChart.getAxisRight();
rightAxis.setDrawGridLines(false);
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(6);
rightAxis.setLabelCount(6, false);
rightAxis.setStartAtZero(false);
rightAxis.setAxisMinValue(-2.5f);
rightAxis.setAxisMaxValue(2.5f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) {

YAxis leftAxis = mChart.getAxisLeft();
// leftAxis.setEnabled(false);
leftAxis.setLabelCount(7);
leftAxis.setLabelCount(7, false);
leftAxis.setDrawGridLines(false);
leftAxis.setDrawAxisLine(false);
leftAxis.setStartAtZero(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected void onCreate(Bundle savedInstanceState) {

YAxis y = mChart.getAxisLeft();
y.setTypeface(tf);
y.setLabelCount(5);
y.setLabelCount(5, false);
y.setEnabled(false);

mChart.getAxisRight().setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ public View getView(int position, View convertView, ViewGroup parent) {

YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(5);
leftAxis.setLabelCount(5, false);
leftAxis.setSpaceTop(15f);

YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(5);
rightAxis.setLabelCount(5, false);
rightAxis.setSpaceTop(15f);

// set data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected void onCreate(Bundle savedInstanceState) {

YAxis yAxis = mChart.getYAxis();
yAxis.setTypeface(tf);
yAxis.setLabelCount(5);
yAxis.setLabelCount(5, false);
yAxis.setTextSize(9f);
yAxis.setStartAtZero(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void onCreate(Bundle savedInstanceState) {
mChart.getAxisRight().setStartAtZero(false);
mChart.getAxisRight().setAxisMaxValue(25f);
mChart.getAxisRight().setAxisMinValue(-25f);
mChart.getAxisRight().setLabelCount(7);
mChart.getAxisRight().setLabelCount(7, false);
mChart.getAxisRight().setValueFormatter(new CustomFormatter());
mChart.getAxisRight().setTextSize(9f);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public View getView(int position, View convertView, Context c) {

YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(5);
leftAxis.setLabelCount(5, false);
leftAxis.setSpaceTop(20f);

YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(5);
rightAxis.setLabelCount(5, false);
rightAxis.setSpaceTop(20f);

mChartData.setValueTypeface(mTf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public View getView(int position, View convertView, Context c) {

YAxis leftAxis = holder.chart.getAxisLeft();
leftAxis.setTypeface(mTf);
leftAxis.setLabelCount(5);
leftAxis.setLabelCount(5, false);

YAxis rightAxis = holder.chart.getAxisRight();
rightAxis.setTypeface(mTf);
rightAxis.setLabelCount(5);
rightAxis.setLabelCount(5, false);
rightAxis.setDrawGridLines(false);

// set data
Expand Down
Loading

0 comments on commit d07ceda

Please sign in to comment.