Skip to content

Commit

Permalink
make R3/R4 elements into very short arcs to reposition labels
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleibrand committed Oct 9, 2017
1 parent 0d222d4 commit 08e4aa9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,9 @@ function init (client, d3) {

var R1 = Math.sqrt(Math.min(carbs, insulin * CR)) / opts.scale
, R2 = Math.sqrt(Math.max(carbs, insulin * CR)) / opts.scale
// R3 seems redundant to R4
, R3 = R2 + 1 / opts.scale
// R4 is solely used to make a bigger tooltip and drag-treament target
, R4 = R2 + 2 / opts.scale
, R3 = R2 + 8 / opts.scale
// R4 determines how far from the treatment dot the labels are placed
, R4 = R2 + 25 / opts.scale
;

return {
Expand All @@ -415,9 +414,10 @@ function init (client, d3) {
{ 'element': '', 'color': 'white', 'start': -1.5708, 'end': 1.5708, 'inner': 0, 'outer': radius.R1 },
{ 'element': '', 'color': 'transparent', 'start': -1.5708, 'end': 1.5708, 'inner': radius.R2, 'outer': radius.R3 },
{ 'element': '', 'color': '#0099ff', 'start': 1.5708, 'end': 4.7124, 'inner': 0, 'outer': radius.R1 },
// these form a transparent semicircle along the bottom of an insulin treatment as a tooltip target
{ 'element': '', 'color': 'transparent', 'start': 1.5708, 'end': 4.7124, 'inner': radius.R2, 'outer': radius.R3 },
{ 'element': '', 'color': 'transparent', 'start': 1.5708, 'end': 4.7124, 'inner': radius.R2, 'outer': radius.R4 }
// these form a very short transparent art along the bottom of an insulin treatment to position the label
// these used to be semicircles from 1.5708 to 4.7124, but that made the tooltip target too big
{ 'element': '', 'color': 'transparent', 'start': 3.1400, 'end': 3.1432, 'inner': radius.R2, 'outer': radius.R3 },
{ 'element': '', 'color': 'transparent', 'start': 3.1400, 'end': 3.1432, 'inner': radius.R2, 'outer': radius.R4 }
];

arc_data[0].outlineOnly = !treatment.carbs;
Expand Down Expand Up @@ -839,7 +839,7 @@ function init (client, d3) {
.style('fill', 'white');

label.append('text')
.style('font-size', 30 / opts.scale)
.style('font-size', 25 / opts.scale)
.style('text-shadow', '0px 0px 10px rgba(0, 0, 0, 1)')
.attr('text-anchor', 'middle')
.attr('dy', '.35em')
Expand Down

0 comments on commit 08e4aa9

Please sign in to comment.