'Stacked Barchart: Display only sum of each stack

According to this question, it's necesarry to use the StackedValueFormatter in order to only display the total sum of every stack on top of the bar.

However, it turns out that the StackedValueFormatter is deprecated.

The function getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) is no longer available and thus, the solution is no longer valid.

Is there are new solution which replaces the StackedValueFormatter.

The endresult should look like this:

endresult



Solution 1:[1]

The following will prevent rendering of the items on the inside of the colored stacks; I don't know if this will affect the topmost number: I'm just experimenting with the same goal.

    BarData data = new BarData(dataSets);
    data.setValueFormatter(new ValueFormatter() {
        @Override
        public String getFormattedValue(float value) {
            return "";
        }
    });

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 larham1