fix x axis on overview when no data displayed

This commit is contained in:
Milos Kozak 2016-12-13 23:18:02 +01:00
parent 738d4c1c2a
commit 49453e10df

View file

@ -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 **** // **** BG graph ****
List<BgReading> bgReadingsArray = MainApp.getDbHelper().getDataFromTime(fromTime); List<BgReading> bgReadingsArray = MainApp.getDbHelper().getDataFromTime(fromTime);
List<BgReading> inRangeArray = new ArrayList<BgReading>(); List<BgReading> inRangeArray = new ArrayList<BgReading>();
@ -763,13 +770,6 @@ public class OverviewFragment extends Fragment {
seriesTreatments.setColor(Color.CYAN); 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 // set manual y bounds to have nice steps
bgGraph.getViewport().setMaxY(maxBgValue); bgGraph.getViewport().setMaxY(maxBgValue);
bgGraph.getViewport().setMinY(0); bgGraph.getViewport().setMinY(0);