Skip to content

Commit

Permalink
closes #284 and makes some additional tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hamilton committed Jan 22, 2015
1 parent 22207e3 commit 9adb85e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 19 deletions.
10 changes: 10 additions & 0 deletions dist/metricsgraphics.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,16 @@
opacity: 0.9;
}

.mg-missing-background {
stroke-width:2;
stroke-opacity:0.05;
stroke-dasharray:10,5;
fill:none;
stroke:blue;
rx:15;
ry:15;
}

.mg-missing .mg-main-line {
opacity: 0.1;
}
Expand Down
27 changes: 17 additions & 10 deletions dist/metricsgraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@
};

defaults.missing = {
top: 0,
bottom: 0,
right: 0,
left: 0,
buffer: 8,
top: 40, // the size of the top margin
bottom: 30, // the size of the bottom margin
right: 10, // size of the right margin
left: 10, // size of the left margin
buffer: 8, // the buffer between the actual chart area and the margins
legend_target: '',
width: 350,
height: 220,
Expand Down Expand Up @@ -2409,7 +2409,7 @@
svg.append('path')
.attr('class', 'mg-confidence-band')
.attr('d', confidence_area(args.data[i]))
.attr('clip-path', 'url(#mg-plot-window-'+ mg_strip_punctuation(args.target)+')');
.attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
}

//add the area
Expand Down Expand Up @@ -2453,12 +2453,12 @@
.transition()
.duration(1000)
.attr('d', line(args.data[i]))
.attr('clip-path', 'url(#mg-plot-window-'+mg_strip_punctuation(args.target)+')');
.attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
} else { //or just add the line
svg.append('path')
.attr('class', 'mg-main-line ' + 'mg-line' + (line_id) + '-color')
.attr('d', line(args.data[i]))
.attr('clip-path', 'url(#mg-plot-window-'+mg_strip_punctuation(args.target)+')');
.attr('clip-path', 'url(#mg-plot-window-' + mg_strip_punctuation(args.target) + ')');
}
}

Expand Down Expand Up @@ -4062,7 +4062,7 @@
.attr('height', args.height);

var svg = d3.select(args.target).select('svg');

// has the width or height changed?
if (args.width !== Number(svg.attr('width'))) {
svg.attr('width', args.width);
Expand Down Expand Up @@ -4096,7 +4096,7 @@

args.scales.Y = d3.scale.linear()
.domain([-2, 2])
.range([args.height - args.bottom - args.buffer, args.top]);
.range([args.height - args.bottom - args.buffer*2, args.top]);

args.scalefns.xf = function(di) { return args.scales.X(di.x); };
args.scalefns.yf = function(di) { return args.scales.Y(di.y); };
Expand All @@ -4114,6 +4114,13 @@

var g = svg.append('g')
.attr('class', 'mg-missing-pane');

g.append('svg:rect')
.classed('mg-missing-background', true)
.attr('x', args.buffer)
.attr('y', args.buffer)
.attr('width', args.width-args.buffer*2)
.attr('height', args.height-args.buffer*2);

g.append('path')
.attr('class', 'mg-main-line mg-line1-color')
Expand Down
4 changes: 2 additions & 2 deletions dist/metricsgraphics.min.js

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/js/charts/missing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ charts.missing = function(args) {
.attr('height', args.height);

var svg = d3.select(args.target).select('svg');

// has the width or height changed?
if (args.width !== Number(svg.attr('width'))) {
svg.attr('width', args.width);
Expand Down Expand Up @@ -46,7 +46,7 @@ charts.missing = function(args) {

args.scales.Y = d3.scale.linear()
.domain([-2, 2])
.range([args.height - args.bottom - args.buffer, args.top]);
.range([args.height - args.bottom - args.buffer*2, args.top]);

args.scalefns.xf = function(di) { return args.scales.X(di.x); };
args.scalefns.yf = function(di) { return args.scales.Y(di.y); };
Expand All @@ -64,6 +64,13 @@ charts.missing = function(args) {

var g = svg.append('g')
.attr('class', 'mg-missing-pane');

g.append('svg:rect')
.classed('mg-missing-background', true)
.attr('x', args.buffer)
.attr('y', args.buffer)
.attr('width', args.width-args.buffer*2)
.attr('height', args.height-args.buffer*2);

g.append('path')
.attr('class', 'mg-main-line mg-line1-color')
Expand Down
10 changes: 5 additions & 5 deletions src/js/common/data_graphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ MG.data_graphic = function() {
};

defaults.missing = {
top: 0,
bottom: 0,
right: 0,
left: 0,
buffer: 8,
top: 40, // the size of the top margin
bottom: 30, // the size of the bottom margin
right: 10, // size of the right margin
left: 10, // size of the left margin
buffer: 8, // the buffer between the actual chart area and the margins
legend_target: '',
width: 350,
height: 220,
Expand Down

0 comments on commit 9adb85e

Please sign in to comment.