Skip to content

Commit 4cb83a7

Browse files
committed
Added IndexAxisValueFormatter, to allow for easy x-axis labels like MPAndroidChart 2.0
1 parent 0818d76 commit 4cb83a7

17 files changed

Lines changed: 77 additions & 75 deletions

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartActivityMultiDataset.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ protected void onCreate(Bundle savedInstanceState) {
9696
public String getFormattedValue(float value, AxisBase axis) {
9797
return String.valueOf((int) value);
9898
}
99-
100-
@Override
101-
public int getDecimalDigits() {
102-
return 0;
103-
}
10499
});
105100

106101
YAxis leftAxis = mChart.getAxisLeft();

MPChartExample/src/com/xxmassdeveloper/mpchartexample/BarChartPositiveNegative.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ protected void onCreate(Bundle savedInstanceState) {
9090
public String getFormattedValue(float value, AxisBase axis) {
9191
return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue;
9292
}
93-
94-
@Override
95-
public int getDecimalDigits() {
96-
return 0;
97-
}
9893
});
9994

10095
setData(data);

MPChartExample/src/com/xxmassdeveloper/mpchartexample/CombinedChartActivity.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ protected void onCreate(Bundle savedInstanceState) {
8484
public String getFormattedValue(float value, AxisBase axis) {
8585
return mMonths[(int) value % mMonths.length];
8686
}
87-
88-
@Override
89-
public int getDecimalDigits() {
90-
return 0;
91-
}
9287
});
9388

9489
CombinedData data = new CombinedData();

MPChartExample/src/com/xxmassdeveloper/mpchartexample/LineChartTime.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,6 @@ public String getFormattedValue(float value, AxisBase axis) {
100100
long millis = TimeUnit.HOURS.toMillis((long) value);
101101
return mFormat.format(new Date(millis));
102102
}
103-
104-
@Override
105-
public int getDecimalDigits() {
106-
return 0;
107-
}
108103
});
109104

110105
YAxis leftAxis = mChart.getAxisLeft();

MPChartExample/src/com/xxmassdeveloper/mpchartexample/RadarChartActivitry.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ protected void onCreate(Bundle savedInstanceState) {
8181
public String getFormattedValue(float value, AxisBase axis) {
8282
return mActivities[(int) value % mActivities.length];
8383
}
84-
85-
@Override
86-
public int getDecimalDigits() {
87-
return 0;
88-
}
8984
});
9085
xAxis.setTextColor(Color.WHITE);
9186

MPChartExample/src/com/xxmassdeveloper/mpchartexample/StackedBarActivityNegative.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ protected void onCreate(Bundle savedInstanceState) {
8585
public String getFormattedValue(float value, AxisBase axis) {
8686
return format.format(value) + "-" + format.format(value + 10);
8787
}
88-
89-
@Override
90-
public int getDecimalDigits() {
91-
return 0;
92-
}
9388
});
9489

9590
Legend l = mChart.getLegend();
@@ -243,10 +238,5 @@ public String getFormattedValue(float value, Entry entry, int dataSetIndex, View
243238
public String getFormattedValue(float value, AxisBase axis) {
244239
return mFormat.format(Math.abs(value)) + "m";
245240
}
246-
247-
@Override
248-
public int getDecimalDigits() {
249-
return 0;
250-
}
251241
}
252242
}

MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/DayAxisValueFormatter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,4 @@ else if (days <= 1458)
136136
return 2020;
137137

138138
}
139-
140-
@Override
141-
public int getDecimalDigits() {
142-
return 0;
143-
}
144139
}

MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyAxisValueFormatter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,4 @@ public MyAxisValueFormatter() {
1818
public String getFormattedValue(float value, AxisBase axis) {
1919
return mFormat.format(value) + " $";
2020
}
21-
22-
@Override
23-
public int getDecimalDigits() {
24-
return 1;
25-
}
2621
}

MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/MyCustomXAxisValueFormatter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,4 @@ else if (xScale > 1)
3737
else
3838
return mFormat.format(value);
3939
}
40-
41-
@Override
42-
public int getDecimalDigits() {
43-
return 1;
44-
}
4540
}

MPChartExample/src/com/xxmassdeveloper/mpchartexample/custom/YearXAxisFormatter.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,4 @@ public String getFormattedValue(float value, AxisBase axis) {
2424
float percent = value / axis.mAxisRange;
2525
return mMonths[(int) (mMonths.length * percent)];
2626
}
27-
28-
@Override
29-
public int getDecimalDigits() {
30-
return 0;
31-
}
3227
}

0 commit comments

Comments
 (0)