@Override public void calculateOffsets() { super.calculateOffsets(); // prevent nullpointer when no data set if (mDataNotSet) return; float diameter = getDiameter(); float radius = diameter / 2f; PointF c = getCenterOffsets(); final List<PieDataSet> dataSets = mData.getDataSets(); float maxShift = 0.f; for (int i = 0; i < dataSets.size(); i++) { final float shift = dataSets.get(i).getSelectionShift(); if (shift > maxShift) maxShift = shift; } final float halfMaxShift = maxShift / 2.f; // create the circle box that will contain the pie-chart (the bounds of // the pie-chart) mCircleBox.set( c.x - radius + halfMaxShift, c.y - radius + halfMaxShift, c.x + radius - halfMaxShift, c.y + radius - halfMaxShift); }
public void onDraw(Canvas canvas) { super.onDraw(canvas); if (mDataNotSet) return; long starttime = System.currentTimeMillis(); drawXLabels(); drawWeb(); drawLimitLines(); drawData(); drawAdditional(); drawHighlights(); drawYLabels(); drawValues(); drawLegend(); drawDescription(); drawMarkers(); canvas.drawBitmap(mDrawBitmap, 0, 0, mDrawPaint); Log.i(LOG_TAG, "RadarChart DrawTime: " + (System.currentTimeMillis() - starttime) + " ms"); }
@Override public void prepare() { super.prepare(); prepareYLabels(); prepareXLabels(); }
@Override public void setPaint(Paint p, int which) { super.setPaint(p, which); switch (which) { case PAINT_RADAR_WEB: mWebPaint = p; break; } }
@Override protected void init() { super.init(); mWebLineWidth = Utils.convertDpToPixel(1.5f); mInnerWebLineWidth = Utils.convertDpToPixel(0.75f); mWebPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mWebPaint.setStyle(Paint.Style.STROKE); mHighlightPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mHighlightPaint.setStyle(Paint.Style.STROKE); mHighlightPaint.setStrokeWidth(2f); mHighlightPaint.setColor(Color.rgb(255, 187, 115)); }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mDataNotSet) return; mRenderer.drawData(canvas); if (valuesToHighlight()) mRenderer.drawHighlighted(canvas, mIndicesToHighlight); mRenderer.drawExtras(canvas); mRenderer.drawValues(canvas); mLegendRenderer.renderLegend(canvas); drawDescription(canvas); drawMarkers(canvas); }
@Override protected void init() { super.init(); mRenderer = new PieChartRenderer(this, mAnimator, mViewPortHandler); }
@Override protected void calcMinMax() { super.calcMinMax(); calcAngles(); }
@Override protected void calcMinMax(boolean fixedValues) { super.calcMinMax(fixedValues); mYChartMin = 0; }