Radius of Doughnut chart in AchartEngine

后端 未结 2 959
陌清茗
陌清茗 2021-01-21 15:59

I m trying to set doughnut chart inner circle radius and outter circle radius in aChartengine, below is my code :

public class MainActivity extends Activity {
           


        
相关标签:
2条回答
  • 2021-01-21 16:31

    You have to just chage value of decCoef (variable in DoughnutChart class). In DefaultRenderer add your own radius variable and create getter and setter. now, use this variable in DoughnutChart.

    for example ,

     DefaultRenderer defaultRenderer = new DefaultRenderer();
    defaultRenderer.setmWidth(0.1f);
    

    In DoughnutChart class :

    public class DoughnutChart extends RoundChart {
        private float mWidth; // make your own variable and initialize in constructor 
    
        public DoughnutChart(MultipleCategorySeries dataset, DefaultRenderer renderer) {
           super(null, renderer);
            mDataset = dataset;
            mWidth = renderer.getmWidth();
       }
       double decCoef =  mWidth / cLength; // change value of decCoef by using our variable. 
    
    0 讨论(0)
  • 2021-01-21 16:48

    renderer.setScale((flaot)1.3) solved my problem but the inner and outer radius is approx not prefect.

    0 讨论(0)
提交回复
热议问题