@Override public void onViewportChanged(Viewport newViewport) { if (!updatingPreviewViewport) { updatingChartViewport = true; previewChart.setZoomType(ZoomType.HORIZONTAL); previewChart.setCurrentViewport(newViewport); updatingChartViewport = false; if (iobcobFragmentObject.getView() != null) { // Fragment is loaded LineChartView iobcobPastChart = (LineChartView) findViewById(R.id.iobcobPast); Viewport iobv = new Viewport( chart .getMaximumViewport()); // Update the IOB COB Line Chart Viewport to stay // inline with the preview iobv.left = newViewport.left; iobv.right = newViewport.right; iobv.top = extendedGraphBuilder.yCOBMax.floatValue(); iobv.bottom = extendedGraphBuilder.yCOBMin.floatValue(); iobcobPastChart.setCurrentViewport(iobv); } if (basalvsTempBasalObject.getView() != null) { LineChartView bvbChart = (LineChartView) findViewById(R.id.basalvsTempBasal_LineChart); Viewport bvbv = new Viewport(chart.getMaximumViewport()); bvbv.left = newViewport.left; bvbv.right = newViewport.right; bvbv.top = extendedGraphBuilder.maxBasal.floatValue(); bvbv.bottom = -4; // TODO: 14/09/2015 how to make this negative of maxBolus? bvbChart.setCurrentViewport(bvbv); } } }
public void setupChart() { basalvsTempBasalChart.setZoomType(ZoomType.HORIZONTAL); basalvsTempBasalChart.setLineChartData(extendedGraphBuilder.basalvsTempBasalData()); Viewport iobv = new Viewport( basalvsTempBasalChart .getMaximumViewport()); // Sets the min and max for Top and Bottom of the // viewpoint iobv.top = extendedGraphBuilder.maxBasal.floatValue(); iobv.bottom = -(extendedGraphBuilder.maxBasal.floatValue() - 1); basalvsTempBasalChart.setMaximumViewport(iobv); iobv.left = previewChart.getCurrentViewport().left; iobv.right = previewChart.getCurrentViewport().right; basalvsTempBasalChart.setCurrentViewport(iobv); basalvsTempBasalChart.setViewportCalculationEnabled(true); // iobcobPastChart.setViewportChangeListener(new ChartViewPortListener()); // //causes a crash, no idea why #// TODO: 28/08/2015 }
public void setupChart() { iobcobPastChart.setZoomType(ZoomType.HORIZONTAL); iobcobPastChart.setLineChartData(extendedGraphBuilder.iobcobPastLineData()); Viewport iobv = new Viewport( iobcobPastChart .getMaximumViewport()); // Sets the min and max for Top and Bottom of the // viewpoint iobv.top = Float.parseFloat(extendedGraphBuilder.yCOBMax.toString()); iobv.bottom = Float.parseFloat(extendedGraphBuilder.yCOBMin.toString()); iobcobPastChart.setMaximumViewport(iobv); iobv.left = previewChart.getCurrentViewport().left; iobv.right = previewChart.getCurrentViewport().right; iobcobPastChart.setCurrentViewport(iobv); iobcobPastChart.setViewportCalculationEnabled(true); // iobcobPastChart.setViewportChangeListener(new ChartViewPortListener()); // //causes a crash, no idea why #// TODO: 28/08/2015 }