Allow a null label for a DataSet
diff --git a/MPChartLib/src/com/github/mikephil/charting/data/DataSet.java b/MPChartLib/src/com/github/mikephil/charting/data/DataSet.java
index ca170fa..c7a7caf 100644
--- a/MPChartLib/src/com/github/mikephil/charting/data/DataSet.java
+++ b/MPChartLib/src/com/github/mikephil/charting/data/DataSet.java
@@ -337,7 +337,7 @@
*/
public String toSimpleString() {
StringBuffer buffer = new StringBuffer();
- buffer.append("DataSet, label: " + mLabel + ", entries: " + mYVals.size() + "\n");
+ buffer.append("DataSet, label: " + (mLabel == null ? "" : mLabel) + ", entries: " + mYVals.size() + "\n");
return buffer.toString();
}
diff --git a/MPChartLib/src/com/github/mikephil/charting/renderer/LegendRenderer.java b/MPChartLib/src/com/github/mikephil/charting/renderer/LegendRenderer.java
index 1f4f426..6e0578d 100644
--- a/MPChartLib/src/com/github/mikephil/charting/renderer/LegendRenderer.java
+++ b/MPChartLib/src/com/github/mikephil/charting/renderer/LegendRenderer.java
@@ -92,9 +92,11 @@
colors.add(clrs.get(j));
}
- // add the legend description label
- colors.add(-2);
- labels.add(bds.getLabel());
+ if (bds.getLabel() != null) {
+ // add the legend description label
+ colors.add(-2);
+ labels.add(bds.getLabel());
+ }
} else if (dataSet instanceof PieDataSet) {
@@ -107,9 +109,11 @@
colors.add(clrs.get(j));
}
- // add the legend description label
- colors.add(-2);
- labels.add(pds.getLabel());
+ if (pds.getLabel() != null) {
+ // add the legend description label
+ colors.add(-2);
+ labels.add(pds.getLabel());
+ }
} else { // all others