Search in sources :

Example 1 with RealmPieDataSet

use of com.github.mikephil.charting.data.realm.implementation.RealmPieDataSet in project MPAndroidChart by PhilJay.

the class RealmDatabaseActivityPie method setData.

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);
}
Also used : RealmPieDataSet(com.github.mikephil.charting.data.realm.implementation.RealmPieDataSet) PieData(com.github.mikephil.charting.data.PieData) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Aggregations

PieData (com.github.mikephil.charting.data.PieData)1 RealmPieDataSet (com.github.mikephil.charting.data.realm.implementation.RealmPieDataSet)1 RealmDemoData (com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)1