android - MPAndroidChart RadarChart collapses itself -
i have problems radarchart
labels. specifically, if use long texts (e.g. 15-20 chars), , available space not big, chart gets collapsed , labels positioned inside collapsed chart (but there more space available).
i tried use valueformatter
label axis truncates labels if longer 5 chars, see, chart size calculaction based on full label text, chart got collapsed same way described 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 pictures clarify problem. charts displayed inside cardview
s , can see, there plenty of space remaining on sides. first 2 pictures taken valueformatter
set, last 2 without it.
probably having mistakes, here solutions:
1) set radar data after set radarchart
parameters call invalidate()
;
2) set axisminimum
, axismaximum
in radarchart.getxaxis()
, radarchart.getyaxis()
3) call yaxis.calculate(min,max)
after step 2;
4) if needed use radarchart.setextraoffsets(?,?,?,?)
i using com.github.philjay:mpandroidchart:v3.0.1
Comments
Post a Comment