Package 

Class DefaultValueFormatter

  • All Implemented Interfaces:
    com.github.mikephil.charting.formatter.IValueFormatter

    
    public class DefaultValueFormatter
     implements IValueFormatter
                        

    Default formatter used for formatting values inside the chart. Uses a DecimalFormat with pre-calculated number of digits (depending on max and min value).

    • Constructor Detail

      • DefaultValueFormatter

        DefaultValueFormatter(Integer digits)
    • Method Detail

      • setup

         final Unit setup(Integer digits)

        Sets up the formatter with a given number of decimal digits.

      • 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 formatted
        entry - the entry the value belongs to - in e.g.
        dataSetIndex - the index of the DataSet the entry in focus belongs to
        viewPortHandler - provides information about the current chart state (scale, translation, ...