Skip to content

Commit

Permalink
Fix issue speced#8
Browse files Browse the repository at this point in the history
  • Loading branch information
almossawi committed May 5, 2014
1 parent fb43c75 commit 663c88e
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions js/metrics_graphics.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var moz = {};
moz.defaults = {};
moz.defaults.all = {
Expand Down Expand Up @@ -110,27 +112,27 @@ function moz_chart() {
.attr('text-anchor', 'end')
.text(num(d3.round(args.goal)));
}

var line = d3.svg.line()
.x(args.scalefns.xf)
.y(args.scalefns.yf)
.interpolate('cardinal');

var area = d3.svg.area()
.x(args.scalefns.xf)
.y0(args.scales.Y(0))
.y1(args.scalefns.yf)
.interpolate('cardinal');


// main area
if (args.area) {
var area = d3.svg.area()
.x(args.scalefns.xf)
.y0(args.scales.Y(0))
.y1(args.scalefns.yf)
.interpolate('cardinal');

svg.append('path')
.attr('class', 'main-area')
.attr('d', area(args.data))
.attr('fill', args.area);
}

// main line
var line = d3.svg.line()
.x(args.scalefns.xf)
.y(args.scalefns.yf)
.interpolate('cardinal');

svg.append('path')
.attr('class', 'main-line')
.attr('d', line(args.data))
Expand Down Expand Up @@ -220,7 +222,7 @@ function moz_chart() {
return args.area;
});

var yax_format;
var yax_format; // currently, {count, percentage}
if (args.type == 'count') {
yax_format = function(f) {
var pf = d3.formatPrefix(f);
Expand Down Expand Up @@ -342,7 +344,8 @@ function moz_chart() {
function goal_over(svg, args) {
return function(d, i) {
d3.selectAll('circle')
.attr('opacity', 0).filter(function(g, j) {
.attr('opacity', 0)
.filter(function(g, j) {
return d == g;
})
.attr('opacity', 0.85);
Expand Down Expand Up @@ -378,9 +381,12 @@ function goal_over(svg, args) {
.attr('x', args.width - args.right + 4)
.attr('y', args.top / 2)
.attr('text-anchor', 'end')
.text(fmt(dd) + ' ' + num(d[args.y_accessor]));
.text(function() {
return fmt(dd) + ' ' + num(d[args.y_accessor])
});
}
}

// nohup make ARGS="scripts/downloads_daily.py outData/2014-04-01.csv
// /data/weblogs/v2_raw/download-stats.mozilla.org/2014-04-01" hadoop &

Expand Down

0 comments on commit 663c88e

Please sign in to comment.