Search in sources :

Example 1 with RealmDemoData

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

the class RealmBaseActivity method writeToDBCandle.

protected void writeToDBCandle(int objectCount) {
    mRealm.beginTransaction();
    mRealm.delete(RealmDemoData.class);
    for (int i = 0; i < objectCount; i++) {
        float mult = 50;
        float val = (float) (Math.random() * 40) + mult;
        float high = (float) (Math.random() * 9) + 8f;
        float low = (float) (Math.random() * 9) + 8f;
        float open = (float) (Math.random() * 6) + 1f;
        float close = (float) (Math.random() * 6) + 1f;
        boolean even = i % 2 == 0;
        RealmDemoData d = new RealmDemoData(i, val + high, val - low, even ? val + open : val - open, even ? val - close : val + close);
        mRealm.copyToRealm(d);
    }
    mRealm.commitTransaction();
}
Also used : RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 2 with RealmDemoData

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

the class RealmBaseActivity method writeToDBBubble.

protected void writeToDBBubble(int objectCount) {
    mRealm.beginTransaction();
    mRealm.delete(RealmDemoData.class);
    for (int i = 0; i < objectCount; i++) {
        float value = 30f + (float) (Math.random() * 100.0);
        float size = 15f + (float) (Math.random() * 20.0);
        RealmDemoData d = new RealmDemoData(i, value, size);
        mRealm.copyToRealm(d);
    }
    mRealm.commitTransaction();
}
Also used : RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 3 with RealmDemoData

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

the class RealmBaseActivity method writeToDBPie.

protected void writeToDBPie() {
    mRealm.beginTransaction();
    mRealm.delete(RealmDemoData.class);
    float value1 = 15f + (float) (Math.random() * 8f);
    float value2 = 15f + (float) (Math.random() * 8f);
    float value3 = 15f + (float) (Math.random() * 8f);
    float value4 = 15f + (float) (Math.random() * 8f);
    float value5 = 100f - value1 - value2 - value3 - value4;
    float[] values = new float[] { value1, value2, value3, value4, value5 };
    String[] labels = new String[] { "iOS", "Android", "WP 10", "BlackBerry", "Other" };
    for (int i = 0; i < values.length; i++) {
        RealmDemoData d = new RealmDemoData(values[i], labels[i]);
        mRealm.copyToRealm(d);
    }
    mRealm.commitTransaction();
}
Also used : RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 4 with RealmDemoData

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

the class RealmBaseActivity method writeToDB.

protected void writeToDB(int objectCount) {
    mRealm.beginTransaction();
    mRealm.delete(RealmDemoData.class);
    for (int i = 0; i < objectCount; i++) {
        float value = 40f + (float) (Math.random() * 60f);
        RealmDemoData d = new RealmDemoData(i, value);
        mRealm.copyToRealm(d);
    }
    mRealm.commitTransaction();
}
Also used : RealmDemoData(com.xxmassdeveloper.mpchartexample.custom.RealmDemoData)

Example 5 with RealmDemoData

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

the class RealmBaseActivity method writeToDBStack.

protected void writeToDBStack(int objectCount) {
    mRealm.beginTransaction();
    mRealm.delete(RealmDemoData.class);
    for (int i = 0; i < objectCount; i++) {
        float val1 = 34f + (float) (Math.random() * 12.0f);
        float val2 = 34f + (float) (Math.random() * 12.0f);
        float[] stack = new float[] { val1, val2, 100 - val1 - val2 };
        RealmDemoData d = new RealmDemoData(i, stack);
        mRealm.copyToRealm(d);
    }
    mRealm.commitTransaction();
}
Also used : 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