use of lecho.lib.hellocharts.model.AxisValue in project xDrip by NightscoutFoundation.
the class BasalChart method chartYAxis.
// TODO recalculate axis on every change
@NonNull
public static Axis chartYAxis(float max_height) {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
yAxis.setHasLines(true);
// max_height = max_height * 3;
final float yStep = chooseClosestStep(max_height / 20f);
// rounding???
final List<AxisValue> axisValues = new ArrayList<>();
// TODO autoscale this - rebuild on data change??
for (float j = 0; j <= max_height + yStep; j += yStep) {
axisValues.add(new AxisValue(j));
}
yAxis.setValues(axisValues);
// yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(false);
// yAxis.setTextSize(axisTextSize);
AxisValueFormatter formatter = new SimpleAxisValueFormatter(2);
yAxis.setFormatter(formatter);
return yAxis;
}
use of lecho.lib.hellocharts.model.AxisValue in project xDrip by NightscoutFoundation.
the class BgGraphBuilder method yAxis.
// ///////AXIS RELATED//////////////
public Axis yAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
List<AxisValue> axisValues = new ArrayList<AxisValue>();
for (int j = 1; j <= 12; j += 1) {
if (doMgdl) {
axisValues.add(new AxisValue(j * 50));
} else {
axisValues.add(new AxisValue(j * 2));
}
}
yAxis.setValues(axisValues);
yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(true);
yAxis.setTextSize(axisTextSize);
return yAxis;
}
use of lecho.lib.hellocharts.model.AxisValue in project xDrip by NightscoutFoundation.
the class BgGraphBuilder method yAxis.
// ///////AXIS RELATED//////////////
public Axis yAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(true);
List<AxisValue> axisValues = new ArrayList<AxisValue>();
yAxis.setValues(axisValues);
yAxis.setHasLines(false);
return yAxis;
}
use of lecho.lib.hellocharts.model.AxisValue in project xDrip-plus by jamorham.
the class BgGraphBuilder method yAxis.
// ///////AXIS RELATED//////////////
public Axis yAxis() {
Axis yAxis = new Axis();
yAxis.setAutoGenerated(false);
List<AxisValue> axisValues = new ArrayList<AxisValue>();
for (int j = 1; j <= 12; j += 1) {
if (doMgdl) {
axisValues.add(new AxisValue(j * 50));
} else {
axisValues.add(new AxisValue(j * 2));
}
}
yAxis.setValues(axisValues);
yAxis.setHasLines(true);
yAxis.setMaxLabelChars(5);
yAxis.setInside(true);
yAxis.setTextSize(axisTextSize);
return yAxis;
}
use of lecho.lib.hellocharts.model.AxisValue in project xDrip-plus by jamorham.
the class BgGraphBuilder method xAxis.
@NonNull
private Axis xAxis() {
List<AxisValue> axisValues = new ArrayList<AxisValue>();
final java.text.DateFormat timeFormat = hourFormat();
timeFormat.setTimeZone(TimeZone.getDefault());
GregorianCalendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(start_time);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
if (calendar.getTimeInMillis() < start_time) {
calendar.add(Calendar.HOUR, 1);
}
while (calendar.getTimeInMillis() < end_time) {
axisValues.add(new AxisValue((calendar.getTimeInMillis() / FUZZER), (timeFormat.format(calendar.getTimeInMillis())).toCharArray()));
calendar.add(Calendar.HOUR, 1);
}
Axis axis = new Axis();
axis.setValues(axisValues);
axis.setHasLines(true);
return axis;
}
Aggregations