How to align legends vertically in AchartEngine for PieChart in android -


i using achartengine in application. possible replace legends.

its horizontal

oa ob oc od

but want make vertical

 oa ob oc  od 

is possible change position of legends? highly appreciated.

i'm not using achartengine creating dynamically.enter image description here

here sample java code.

public class mainactivity extends activity {  private linearlayout linear;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);     random randomgenerator = new random();     (int = 0; < 100; i++) {         linear = (linearlayout) findviewbyid(r.id.linear);         linearlayout lay = new linearlayout(this);         linearlayout lay1 = new linearlayout(this);         textview text = new textview(this);         text.settext("ones");         text.settextcolor(color.parsecolor("#000000"));         text.setlayoutparams(new linearlayout.layoutparams(60, 40));          textview line = new textview(this);         line.setbackgroundcolor(color.parsecolor("#00ff00"));         line.setlayoutparams(new linearlayout.layoutparams(5, 90));          textview btn = new textview(this);         int randomint = randomgenerator.nextint(100);         if (randomint > 0 && randomint <= 10) {             btn.setbackgroundcolor(color.parsecolor("#ff1919"));         } else if (randomint > 10 && randomint <= 20) {             btn.setbackgroundcolor(color.parsecolor("#c41300"));         } else if (randomint > 20 && randomint <= 30) {             btn.setbackgroundcolor(color.parsecolor("#ab1100"));         } else if (randomint > 30 && randomint <= 40) {             btn.setbackgroundcolor(color.parsecolor("#7a0c00"));         } else if (randomint > 40 && randomint <= 50) {             btn.setbackgroundcolor(color.parsecolor("#3e0600"));         } else if (randomint < 50 && randomint <= 60) {             btn.setbackgroundcolor(color.parsecolor("#000000"));         } else if (randomint > 60 && randomint <= 70) {             btn.setbackgroundcolor(color.parsecolor("#003e0f"));          } else if (randomint > 70 && randomint <= 80) {             btn.setbackgroundcolor(color.parsecolor("#007a1d"));          } else if (randomint > 80 && randomint <= 90) {             btn.setbackgroundcolor(color.parsecolor("#00c42f"));          } else {             btn.setbackgroundcolor(color.parsecolor("#11ff4a"));          }         log.d("tag", "randnumber" + randomint);          btn.setlayoutparams(new linearlayout.layoutparams(randomint, 40));          btn.setid(i);         btn.setonclicklistener(new onclicklistener() {              @override             public void onclick(view arg0) {                 // todo auto-generated method stub                 log.d("tag", "get id" + arg0.getid());             }         });         textview text1 = new textview(this);         text1.settext("1");         text1.settextcolor(color.parsecolor("#000000"));         text1.setlayoutparams(new linearlayout.layoutparams(60, 40));         lay1.setorientation(linearlayout.horizontal);         lay1.setgravity(gravity.center_vertical);         // lay1.setpadding(0, 10, 0, 10);         lay1.addview(text);         lay1.addview(line);         lay1.addview(btn);         lay1.addview(text1);         lay.setorientation(linearlayout.vertical);         lay.addview(lay1);         linear.addview(lay);     } }  } 

here xml code.

 <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity" >  <scrollview     android:layout_width="match_parent"     android:layout_height="match_parent"     android:scrollbars="vertical" >      <linearlayout         android:id="@+id/linear"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical" >     </linearlayout> </scrollview> 


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -