Search in sources :

Example 1 with RealmCandleDataSet

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

the class RealmDatabaseActivityCandle method setData.

private void setData() {
    RealmResults<RealmDemoData> result = mRealm.where(RealmDemoData.class).findAll();
    RealmCandleDataSet<RealmDemoData> set = new RealmCandleDataSet<RealmDemoData>(result, "xValue", "high", "low", "open", "close");
    set.setLabel("Realm CandleDataSet");
    set.setShadowColor(Color.DKGRAY);
    set.setShadowWidth(0.7f);
    set.setDecreasingColor(Color.RED);
    set.setDecreasingPaintStyle(Paint.Style.FILL);
    set.setIncreasingColor(Color.rgb(122, 242, 84));
    set.setIncreasingPaintStyle(Paint.Style.STROKE);
    set.setNeutralColor(Color.BLUE);
    ArrayList<ICandleDataSet> dataSets = new ArrayList<ICandleDataSet>();
    // add the dataset
    dataSets.add(set);
    // create a data object with the dataset list
    CandleData data = new CandleData(dataSets);
    styleData(data);
    // set data
    mChart.setData(data);
    mChart.animateY(1400, Easing.EasingOption.EaseInOutQuart);
}
Also used : ICandleDataSet(com.github.mikephil.charting.interfaces.datasets.ICandleDataSet) CandleData(com.github.mikephil.charting.data.CandleData) ArrayList(java.util.ArrayList) RealmCandleDataSet(com.github.mikephil.charting.data.realm.implementation.RealmCandleDataSet) RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Aggregations

CandleData (com.github.mikephil.charting.data.CandleData)1 RealmCandleDataSet (com.github.mikephil.charting.data.realm.implementation.RealmCandleDataSet)1 ICandleDataSet (com.github.mikephil.charting.interfaces.datasets.ICandleDataSet)1 RealmDemoData (com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)1 ArrayList (java.util.ArrayList)1