title: Pie Chart not displaying in a fragment(Android)
body: <p>I'm developing an andorid application and in this app,  I'm trying to display a pie chart in one of by tabbed fragments.  But it shows "No chart data available". When i try to do the same in an activity, it shows perfectly.  I'm using the "MPAndroidChart" as a reference. Kindly help.
  Thanks in advance!</p>
  
  <p>This is my fragment.class</p>
  
  <pre><code>import android.graphics.Color;
   import android.graphics.Typeface;
   import android.net.Uri;
  
  import android.os.Bundle;
  import android.text.SpannableString;
  import android.text.style.ForegroundColorSpan;
  import android.text.style.RelativeSizeSpan;
  import android.text.style.StyleSpan;
  import android.util.Log;
  import android.view.InflateException;
  import android.view.LayoutInflater;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.SeekBar;
  import android.widget.TextView;
  import com.github.mikephil.charting.charts.PieChart;
  import com.github.mikephil.charting.components.Legend;
  import com.github.mikephil.charting.data.Entry;
  
  
  import com.github.mikephil.charting.data.PieData;
  import com.github.mikephil.charting.data.PieDataSet;
  
  
   import com.github.mikephil.charting.utils.ColorTemplate;
  
   import java.util.ArrayList;
  
  
  
  
  
  
  public class overview extends android.support.v4.app.Fragment {
  private static final String ARG_PARAM1 = "param1";
  private static final String ARG_PARAM2 = "param2";
  private static View rootView;
  private OnFragmentInteractionListener mListener;
  private SeekBar mSeekBarX, mSeekBarY;
  private TextView tvX, tvY;
  private PieChart mChart;
  
  private Typeface tf;
  
  
  
  public overview() {
      // Required empty public constructor
  }
  
  //String param1, String param2
  public static overview newInstance() {
      overview fragment = new overview();
      Bundle args = new Bundle();
      // args.putString(ARG_PARAM1, param1);
      //args.putString(ARG_PARAM2, param2);
      fragment.setArguments(args);
      return fragment;
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      if (getArguments() != null) {
  
      }
  }
  public View onCreateView(LayoutInflater inflater, final ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
      View view = inflater.inflate(R.layout.overview, container, false);
  
       PieChart pieChart = (PieChart) findViewById(R.id.chart);
  
      ArrayList&lt;Entry&gt; entries = new ArrayList&lt;&gt;();
      entries.add(new Entry(4f, 0));
      entries.add(new Entry(8f, 1));
      entries.add(new Entry(6f, 2));
      entries.add(new Entry(12f, 3));
      entries.add(new Entry(18f, 4));
      entries.add(new Entry(9f, 5));
  
      PieDataSet dataset = new PieDataSet(entries, "# of Calls");
  
      ArrayList&lt;String&gt; labels = new ArrayList&lt;String&gt;();
      labels.add("January");
      labels.add("February");
      labels.add("March");
      labels.add("April");
      labels.add("May");
      labels.add("June");
  
      PieData data = new PieData(labels, dataset);
      dataset.setColors(ColorTemplate.COLORFUL_COLORS); //
      pieChart.setDescription("Description");
      pieChart.setData(data);
  
      pieChart.animateY(5000);
  
      pieChart.saveToGallery("/sd/mychart.jpg", 85); // 85 is the quality of 
     the image
  
  
  
  
      if (rootView != null) {
          ViewGroup parent = (ViewGroup) rootView.getParent();
          if (parent != null)
              parent.removeView(rootView);
      }
      try {
          rootView = inflater.inflate(R.layout.overview, container, false);
  
      } catch (InflateException e) {
      /* map is already there, just return view as it is  */
      }
      return rootView;
  }
  
  private SpannableString generateCenterText() {
      SpannableString s = new SpannableString("Revenues\nQuarters 2015");
      s.setSpan(new RelativeSizeSpan(2f), 0, 8, 0);
      s.setSpan(new ForegroundColorSpan(Color.GRAY), 8, s.length(), 0);
      return s;
  }
  
  
  @Override
  public void onDetach() {
      super.onDetach();
      mListener = null;
  }
  
  public interface OnFragmentInteractionListener {
      // TODO: Update argument type and name
      void onFragmentInteraction(Uri uri);
  }
  
  } 
  </code></pre>
  
  <p>This is my xml file:</p>
  
  <pre><code>     &lt;com.github.mikephil.charting.charts.PieChart
              android:id="@+id/chart"
              android:layout_width="300dp"
              android:layout_height="300dp" /&gt;
  </code></pre>