Skip to content

Commit

Permalink
filter to only use actual SGV's (not rawbg's) to set the view window
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleibrand committed Oct 9, 2017
1 parent 08e4aa9 commit 0404f0d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/client/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,16 @@ function init (client, d3, $) {
var contextYDomain = [utils.scaleMgdl(36), utils.scaleMgdl(420)];

function dynamicDomain() {
var mult = 1.3
console.log(client.entries);
// allow y-axis to extend all the way to the top of the basal area, but leave room to display highest value
var mult = 1.15
, targetTop = client.settings.thresholds.bgTargetTop
, mgdlMax = d3.max(client.entries, function (d) { return d.mgdl; });
// filter to only use actual SGV's (not rawbg's) to set the view window.
// can switch to Logarithmic (non-dynamic) to see anything that doesn't fit in the dynamicDomain
, mgdlMax = d3.max(client.entries, function (d) { if ( d.type === 'sgv') { return d.mgdl; } });
// use the 99th percentile instead of max to avoid rescaling for 1 flukey data point
// need to sort client.entries by mgdl first
//, mgdlMax = d3.quantile(client.entries, 0.99, function (d) { return d.mgdl; });

return [
utils.scaleMgdl(30)
Expand Down

0 comments on commit 0404f0d

Please sign in to comment.