// Updates Stats public static JSONObject updateChart(Activity a) { JSONObject reply = new JSONObject(); List<Stats> statList = Stats.updateActiveBarChart(a.getBaseContext()); if (iobcobChart != null || statList != null || statList.size() > 0) { // reloads charts with Treatment data iobcobChart.setColumnChartData(extendedGraphBuilder.iobcobFutureChart(statList)); try { reply.put("iob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).iob)); reply.put("cob", String.format(Locale.ENGLISH, "%.2f", statList.get(0).cob)); } catch (JSONException e) { Crashlytics.logException(e); e.printStackTrace(); } return reply; } else { try { reply.put("iob", String.format(Locale.ENGLISH, "%.2f", 0.00)); reply.put("cob", String.format(Locale.ENGLISH, "%.2f", 0.00)); } catch (JSONException e) { Crashlytics.logException(e); e.printStackTrace(); } return reply; } }
public static void updateChart() { if (iobcobPastChart != null) { iobcobPastChart.setLineChartData( LineChartData .generateDummyData()); //// TODO: 07/10/2015 debug, trying to reset data in chart to // stop odd issue with lines looping iobcobPastChart.setLineChartData(extendedGraphBuilder.iobcobPastLineData()); } }
public void setViewport() { if (tempViewport.left == 0.0 || holdViewport.left == 0.0 || holdViewport.right >= (new Date().getTime())) { previewChart.setCurrentViewport(extendedGraphBuilder.advanceViewport(chart, previewChart)); } else { previewChart.setCurrentViewport(holdViewport); } }
public void setupCharts() { // BG charts updateStuff = false; chart = (LineChartView) findViewById(R.id.chart); chart.setZoomType(ZoomType.HORIZONTAL); previewChart = (PreviewLineChartView) findViewById(R.id.chart_preview); previewChart.setZoomType(ZoomType.HORIZONTAL); chart.setLineChartData(extendedGraphBuilder.lineData()); previewChart.setLineChartData(extendedGraphBuilder.previewLineData()); updateStuff = true; previewChart.setViewportCalculationEnabled(true); chart.setViewportCalculationEnabled(true); previewChart.setViewportChangeListener(new ViewportListener()); chart.setViewportChangeListener(new ChartViewPortListener()); setViewport(); }
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 }
// Updates Stats public static void updateChart() { if (basalvsTempBasalChart != null) { basalvsTempBasalChart.setLineChartData(extendedGraphBuilder.basalvsTempBasalData()); } }
public void displayCurrentInfo() { final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime); final TextView notificationText = (TextView) findViewById(R.id.notices); final TextView deltaText = (TextView) findViewById(R.id.bgDelta); if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) { currentBgValueText.setPaintFlags( currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); } Bg lastBgreading = Bg.last(); if (lastBgreading != null) { notificationText.setText(lastBgreading.readingAge()); String bgDelta = new String(String.format(Locale.ENGLISH, "%.2f", lastBgreading.bgdelta)); if (lastBgreading.bgdelta >= 0) bgDelta = "+" + bgDelta; deltaText.setText(bgDelta); currentBgValueText.setText( extendedGraphBuilder.unitized_string(lastBgreading.sgv_double()) + " " + lastBgreading.slopeArrow()); if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) { notificationText.setTextColor(Color.parseColor("#C30909")); currentBgValueText.setPaintFlags( currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } else { notificationText.setTextColor(Color.WHITE); } double estimate = lastBgreading.sgv_double(); if (extendedGraphBuilder.unitized(estimate) <= extendedGraphBuilder.lowMark) { currentBgValueText.setTextColor(Color.parseColor("#C30909")); } else if (extendedGraphBuilder.unitized(estimate) >= extendedGraphBuilder.highMark) { currentBgValueText.setTextColor(Color.parseColor("#FFBB33")); } else { currentBgValueText.setTextColor(Color.WHITE); } } // Stats age update statsAge = (TextView) findViewById(R.id.statsAge); Stats lastRun = Stats.last(); if (lastRun != null) statsAge.setText(lastRun.statAge()); // OpenAPS age update openAPSAgeTextView = (TextView) findViewById(R.id.openapsAge); openAPSAgeTextView.setText(openAPSFragment.age()); // Temp Basal running update Date timeNow = new Date(); sysMsg = (TextView) findViewById(R.id.sysmsg); TempBasal lastTempBasal = TempBasal.last(); String appStatus; if (lastTempBasal.isactive(null)) { // Active temp Basal appStatus = lastTempBasal.basal_adjustemnt + " Temp active: " + lastTempBasal.rate + "U(" + lastTempBasal.ratePercent + "%) " + lastTempBasal.durationLeft() + "mins left"; } else { // No temp Basal running, show default Double currentBasal = Profile.ProfileAsOf(timeNow, this.getBaseContext()).current_basal; appStatus = "No temp basal, current basal: " + currentBasal + "U"; } sysMsg.setText(appStatus); }