diff --git a/lib/client/renderer.js b/lib/client/renderer.js index 6e085f31460..b52d96c510d 100644 --- a/lib/client/renderer.js +++ b/lib/client/renderer.js @@ -3,7 +3,7 @@ var _ = require('lodash'); var times = require('../times'); -var DEFAULT_FOCUS = times.hours(3).msecs +var DEFAULT_FOCUS = times.hours(4).msecs , WIDTH_SMALL_DOTS = 420 , WIDTH_BIG_DOTS = 800 , TOOLTIP_TRANS_MS = 100 // milliseconds @@ -23,7 +23,7 @@ function init (client, d3) { } function focusRangeAdjustment ( ) { - return client.foucusRangeMS === DEFAULT_FOCUS ? 1 : 1 + ((client.foucusRangeMS - DEFAULT_FOCUS) / DEFAULT_FOCUS / 8); + return client.focusRangeMS === DEFAULT_FOCUS ? 1 : 1 + ((client.focusRangeMS - DEFAULT_FOCUS) / DEFAULT_FOCUS / 8); } var dotRadius = function(type) { @@ -74,6 +74,9 @@ function init (client, d3) { return client.settings.showForecast.indexOf(point.info.type) > -1; }); var maxForecastMills = _.max(_.map(shownForecastPoints, function (point) {return point.mills})); + // limit lookahead to the same as lookback + var focusHoursAheadMills = chart().brush.extent()[1].getTime() + client.focusRangeMS; + maxForecastMills = Math.min(focusHoursAheadMills, maxForecastMills); client.forecastTime = maxForecastMills > 0 ? maxForecastMills - client.sbx.lastSGVMills() : 0; focusData = focusData.concat(shownForecastPoints); } @@ -431,8 +434,10 @@ function init (client, d3) { arc_data[1].element = arc_data[1].element + " " + treatment.foodType; } - if (treatment.insulin > 0) { - arc_data[3].element = Math.round(treatment.insulin * 100) / 100 + ' U'; + if ( treatment.insulin > 0) { + // remove leading zeros to avoid overlap with adjacent boluses + var units = Math.round(treatment.insulin * 100)/100; + arc_data[3].element = (units+"").replace(/^0/,""); } if (treatment.status) {