added total label with mean
authorForrest Voight <forrest@forre.st>
Tue, 8 May 2012 19:34:07 +0000 (15:34 -0400)
committerForrest Voight <forrest@forre.st>
Tue, 8 May 2012 19:34:07 +0000 (15:34 -0400)
web-static/graphs.html

index 2a49a2d..a17ddc0 100644 (file)
                         });
                     
                     var text_boxes = [];
+                    var total = 0;
                     for(var i = 0; i < lines.length; ++i) {
                         var line = lines[i];
                         var stats = get_area_mean(line.data);
                                 .attr("fill", line.color)
                                 .attr("x", w - margin_h + 10)
                                 .attr("y", y(num/denom))]);
+                            total += stats.mean;
                         }
                     }
+                    text_boxes.push([i, g.append("svg:text")
+                        .text("- Total (mean: " + d3.format(".3s")(total) + unit + ")")
+                        .attr("text-anchor", "start")
+                        .attr("dominant-baseline", "central")
+                        .attr("fill", "black")
+                        .attr("x", w - margin_h + 2)
+                        .attr("y", y(total))]);
                 } else {
                     var y = d3.scale.linear().domain([
                         0,