是否有可能标,或下标字符添加到AchartEngine中的x轴的标签,就像你在Microsoft Word中那样?
Answer 1:
你可以试试这个
str = str.replaceAll("0", "⁰");
str = str.replaceAll("1", "¹");
str = str.replaceAll("2", "²");
str = str.replaceAll("3", "³");
str = str.replaceAll("4", "⁴");
str = str.replaceAll("5", "⁵");
str = str.replaceAll("6", "⁶");
str = str.replaceAll("7", "⁷");
str = str.replaceAll("8", "⁸");
str = str.replaceAll("9", "⁹");
String str = "X2";
String xtitle = str.replaceAll("2", "²");
renderer.setXTitle( xtitle);
否则,你可以做
CharSequence xtitle = Html.fromHtml("X<sup>2</sup>");
但你必须改变achartengine库,改变字符串的CharSequence因为CharSequence中不能被强制转换为字符串。
文章来源: AchartEngine add text with superscript