From 49453e10df0670d8cfb5a28a49d39a929d1dac71 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 13 Dec 2016 23:18:02 +0100 Subject: [PATCH] fix x axis on overview when no data displayed --- .../plugins/Overview/OverviewFragment.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 67f3b0cc18..38fdc1bdf2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -683,6 +683,13 @@ public class OverviewFragment extends Fragment { } }); + // set manual x bounds to have nice steps + bgGraph.getViewport().setMaxX(toTime); + bgGraph.getViewport().setMinX(fromTime); + bgGraph.getViewport().setXAxisBoundsManual(true); + bgGraph.getGridLabelRenderer().setLabelFormatter(new TimeAsXAxisLabelFormatter(getActivity(), "HH")); + bgGraph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space + // **** BG graph **** List bgReadingsArray = MainApp.getDbHelper().getDataFromTime(fromTime); List inRangeArray = new ArrayList(); @@ -763,13 +770,6 @@ public class OverviewFragment extends Fragment { seriesTreatments.setColor(Color.CYAN); } - // set manual x bounds to have nice steps - bgGraph.getViewport().setMaxX(toTime); - bgGraph.getViewport().setMinX(fromTime); - bgGraph.getViewport().setXAxisBoundsManual(true); - bgGraph.getGridLabelRenderer().setLabelFormatter(new TimeAsXAxisLabelFormatter(getActivity(), "HH")); - bgGraph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space - // set manual y bounds to have nice steps bgGraph.getViewport().setMaxY(maxBgValue); bgGraph.getViewport().setMinY(0);