-
- All Implemented Interfaces:
-
com.github.mikephil.charting.formatter.IAxisValueFormatter,com.github.mikephil.charting.formatter.IValueFormatter
public class PercentFormatter implements IValueFormatter, IAxisValueFormatter
This IValueFormatter is just for convenience and simply puts a "%" sign after each value. (Recommeded for PieChart)
-
-
Field Summary
Fields Modifier and Type Field Description private final IntegerdecimalDigits
-
Constructor Summary
Constructors Constructor Description PercentFormatter()PercentFormatter(DecimalFormat format)Allow a custom decimal format
-
Method Summary
Modifier and Type Method Description final IntegergetDecimalDigits()StringgetFormattedValue(Float value, Entry entry, Integer dataSetIndex, ViewPortHandler viewPortHandler)Called when a value (from labels inside the chart) is formatted before being drawn. StringgetFormattedValue(Float value, AxisBase axis)Called when a value from an axis is to be formatted before being drawn. -
-
Constructor Detail
-
PercentFormatter
PercentFormatter()
-
PercentFormatter
PercentFormatter(DecimalFormat format)
Allow a custom decimal format
-
-
Method Detail
-
getDecimalDigits
final Integer getDecimalDigits()
-
getFormattedValue
String getFormattedValue(Float value, Entry entry, Integer dataSetIndex, ViewPortHandler viewPortHandler)
Called when a value (from labels inside the chart) is formatted before being drawn. For performance reasons, avoid excessive calculations and memory allocations inside this method.
- Parameters:
value- the value to be formattedentry- the entry the value belongs to - in e.g.dataSetIndex- the index of the DataSet the entry in focus belongs toviewPortHandler- provides information about the current chart state (scale, translation, ...
-
getFormattedValue
String getFormattedValue(Float value, AxisBase axis)
Called when a value from an axis is to be formatted before being drawn. For performance reasons, avoid excessive calculations and memory allocations inside this method.
- Parameters:
value- the value to be formattedaxis- the axis the value belongs to
-
-
-
-