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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations