Skip to content

Commit

Permalink
trip open-top size to fit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Cunningham committed Nov 23, 2019
1 parent 4342eaa commit ace12ca
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/client/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var scrolling = false
, scrollRange = null;

var PADDING_BOTTOM = 30
, OPEN_TOP_HEIGHT = 8
, CONTEXT_MAX = 420
, CONTEXT_MIN = 36
, FOCUS_MAX = 510
Expand Down Expand Up @@ -438,7 +439,7 @@ function init (client, d3, $) {
chart.context.append('line')
.attr('class', 'open-top')
.attr('stroke', '#111')
.attr('stroke-width', 12);
.attr('stroke-width', OPEN_TOP_HEIGHT);

// add a x-axis line that closes the the brush container on left side
chart.context.append('line')
Expand Down Expand Up @@ -539,9 +540,9 @@ function init (client, d3, $) {
// transition open-top line to correct location
chart.context.select('.open-top')
.attr('x1', chart.xScale2(currentRange[0]))
.attr('y1', chart.yScale2(utils.scaleMgdl(CONTEXT_MAX)))
.attr('y1', chart.yScale2(utils.scaleMgdl(CONTEXT_MAX)) + Math.floor(OPEN_TOP_HEIGHT/2.0)-1)
.attr('x2', chart.xScale2(currentRange[1]))
.attr('y2', chart.yScale2(utils.scaleMgdl(CONTEXT_MAX)));
.attr('y2', chart.yScale2(utils.scaleMgdl(CONTEXT_MAX)) + Math.floor(OPEN_TOP_HEIGHT/2.0)-1);

// transition open-left line to correct location
chart.context.select('.open-left')
Expand Down Expand Up @@ -621,9 +622,9 @@ function init (client, d3, $) {
// transition open-top line to correct location
chart.context.select('.open-top')
.attr('x1', chart.xScale2(currentRange[0]))
.attr('y1', chart.yScale2(contextYDomain[1]))
.attr('y1', chart.yScale2(contextYDomain[1]) + Math.floor(OPEN_TOP_HEIGHT / 2.0)-1)
.attr('x2', chart.xScale2(currentRange[1]))
.attr('y2', chart.yScale2(contextYDomain[1]));
.attr('y2', chart.yScale2(contextYDomain[1]) + Math.floor(OPEN_TOP_HEIGHT / 2.0)-1);

// transition open-left line to correct location
chart.context.select('.open-left')
Expand Down

0 comments on commit ace12ca

Please sign in to comment.