Skip to content

Commit

Permalink
Add a warning message if pie chart has more than one data set
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Jan 23, 2020
1 parent cd00003 commit 7306d3f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

package com.github.mikephil.charting.data;

import android.util.Log;

import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.interfaces.datasets.IPieDataSet;

Expand Down Expand Up @@ -46,6 +48,18 @@ public IPieDataSet getDataSet() {
return mDataSets.get(0);
}

@Override
public List<IPieDataSet> getDataSets() {
List<IPieDataSet> dataSets = super.getDataSets();

if (dataSets.size() < 1) {
Log.e("MPAndroidChart",
"Found multiple data sets while pie chart only allows one");
}

return dataSets;
}

/**
* The PieData object can only have one DataSet. Use getDataSet() method instead.
*
Expand Down

0 comments on commit 7306d3f

Please sign in to comment.