private void setData() { RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll(); RealmPieDataSet<RealmDemoData> set = new RealmPieDataSet<RealmDemoData>(result, "yValue", "label"); set.setColors(ColorTemplate.VORDIPLOM_COLORS); set.setLabel("Example market share"); set.setSliceSpace(2); // create a data object with the dataset list PieData data = new PieData(set); styleData(data); data.setValueTextColor(Color.WHITE); data.setValueTextSize(12f); // set data mChart.setData(data); mChart.animateY(1400); }
private void setData() { RealmResults<RealmDemoData> result = mRealm.allObjects(RealmDemoData.class); //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries RealmPieDataSet<RealmDemoData> set = new RealmPieDataSet<RealmDemoData>(result, "value", "xIndex"); // stacked entries set.setColors(ColorTemplate.VORDIPLOM_COLORS); set.setLabel("Example market share"); set.setSliceSpace(2); // create a data object with the dataset list RealmPieData data = new RealmPieData(result, "xValue", set); styleData(data); data.setValueTextColor(Color.WHITE); data.setValueTextSize(12f); // set data mChart.setData(data); mChart.animateY(1400); }