AchartEngine add text with superscript

三世轮回 提交于 2019-12-11 05:45:20

问题


Is it possible to add superscript, or subscript characters to AchartEngine's x axes label, like you did in Microsoft Word?


回答1:


You can try this

    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);

Otherwise you can do

 CharSequence xtitle  =   Html.fromHtml("X<sup>2</sup>");

But then you have to change achartengine library and change String to CharSequence because CharSequence cannot be cast to string.



来源:https://stackoverflow.com/questions/20441747/achartengine-add-text-with-superscript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!