Skip to content

FillFormatter

Philipp Jahoda edited this page Sep 12, 2015 · 4 revisions

The FillFormatter class allows to customize where the filled line of a LineDataSet should end. All that needs to be done is create a new class and implement the FillFormatter interface. In the public float getFillLinePosition(...) method the ending point of the filled area can be returned.

public class MyCustomFillFormatter implements FillFormatter {

    @Override
    public float getFillLinePosition(LineDataSet dataSet, LineDataProvider dataProvider) {

        float myDesiredFillPosition = ...;
        // put your logic here...

        return myDesiredFillPosition;
    }
}

And then set the formatter to your LineDataSet:

lineDataSet.setFillFormatter(new MyCustomFillFormatter());

Here is the default implementation (logic) of the DefaultFillFormatter.

The documentation has moved.

Clone this wiki locally