title: MPAndroid chart pie label getting cut off
body: <p>I have been trying to figure out how to modify the pie chart from MPAndroid chart library to not cut off the labels. I have tried modifying the view port with <code>chart.setExtraOffsets()</code> and <code>chart.setPadding()</code>. As well as trying to use the view port handler to get this pie chart to fit within the view.</p>
  <p><a href="https://i.stack.imgur.com/b08Xx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b08Xx.png" alt="enter image description here" /></a></p>
  <pre><code> public void setupInventoryChart(PieChart chart) {
          chart.setUsePercentValues(false);
          chart.setDescription(&quot;&quot;);
  
          chart.setDragDecelerationFrictionCoef(0.95f);
  
          mtf = Typeface.createFromAsset(getActivity().getAssets(), &quot;OpenSans-Regular.ttf&quot;);
          chart.setCenterTextTypeface(mtf);
  
          chart.setDrawHoleEnabled(true);
          //chart.setHoleColorTransparent(false);
  
          chart.setTransparentCircleColor(Color.WHITE);
  //        chart.setTransparentCircleAlpha(110);
  
          chart.setHoleRadius(58f);
          chart.setTransparentCircleRadius(61f);
  
          chart.setDrawCenterText(true);
  
          chart.setRotationAngle(0);
          chart.setRotationEnabled(true); // enable rotation of the chart by touch
  
          // mChart.setUnit(&quot; €&quot;);
          // mChart.setDrawUnitsInChart(true);
  
          // add a selection listener
          chart.setOnChartValueSelectedListener(this);
  
          chart.setExtraOffsets(0.5f, 0.5f, 0.5f, 0.8f);
  
          //chart.animateY(1500, Easing.EasingOption.EaseInOutQuad);
          // mChart.spin(2000, 0, 360);
  
          Legend l = chart.getLegend();
          l.setEnabled(false);
         // l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
        //  l.setXEntrySpace(7f);
        //  l.setYEntrySpace(5f);
        //  l.setYOffset(0f);
        //  l.setTextColor(Color.BLACK);
  
          setInventoryData(chart);
  
      }
  
      private void setInventoryData(PieChart chart) {
  
          //This defines the order of  how the data is shown.
          InventoryType[] inventoryStatusOrder = new InventoryType[] {
                  InventoryType.ACTIVE_POSTINGS, InventoryType.SOLD, InventoryType.NEEDS_ATTENTION, InventoryType.URGENT};
  
          int count = inventoryStatusOrder.length;
  
          String[] parties = new String[count];
          for (int i = 0 ; i &lt; parties.length ; i++) {
              parties[i] = inventoryStatusOrder[i].getValue();
          }
  
          ArrayList&lt;Entry&gt; yVals1 = new ArrayList&lt;Entry&gt;();   //yVals1 is value of each label.
          ArrayList&lt;String&gt; xVals = new ArrayList&lt;String&gt;();  //xVals is the labels
  
          // IMPORTANT: In a PieChart, num of values (Entry) should have the same
          // xIndex (even if from different DataSets), since no values can be
          // drawn above each other.
          int total = 0;
          int[] colorPositions = new int[count];
          for (int i = 0 ; i &lt; count ; i++) {
              int item = mInventoryStatus.getCountByType(inventoryStatusOrder[i]);
              if (item != 0) {
                  xVals.add(parties[i % parties.length]);
                  yVals1.add(new Entry(item, i));
                  total += item;
                  colorPositions[i] = 1;
              }
          }
  
          PieDataSet dataSet = new PieDataSet(yVals1, &quot;&quot;);
          dataSet.setSliceSpace(3f);
          dataSet.setSelectionShift(5f);
  
          int[] dashboardColors = getResources().getIntArray(R.array.dashboard_color);    //there are 5 orange colors.
          ArrayList&lt;Integer&gt; colors = new ArrayList();
          for (int i = 0 ; i &lt; count ; i++) {
              if(colorPositions[i] != 0)
                  colors.add(dashboardColors[i]);      //In this case, it will use the first color again.
          }
  
          int[] temp = new int[colors.size()];
          for(int i = 0; i &lt; colors.size(); i++) {
              temp[i] = colors.get(i);
          }
  
          dataSet.setColors(temp);
  
          dataSet.setValueLinePart1OffsetPercentage(80.f);
          dataSet.setValueLinePart1Length(0.4f);
          dataSet.setValueLinePart2Length(0.4f);
          dataSet.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
          //dataSet.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
  
  
          PieData data = new PieData(xVals, dataSet);
          data.setValueFormatter(new IntValueFormatter(false, false));
          data.setValueTextSize(15f);
          data.setValueTextColor(Color.BLACK);
          data.setValueTypeface(mtf);
  
          chart.setData(data);
  
          // undo all highlights
          chart.highlightValues(null);
  
          mBoldTf = Typeface.createFromAsset(getActivity().getAssets(),&quot;OpenSans-Bold.ttf&quot;);
          chart.setCenterText(generateCenterSpannableText(mInventoryStatus.getVins() + &quot;\nUnique\nVINs&quot;));
          chart.setCenterTextColor(Color.BLACK);
          chart.setCenterTextSize(16f);
          chart.setCenterTextTypeface(mBoldTf);
  
          chart.invalidate();
          chart.animateXY(900, 900);
      }
  </code></pre>