Search in sources :

Example 6 with RealmDemoData

use of com.xxmassdeveloper.mpchartexample.custom.RealmDemoData in project MPAndroidChart by PhilJay.

the class RealmDatabaseActivityBar method setData.

private void setData() {
    RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
    //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
    // stacked entries
    RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "xValue", "yValue");
    set.setColors(new int[] { ColorTemplate.rgb("#FF5722"), ColorTemplate.rgb("#03A9F4") });
    set.setLabel("Realm BarDataSet");
    ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
    // add the dataset
    dataSets.add(set);
    // create a data object with the dataset list
    BarData data = new BarData(dataSets);
    styleData(data);
    // set data
    mChart.setData(data);
    mChart.setFitBars(true);
    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
Also used : RealmBarDataSet(com.github.mikephil.charting.data.realm.implementation.RealmBarDataSet) BarData(com.github.mikephil.charting.data.BarData) IBarDataSet(com.github.mikephil.charting.interfaces.datasets.IBarDataSet) ArrayList(java.util.ArrayList) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 7 with RealmDemoData

use of com.xxmassdeveloper.mpchartexample.custom.RealmDemoData in project MPAndroidChart by PhilJay.

the class RealmDatabaseActivityHorizontalBar method setData.

private void setData() {
    RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
    //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
    // stacked entries
    RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "xValue", "stackValues", "floatValue");
    set.setColors(new int[] { ColorTemplate.rgb("#8BC34A"), ColorTemplate.rgb("#FFC107"), ColorTemplate.rgb("#9E9E9E") });
    set.setLabel("Mobile OS distribution");
    set.setStackLabels(new String[] { "iOS", "Android", "Other" });
    ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
    // add the dataset
    dataSets.add(set);
    // create a data object with the dataset list
    BarData data = new BarData(dataSets);
    styleData(data);
    data.setValueTextColor(Color.WHITE);
    // set data
    mChart.setData(data);
    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
Also used : RealmBarDataSet(com.github.mikephil.charting.data.realm.implementation.RealmBarDataSet) BarData(com.github.mikephil.charting.data.BarData) IBarDataSet(com.github.mikephil.charting.interfaces.datasets.IBarDataSet) ArrayList(java.util.ArrayList) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 8 with RealmDemoData

use of com.xxmassdeveloper.mpchartexample.custom.RealmDemoData in project MPAndroidChart by PhilJay.

the class RealmDatabaseActivityLine method setData.

private void setData() {
    RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
    RealmLineDataSet<RealmDemoData> set = new RealmLineDataSet<RealmDemoData>(result, "xValue", "yValue");
    set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    set.setLabel("Realm LineDataSet");
    set.setDrawCircleHole(false);
    set.setColor(ColorTemplate.rgb("#FF5722"));
    set.setCircleColor(ColorTemplate.rgb("#FF5722"));
    set.setLineWidth(1.8f);
    set.setCircleRadius(3.6f);
    ArrayList<ILineDataSet> dataSets = new ArrayList<ILineDataSet>();
    // add the dataset
    dataSets.add(set);
    // create a data object with the dataset list
    LineData data = new LineData(dataSets);
    styleData(data);
    // set data
    mChart.setData(data);
    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
Also used : LineData(com.github.mikephil.charting.data.LineData) ILineDataSet(com.github.mikephil.charting.interfaces.datasets.ILineDataSet) ArrayList(java.util.ArrayList) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData) RealmLineDataSet(com.github.mikephil.charting.data.realm.implementation.RealmLineDataSet)

Example 9 with RealmDemoData

use of com.xxmassdeveloper.mpchartexample.custom.RealmDemoData 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)

Example 10 with RealmDemoData

use of com.xxmassdeveloper.mpchartexample.custom.RealmDemoData in project MPAndroidChart by PhilJay.

the class RealmDatabaseActivityRadar method setData.

private void setData() {
    RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
    //RealmBarDataSet<RealmDemoData> set = new RealmBarDataSet<RealmDemoData>(result, "stackValues", "xIndex"); // normal entries
    // stacked entries
    RealmRadarDataSet<RealmDemoData> set = new RealmRadarDataSet<RealmDemoData>(result, "yValue");
    set.setLabel("Realm RadarDataSet");
    set.setDrawFilled(true);
    set.setColor(ColorTemplate.rgb("#009688"));
    set.setFillColor(ColorTemplate.rgb("#009688"));
    set.setFillAlpha(130);
    set.setLineWidth(2f);
    ArrayList<IRadarDataSet> dataSets = new ArrayList<IRadarDataSet>();
    // add the dataset
    dataSets.add(set);
    // create a data object with the dataset list
    RadarData data = new RadarData(dataSets);
    styleData(data);
    // set data
    mChart.setData(data);
    mChart.animateY(1400);
}
Also used : RealmRadarDataSet(com.github.mikephil.charting.data.realm.implementation.RealmRadarDataSet) IRadarDataSet(com.github.mikephil.charting.interfaces.datasets.IRadarDataSet) ArrayList(java.util.ArrayList) RadarData(com.github.mikephil.charting.data.RadarData) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Aggregations

RealmDemoData (com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)13 ArrayList (java.util.ArrayList)7 BarData (com.github.mikephil.charting.data.BarData)2 RealmBarDataSet (com.github.mikephil.charting.data.realm.implementation.RealmBarDataSet)2 IBarDataSet (com.github.mikephil.charting.interfaces.datasets.IBarDataSet)2 BubbleData (com.github.mikephil.charting.data.BubbleData)1 CandleData (com.github.mikephil.charting.data.CandleData)1 LineData (com.github.mikephil.charting.data.LineData)1 PieData (com.github.mikephil.charting.data.PieData)1 RadarData (com.github.mikephil.charting.data.RadarData)1 ScatterData (com.github.mikephil.charting.data.ScatterData)1 RealmBubbleDataSet (com.github.mikephil.charting.data.realm.implementation.RealmBubbleDataSet)1 RealmCandleDataSet (com.github.mikephil.charting.data.realm.implementation.RealmCandleDataSet)1 RealmLineDataSet (com.github.mikephil.charting.data.realm.implementation.RealmLineDataSet)1 RealmPieDataSet (com.github.mikephil.charting.data.realm.implementation.RealmPieDataSet)1 RealmRadarDataSet (com.github.mikephil.charting.data.realm.implementation.RealmRadarDataSet)1 RealmScatterDataSet (com.github.mikephil.charting.data.realm.implementation.RealmScatterDataSet)1 IBubbleDataSet (com.github.mikephil.charting.interfaces.datasets.IBubbleDataSet)1 ICandleDataSet (com.github.mikephil.charting.interfaces.datasets.ICandleDataSet)1 ILineDataSet (com.github.mikephil.charting.interfaces.datasets.ILineDataSet)1