protected void drawDataSet(Canvas c, PieDataSet dataSet) {

    float angle = mChart.getRotationAngle();

    List<Entry> entries = dataSet.getYVals();
    float[] drawAngles = mChart.getDrawAngles();

    for (int j = 0; j < entries.size(); j++) {

      float newangle = drawAngles[j];
      float sliceSpace = dataSet.getSliceSpace();

      Entry e = entries.get(j);

      // draw only if the value is greater than zero
      if ((Math.abs(e.getVal()) > 0.000001)) {

        if (!mChart.needsHighlight(e.getXIndex(), mChart.getData().getIndexOfDataSet(dataSet))) {

          mRenderPaint.setColor(dataSet.getColor(j));
          mBitmapCanvas.drawArc(
              mChart.getCircleBox(),
              (angle + sliceSpace / 2f) * mAnimator.getPhaseY(),
              (newangle - sliceSpace / 2f) * mAnimator.getPhaseY(),
              true,
              mRenderPaint);
        }
      }

      angle += newangle * mAnimator.getPhaseX();
    }
  }
  @Override
  public void drawHighlighted(Canvas c, Highlight[] indices) {

    float rotationAngle = mChart.getRotationAngle();
    float angle = 0f;

    float[] drawAngles = mChart.getDrawAngles();
    float[] absoluteAngles = mChart.getAbsoluteAngles();

    for (int i = 0; i < indices.length; i++) {

      // get the index to highlight
      int xIndex = indices[i].getXIndex();
      if (xIndex >= drawAngles.length) continue;

      PieDataSet set = mChart.getData().getDataSetByIndex(indices[i].getDataSetIndex());

      if (set == null || !set.isHighlightEnabled()) continue;

      if (xIndex == 0) angle = rotationAngle;
      else angle = rotationAngle + absoluteAngles[xIndex - 1];

      angle *= mAnimator.getPhaseY();

      float sliceDegrees = drawAngles[xIndex];

      float shift = set.getSelectionShift();
      RectF circleBox = mChart.getCircleBox();

      RectF highlighted =
          new RectF(
              circleBox.left - shift,
              circleBox.top - shift,
              circleBox.right + shift,
              circleBox.bottom + shift);

      mRenderPaint.setColor(set.getColor(xIndex));

      // redefine the rect that contains the arc so that the
      // highlighted pie is not cut off
      mBitmapCanvas.drawArc(
          highlighted,
          angle + set.getSliceSpace() / 2f,
          sliceDegrees * mAnimator.getPhaseY() - set.getSliceSpace() / 2f,
          true,
          mRenderPaint);
    }
  }
  protected void drawRoundedSlices(Canvas c) {

    if (!mChart.isDrawRoundedSlicesEnabled()) return;

    PieDataSet dataSet = mChart.getData().getDataSet();

    if (!dataSet.isVisible()) return;

    PointF center = mChart.getCenterCircleBox();
    float r = mChart.getRadius();

    // calculate the radius of the "slice-circle"
    float circleRadius = (r - (r * mChart.getHoleRadius() / 100f)) / 2f;

    List<Entry> entries = dataSet.getYVals();
    float[] drawAngles = mChart.getDrawAngles();
    float angle = mChart.getRotationAngle();

    for (int j = 0; j < entries.size(); j++) {

      float newangle = drawAngles[j];

      Entry e = entries.get(j);

      // draw only if the value is greater than zero
      if ((Math.abs(e.getVal()) > 0.000001)) {

        float x =
            (float)
                ((r - circleRadius)
                        * Math.cos(Math.toRadians((angle + newangle) * mAnimator.getPhaseY()))
                    + center.x);
        float y =
            (float)
                ((r - circleRadius)
                        * Math.sin(Math.toRadians((angle + newangle) * mAnimator.getPhaseY()))
                    + center.y);

        mRenderPaint.setColor(dataSet.getColor(j));
        mBitmapCanvas.drawCircle(x, y, circleRadius, mRenderPaint);
      }

      angle += newangle * mAnimator.getPhaseX();
    }
  }