• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.github.mikephil.charting.formatter;
2 
3 import com.github.mikephil.charting.data.Entry;
4 import com.github.mikephil.charting.utils.ViewPortHandler;
5 
6 /**
7  * Interface that allows custom formatting of all values inside the chart before they are
8  * being drawn to the screen. Simply create your own formatting class and let
9  * it implement IValueFormatter. Then override the getFormattedValue(...) method
10  * and return whatever you want.
11  *
12  * @author Philipp Jahoda
13  */
14 public interface IValueFormatter
15 {
16 
17     /**
18      * Called when a value (from labels inside the chart) is formatted
19      * before being drawn. For performance reasons, avoid excessive calculations
20      * and memory allocations inside this method.
21      *
22      * @param value           the value to be formatted
23      * @param entry           the entry the value belongs to - in e.g. BarChart, this is of class BarEntry
24      * @param dataSetIndex    the index of the DataSet the entry in focus belongs to
25      * @param viewPortHandler provides information about the current chart state (scale, translation, ...)
26      * @return the formatted label ready for being drawn
27      */
getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler)28     String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler);
29 }
30