2

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"));
        }
    });
s_k_t
  • 689
  • 1
  • 15
  • 36
  • Possible duplicate of [In MPAndroidChart Library, How to wrap X Axis Labels to two lines when long?](https://stackoverflow.com/questions/32509174/in-mpandroidchart-library-how-to-wrap-x-axis-labels-to-two-lines-when-long) – David Rawson Aug 14 '17 at 23:02

0 Answers0