-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added feature to custom format all values in the chart with the Value…
…Formatter interface. General bugfixes.
- Loading branch information
Showing
14 changed files
with
107 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file renamed
BIN
+1.19 MB
...mple/libs/mpandroidchartlibrary-1-6-1.jar → ...mple/libs/mpandroidchartlibrary-1-6-2.jar
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
MPChartExample/src/com/xxmassdeveloper/mpchartexample/MyValueFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
package com.xxmassdeveloper.mpchartexample; | ||
|
||
import com.github.mikephil.charting.utils.ValueFormatter; | ||
|
||
import java.text.DecimalFormat; | ||
|
||
public class MyValueFormatter implements ValueFormatter { | ||
|
||
DecimalFormat mFormatter = new DecimalFormat("###,###,###"); | ||
|
||
@Override | ||
public String getFormattedValue(float value) { | ||
// do here whatever you want, avoid excessive calculations and memory | ||
// allocations | ||
return mFormatter.format(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
MPChartLib/src/com/github/mikephil/charting/utils/ValueFormatter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
package com.github.mikephil.charting.utils; | ||
|
||
/** | ||
* Interface that allows custom formatting of all values and value-labels | ||
* displayed inside the chart. Simply create your own formatting class and let | ||
* it implement ValueFormatter. Then override the getFormattedLabel(...) method | ||
* and return whatever you want. | ||
* | ||
* @author Philipp Jahoda | ||
*/ | ||
public interface ValueFormatter { | ||
|
||
/** | ||
* Called when a value (from labels, or inside the chart) is formatted | ||
* before being drawn. For performance reasons, avoid excessive calculations | ||
* and memory allocations inside this method. | ||
* | ||
* @param value the value to be formatted | ||
* @return the formatted label ready for being drawn | ||
*/ | ||
public String getFormattedValue(float value); | ||
} |
26 changes: 0 additions & 26 deletions
26
MPChartLib/src/com/github/mikephil/charting/utils/YLabelFormatter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters