Radius of Doughnut chart in AchartEngine

后端 未结 2 960
陌清茗
陌清茗 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. 
    

提交回复
热议问题