|
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 |
|
|
30 | 33 | */
|
31 | 34 | public class PieChart extends PieRadarChartBase<PieData> {
|
32 | 35 |
|
| 36 | + private String mode; |
| 37 | + |
33 | 38 | /**
|
34 | 39 | * rect object that represents the bounds of the piechart, needed for
|
35 | 40 | * drawing the circle
|
@@ -114,13 +119,24 @@ public PieChart(Context context, AttributeSet attrs) {
|
114 | 119 |
|
115 | 120 | public PieChart(Context context, AttributeSet attrs, int defStyle) {
|
116 | 121 | super(context, attrs, defStyle);
|
| 122 | + getAttrs(attrs); |
117 | 123 | }
|
118 | 124 |
|
| 125 | + private void getAttrs(AttributeSet attrs) { |
| 126 | + if (attrs != null) { |
| 127 | + TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.PieChart); |
| 128 | + mode = a.getString(R.styleable.PieChart_mp_chart_out_value_place_mode); |
| 129 | + a.recycle(); |
| 130 | + } |
| 131 | + ((PieChartRendererFixCover) mRenderer).setMode(mode); |
| 132 | + } |
| 133 | + |
| 134 | + |
119 | 135 | @Override
|
120 | 136 | protected void init() {
|
121 | 137 | super.init();
|
122 | 138 |
|
123 |
| - mRenderer = new PieChartRenderer(this, mAnimator, mViewPortHandler); |
| 139 | + mRenderer = new PieChartRendererFixCover(this, mAnimator, mViewPortHandler); |
124 | 140 | mXAxis = null;
|
125 | 141 |
|
126 | 142 | mHighlighter = new PieHighlighter(this);
|
|
0 commit comments