use of com.github.mikephil.charting.data.PieEntry in project MPAndroidChart by PhilJay.
the class SimpleFragment method generatePieData.
/**
* generates less data (1 DataSet, 4 values)
* @return
*/
protected PieData generatePieData() {
int count = 4;
ArrayList<PieEntry> entries1 = new ArrayList<PieEntry>();
for (int i = 0; i < count; i++) {
entries1.add(new PieEntry((float) ((Math.random() * 60) + 40), "Quarter " + (i + 1)));
}
PieDataSet ds1 = new PieDataSet(entries1, "Quarterly Revenues 2015");
ds1.setColors(ColorTemplate.VORDIPLOM_COLORS);
ds1.setSliceSpace(2f);
ds1.setValueTextColor(Color.WHITE);
ds1.setValueTextSize(12f);
PieData d = new PieData(ds1);
d.setValueTypeface(tf);
return d;
}
use of com.github.mikephil.charting.data.PieEntry in project MPAndroidChart by PhilJay.
the class ListViewMultiChartActivity method generateDataPie.
/**
* generates a random ChartData object with just one DataSet
*
* @return
*/
private PieData generateDataPie(int cnt) {
ArrayList<PieEntry> entries = new ArrayList<PieEntry>();
for (int i = 0; i < 4; i++) {
entries.add(new PieEntry((float) ((Math.random() * 70) + 30), "Quarter " + (i + 1)));
}
PieDataSet d = new PieDataSet(entries, "");
// space between slices
d.setSliceSpace(2f);
d.setColors(ColorTemplate.VORDIPLOM_COLORS);
PieData cd = new PieData(d);
return cd;
}
Aggregations