MPAndroidChart-Realm
MPAndroidChart-Realm copied to clipboard
Can XValue be a non-float?
public class MisuraRealm extends RealmObject{
@PrimaryKey
private int idMisura;
private double lat;
private double lon;
//epoch time in msec
private long time;
private double value;
//UoM
@SerializedName("uom")
private String symbol;
private String sensorName;
private String packageName;
private int idSessione;
//getters and setters
}
I want time field on the X-Axis and value on the Y-Axis. Is that possible? I got error on x-value that has to be float, mine is long.
I have this same exact issue.
Same issue.
Same issue. Is this library alive ?
Same issue, I want to use the date on one axis, Has any of you succeeded?
Perhaps this IAxisValueFormatter
can be of any help?
public class DateAxisValueFormatter implements IAxisValueFormatter {
// Minimum seperation for showing a new date
public static final float GRANULARITY = 24*60*60*1000; // 24 hours / 1 day
private static final float SHOW_YEAR_THRESHOLD = 6*30*24*60*60*1000f; // 6 Months
private static final float SHOW_MONTH_THRESHOLD = 0f;
private BarLineChartBase<?> chart;
private DateFormatHelper dateFormatHelper;
public DateAxisValueFormatter(Context context, BarLineChartBase<?> chart) {
this.chart = chart;
dateFormatHelper = new DateFormatHelper(context);
}
@Override
public String getFormattedValue(float value, AxisBase axis) {
float visibleXrange = chart.getVisibleXRange();
CharSequence dateString;
if (visibleXrange > SHOW_YEAR_THRESHOLD){
dateString = dateFormatHelper.yearMonthDayLong((long) value);
}else if (visibleXrange > SHOW_MONTH_THRESHOLD){
dateString = dateFormatHelper.monthDayShort((long) value);
}else{
dateString = dateFormatHelper.monthDayShort((long) value);
}
return dateString.toString();
}
}
Yes it is, Thank you.