I have some problems with RadarChart
tags. In particular, if I use long texts (for example, 15-20 characters), and the available space is not too large, the chart crashes and the labels are placed inside the collapsed chart (but there is clearly more free space).
I tried to use a ValueFormatter
for the label axis, which truncates the labels if they are longer than 5 characters, but as I can see, the calculation of the size of the chart is based on the full text of the label, since the chart crashed the same way I described it before.
XAxis xAxis = radarChart.getXAxis(); xAxis.setValueFormatter(new XAxisValueFormatter() { @Override public String getXValue(String original, int index, ViewPortHandler viewPortHandler) { return original.length() > 5 ? original.substring(0, 5) + "β¦" : original; } });
Here are some photos to clarify the problem. Charts are displayed inside CardView
, and, as you can see, there is a lot of free space on all sides. The first two pictures are taken with the ValueFormatter
set, the last two without it.




source share