Skip to content

Commit

Permalink
Adding additional output options (nightscout#5514)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-dixon committed Feb 12, 2020
1 parent ee97994 commit 03baee0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 11 additions & 7 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ function init (client, d3) {
};
}

function prepareArc (treatment, radius) {
function prepareArc (treatment, radius, renderBasal) {
var arc_data = [
// white carb half-circle on top
{ 'element': '', 'color': 'white', 'start': -1.5708, 'end': 1.5708, 'inner': 0, 'outer': radius.R1 }
Expand Down Expand Up @@ -568,10 +568,13 @@ function init (client, d3) {

if (treatment.insulin > 0) {
var dosage_units = '' + Math.round(treatment.insulin * 100) / 100;

if (renderBasal === 'all-remove-zero') {
dosage_units = (dosage_units + "").replace(/^0/, "");
}

var unit_of_measurement = ' U'; // One international unit of insulin (1 IU) is shown as '1 U'
var enteredBy = '' + treatment.enteredBy;

var unit_of_measurement = (renderBasal === 'all-number' ? '' : ' U'); // One international unit of insulin (1 IU) is shown as '1 U'

arc_data[3].element = dosage_units + unit_of_measurement;
}

Expand Down Expand Up @@ -1001,11 +1004,12 @@ function init (client, d3) {
scale: renderer.bubbleScale()
, showLabels: showLabels
, treatments: treatmentCount
}, client.sbx.data.profile.getCarbRatio(new Date()));
}, client.sbx.data.profile.getCarbRatio(new Date()),
renderBasal);
});
};

renderer.drawTreatment = function drawTreatment (treatment, opts, carbratio) {
renderer.drawTreatment = function drawTreatment (treatment, opts, carbratio, renderBasal) {
if (!treatment.carbs && !treatment.protein && !treatment.fat && !treatment.insulin) {
return;
}
Expand All @@ -1023,7 +1027,7 @@ function init (client, d3) {
return;
}

var arc = prepareArc(treatment, radius);
var arc = prepareArc(treatment, radius, renderBasal);
var treatmentDots = appendTreatments(treatment, arc);
appendLabels(treatmentDots, arc, opts);
};
Expand Down
4 changes: 3 additions & 1 deletion views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,10 @@
<dd>
<select id="bolusrender">
<option class="translate" value="all">All</option>
<option class="translate" value="none">None</option>
<option class="translate" value="all-remove-zero">All (without leading zero)</option>
<option class="translate" value="all-number">All (just the number)</option>
<option class="translate" value="1u">1 U and Over</option>
<option class="translate" value="none">None</option>
</select>
</dd>
</dl>
Expand Down

0 comments on commit 03baee0

Please sign in to comment.