private void drawCenterCircle(Canvas canvas) {
        final PieChartData data = dataProvider.getPieChartData();
        final float circleRadius = originCircleOval.width() / 2f;
        final float centerRadius = circleRadius * data.getCenterCircleScale();
        final float centerX = originCircleOval.centerX();
        final float centerY = originCircleOval.centerY();

        canvas.drawCircle(centerX, centerY, centerRadius, centerCirclePaint);

        // Draw center text1 and text2 if not empty.
        if (!TextUtils.isEmpty(data.getCenterText1())) {

            final int text1Height = Math.abs(centerCircleText1FontMetrics.ascent);

            if (!TextUtils.isEmpty(data.getCenterText2())) {
                // Draw text 2 only if text 1 is not empty.
                final int text2Height = Math.abs(centerCircleText2FontMetrics.ascent);
                canvas.drawText(data.getCenterText1(), centerX, centerY - text1Height * 0.2f, centerCircleText1Paint);
                canvas.drawText(data.getCenterText2(), centerX, centerY + text2Height, centerCircleText2Paint);
            } else {
                canvas.drawText(data.getCenterText1(), centerX, centerY + text1Height / 4, centerCircleText1Paint);
            }
        }
    }
private void drawCenterCircle ( Canvas canvas ) { final PieChartData data = dataProvider . getPieChartData ( ) ; final float circleRadius = originCircleOval . width ( ) / 2f ; final float centerRadius = circleRadius * data . getCenterCircleScale ( ) ; final float centerX = originCircleOval . centerX ( ) ; final float centerY = originCircleOval . centerY ( ) ; canvas . drawCircle ( centerX , centerY , centerRadius , centerCirclePaint ) ; if ( ! TextUtils . isEmpty ( data . getCenterText1 ( ) ) ) { final int text1Height = Math . abs ( centerCircleText1FontMetrics . ascent ) ; if ( ! TextUtils . isEmpty ( data . getCenterText2 ( ) ) ) { final int text2Height = Math . abs ( centerCircleText2FontMetrics . ascent ) ; canvas . drawText ( data . getCenterText1 ( ) , centerX , centerY - text1Height * 0.2f , centerCircleText1Paint ) ; canvas . drawText ( data . getCenterText2 ( ) , centerX , centerY + text2Height , centerCircleText2Paint ) ; } else { canvas . drawText ( data . getCenterText1 ( ) , centerX , centerY + text1Height / 4 , centerCircleText1Paint ) ; } } }
Draw center circle with text if {@link PieChartData#hasCenterCircle()} is set true.