Skip to content

FillFormatter

Philipp Jahoda edited this page Nov 6, 2015 · 4 revisions

The FillFormatter interface 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. Use the

publicfloatgetFillLinePosition(LineDataSetdataSet, LineDataProviderprovider)

method of the interface for implementing a custom logic that calculates the ending point of the fill line for the individual LineDataSet.

Creating a class the implements the interface:

publicclassMyCustomFillFormatterimplementsFillFormatter {
@OverridepublicfloatgetFillLinePosition(LineDataSetdataSet, LineDataProviderdataProvider) {
floatmyDesiredFillPosition = ...;
// put your logic here...returnmyDesiredFillPosition;
}
}

And then set the custom-formatter to your LineDataSet:

lineDataSet.setFillFormatter(newMyCustomFillFormatter());

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

The documentation has moved.

Clone this wiki locally