MPAndroid Line Chart XAxis Label with formatter not splitting string in new line

Viewed 1462

I am using MPAndroid Line graph. I am using XAxis formatter to display axis label. On my X-axis I have to show the date as Jan 2016(with a new line between month and year), so that it will not overlap other text, so month and year will be vertically aligned.

I am using following code, but it it not able to create a new line in between the white space of the string "MMM yyyy"(like Jan 2016, Feb 2016).

xAxis.setValueFormatter(new IAxisValueFormatter() {
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return xAxisValueMap.get((int)value).replaceAll("\\s+",System.getProperty("line.separator"));
        }
    });
0 Answers
Related