Initial version of language distribution graph
[gitphp.git] / js / modules / languagedistgraph.js
blob:a/js/modules/languagedistgraph.js -> blob:b/js/modules/languagedistgraph.js
--- a/js/modules/languagedistgraph.js
+++ b/js/modules/languagedistgraph.js
@@ -10,10 +10,7 @@
  */
 
 define(["modules/geturl", "modules/getproject", "d3"],
-	function(getUrl, getProject) {
-
-		var url = null;
-		var project = null;
+	function(url, project) {
 
 		var width = 600;
 		var height = 600;
@@ -68,7 +65,8 @@
 			langLabel = centerGroup.append("text")
 				.attr("dy", -25)
 				.attr("font-size", "16")
-				.attr("text-anchor", "middle");
+				.attr("text-anchor", "middle")
+				.style('opacity', 0);
 
 			countLabel = centerGroup.append("text")
 				.attr("dy", 0)
@@ -89,9 +87,6 @@
 
 			arc = d3.svg.arc().innerRadius(innerRadius).outerRadius(radius);
 			grownArc = d3.svg.arc().innerRadius(innerRadius).outerRadius(radius + growRadius);
-
-			url = getUrl();
-			project = getProject();
 
 			d3.json(url + "?p=" + project + "&a=graphdata&g=languagedist", function(data) {
 				var dataEntries = d3.entries(data);
@@ -120,14 +115,14 @@
 						d3.select(this).transition()
 							.duration(250)
 							.attr("d", grownArc);
-						langLabel.text(d.data.key);
+						langLabel.transition().style('opacity', 1).text(d.data.key);
 						countLabel.text(d.data.value);
 					})
 					.on("mouseout", function(d) {
 						d3.select(this).transition()
 							.duration(250)
 							.attr("d", arc);
-						langLabel.text("");
+						langLabel.transition().style('opacity', 0);
 						countLabel.text(count);
 					});
 

comments