|  | 
| 2 | 2 | package com.github.mikephil.charting.charts; | 
| 3 | 3 | 
 | 
| 4 | 4 | import android.content.Context; | 
|  | 5 | +import android.content.res.TypedArray; | 
| 5 | 6 | import android.graphics.Canvas; | 
| 6 | 7 | import android.graphics.Paint; | 
| 7 | 8 | import android.graphics.RectF; | 
| 8 | 9 | import android.graphics.Typeface; | 
| 9 | 10 | import android.text.TextUtils; | 
| 10 | 11 | import android.util.AttributeSet; | 
| 11 | 12 | 
 | 
|  | 13 | +import com.github.mikephil.charting.R; | 
| 12 | 14 | import com.github.mikephil.charting.components.XAxis; | 
| 13 | 15 | import com.github.mikephil.charting.data.PieData; | 
| 14 | 16 | import com.github.mikephil.charting.data.PieEntry; | 
| 15 | 17 | import com.github.mikephil.charting.highlight.Highlight; | 
| 16 | 18 | import com.github.mikephil.charting.highlight.PieHighlighter; | 
| 17 | 19 | import com.github.mikephil.charting.interfaces.datasets.IPieDataSet; | 
| 18 | 20 | import com.github.mikephil.charting.renderer.PieChartRenderer; | 
|  | 21 | +import com.github.mikephil.charting.renderer.PieChartRendererFixCover; | 
| 19 | 22 | import com.github.mikephil.charting.utils.MPPointF; | 
| 20 | 23 | import com.github.mikephil.charting.utils.Utils; | 
| 21 | 24 | 
 | 
|  | 
| 29 | 32 |  */ | 
| 30 | 33 | public class PieChart extends PieRadarChartBase<PieData> { | 
| 31 | 34 | 
 | 
|  | 35 | +    private String mode; | 
|  | 36 | + | 
| 32 | 37 |     /** | 
| 33 | 38 |      * rect object that represents the bounds of the piechart, needed for | 
| 34 | 39 |      * drawing the circle | 
| @@ -113,13 +118,24 @@ public PieChart(Context context, AttributeSet attrs) { | 
| 113 | 118 | 
 | 
| 114 | 119 |     public PieChart(Context context, AttributeSet attrs, int defStyle) { | 
| 115 | 120 |         super(context, attrs, defStyle); | 
|  | 121 | +        getAttrs(attrs); | 
| 116 | 122 |     } | 
| 117 | 123 | 
 | 
|  | 124 | +    private void getAttrs(AttributeSet attrs) { | 
|  | 125 | +        if (attrs != null) { | 
|  | 126 | +            TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PieChart); | 
|  | 127 | +            mode = a.getString(R.styleable.PieChart_mp_chart_out_value_place_mode); | 
|  | 128 | +            a.recycle(); | 
|  | 129 | +        } | 
|  | 130 | +        ((PieChartRendererFixCover) mRenderer).setMode(mode); | 
|  | 131 | +    } | 
|  | 132 | + | 
|  | 133 | + | 
| 118 | 134 |     @Override | 
| 119 | 135 |     protected void init() { | 
| 120 | 136 |         super.init(); | 
| 121 | 137 | 
 | 
| 122 |  | -        mRenderer = new PieChartRenderer(this, mAnimator, mViewPortHandler); | 
|  | 138 | +        mRenderer = new PieChartRendererFixCover(this, mAnimator, mViewPortHandler); | 
| 123 | 139 |         mXAxis = null; | 
| 124 | 140 | 
 | 
| 125 | 141 |         mHighlighter = new PieHighlighter(this); | 
|  | 
0 commit comments