Commit 15309257 authored by Sylvain Schmitz's avatar Sylvain Schmitz

add percentages in mouseover text

parent 9b4486f5
......@@ -41,7 +41,7 @@ var width = 720,
outerRadius = Math.min(width, height) / 2 - 10,
innerRadius = outerRadius - 24;
//var formatPercent = d3.format(".1%");
var formatPercent = d3.format(".1%");
var arc = d3.svg.arc()
.innerRadius(innerRadius)
......@@ -73,11 +73,17 @@ queue()
function ready(error, fragments, matrix) {
if (error) throw error;
// number of entries
// total number of entries
var nentries = 0;
for (let f of fragments)
nentries += parseInt(f.entries);
// maximal number of entries
var maxentries = 0;
for (let f of fragments)
maxentries = (maxentries < parseInt(f.entries))?
parseInt(f.entries): maxentries;
layout.matrix = matrix;
layout.n = matrix.length;
layout.padding = .04;
......@@ -172,7 +178,9 @@ function ready(error, fragments, matrix) {
// Add a mouseover title.
group.append("title").text(function(d, i) {
return fragments[i].name + ": " + fragments[i].entries + " entries";
return fragments[i].name + ": " + fragments[i].entries + " entries" + " ("
+ formatPercent(parseInt(fragments[i].entries) / maxentries)
+ ")";
});
// Add the group arc.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment