aboutsummaryrefslogtreecommitdiff
path: root/MPChartLib/src/main/java/com
diff options
context:
space:
mode:
authorduchampdev <duchampdev@outlook.com>2019-04-27 16:06:10 +0200
committerduchampdev <duchampdev@outlook.com>2019-04-27 16:06:10 +0200
commit0563fb48b0fdc713ab1789c7544db413b26b1ae9 (patch)
tree8294746d01988369bea2433048bc01318ceebfd9 /MPChartLib/src/main/java/com
parented8876cef283249b63f12e2bb8931dd9e444ee17 (diff)
downloadMPAndroidChart-0563fb48b0fdc713ab1789c7544db413b26b1ae9.tar.gz
PercentFormatter: make space between number and percent sign optional
Diffstat (limited to 'MPChartLib/src/main/java/com')
-rw-r--r--MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java
index 6bf1bd3c..3ee1447e 100644
--- a/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java
+++ b/MPChartLib/src/main/java/com/github/mikephil/charting/formatter/PercentFormatter.java
@@ -16,9 +16,11 @@ public class PercentFormatter extends ValueFormatter
public DecimalFormat mFormat;
private PieChart pieChart;
+ private boolean percentSignSeparated;
public PercentFormatter() {
mFormat = new DecimalFormat("###,###,##0.0");
+ percentSignSeparated = true;
}
// Can be used to remove percent signs if the chart isn't in percent mode
@@ -27,9 +29,15 @@ public class PercentFormatter extends ValueFormatter
this.pieChart = pieChart;
}
+ // Can be used to remove percent signs if the chart isn't in percent mode
+ public PercentFormatter(PieChart pieChart, boolean percentSignSeparated) {
+ this(pieChart);
+ this.percentSignSeparated = percentSignSeparated;
+ }
+
@Override
public String getFormattedValue(float value) {
- return mFormat.format(value) + " %";
+ return mFormat.format(value) + (percentSignSeparated ? " %" : "%");
}
@Override