mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2014-06-24 Alejandro Gallardo <alejandro.gallardo@artica.es>
* include/graphs/pandora.d3.js: Fixed some errors on the graph created by the function "treeMap". git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10279 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a595a55b1b
commit
e9d05381af
@ -1,3 +1,8 @@
|
||||
2014-06-24 Alejandro Gallardo <alejandro.gallardo@artica.es>
|
||||
|
||||
* include/graphs/pandora.d3.js: Fixed some errors on
|
||||
the graph created by the function "treeMap".
|
||||
|
||||
2014-06-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/setup/setup_visuals.php, include/functions_networkmap.php,
|
||||
|
@ -346,7 +346,7 @@ function treeMap(recipient, data, width, height) {
|
||||
// create parent cells
|
||||
var parentCells = chart.selectAll("g.cell.parent")
|
||||
.data(parents, function(d) {
|
||||
return "p-" + d.name;
|
||||
return d.id;
|
||||
});
|
||||
var parentEnterTransition = parentCells.enter()
|
||||
.append("g")
|
||||
@ -405,8 +405,9 @@ function treeMap(recipient, data, width, height) {
|
||||
// create children cells
|
||||
var childrenCells = chart.selectAll("g.cell.child")
|
||||
.data(children, function(d) {
|
||||
return "c-" + d.name;
|
||||
return d.id;
|
||||
});
|
||||
|
||||
// enter transition
|
||||
var childEnterTransition = childrenCells.enter()
|
||||
.append("g")
|
||||
@ -419,11 +420,13 @@ function treeMap(recipient, data, width, height) {
|
||||
.on("mousemove", move_tooltip)
|
||||
.append("svg")
|
||||
.attr("class", "clip");
|
||||
|
||||
childEnterTransition.append("rect")
|
||||
.classed("background", true)
|
||||
.style("fill", function(d) {
|
||||
return color(d.parent.name);
|
||||
return color(d.name);
|
||||
});
|
||||
|
||||
childEnterTransition.append('text')
|
||||
.attr("class", "label")
|
||||
.attr('x', function(d) {
|
||||
@ -438,22 +441,23 @@ function treeMap(recipient, data, width, height) {
|
||||
.text(function(d) {
|
||||
return d.name;
|
||||
});
|
||||
|
||||
// update transition
|
||||
var childUpdateTransition = childrenCells.transition().duration(transitionDuration);
|
||||
|
||||
childUpdateTransition.select(".cell")
|
||||
.attr("transform", function(d) {
|
||||
return "translate(" + d.x + "," + d.y + ")";
|
||||
});
|
||||
|
||||
childUpdateTransition.select("rect")
|
||||
.attr("width", function(d) {
|
||||
return Math.max(0.01, d.dx);
|
||||
})
|
||||
.attr("height", function(d) {
|
||||
return d.dy;
|
||||
})
|
||||
.style("fill", function(d) {
|
||||
return color(d.parent.name);
|
||||
});
|
||||
|
||||
childUpdateTransition.select(".label")
|
||||
.attr('x', function(d) {
|
||||
return d.dx / 2;
|
||||
@ -473,7 +477,6 @@ function treeMap(recipient, data, width, height) {
|
||||
.remove();
|
||||
|
||||
d3.select("select").on("change", function() {
|
||||
console.log("select zoom(node)");
|
||||
treemap.value(this.value == "size" ? size : count)
|
||||
.nodes(root);
|
||||
zoom(node);
|
||||
@ -513,6 +516,7 @@ function treeMap(recipient, data, width, height) {
|
||||
var bgDelta = (components.R * 0.299) + (components.G * 0.587) + (components.B * 0.114);
|
||||
return ((255 - bgDelta) < nThreshold) ? "#000000" : "#ffffff";
|
||||
}
|
||||
|
||||
function zoom(d) {
|
||||
treemap
|
||||
.padding([headerHeight / (chartHeight / d.dy), 0, 0, 0])
|
||||
@ -547,7 +551,7 @@ function zoom(d) {
|
||||
})
|
||||
.select(".label")
|
||||
.style("display", "")
|
||||
.style("fill", function(d) {
|
||||
.style("color", function(d) {
|
||||
return idealTextColor(color(d.parent.name));
|
||||
});
|
||||
}
|
||||
@ -586,9 +590,6 @@ function zoom(d) {
|
||||
})
|
||||
.attr("height", function(d) {
|
||||
return d.children ? headerHeight : Math.max(0.01, (ky * d.dy));
|
||||
})
|
||||
.style("fill", function(d) {
|
||||
return d.children ? headerColor : color(d.parent.name);
|
||||
});
|
||||
|
||||
node = d;
|
||||
|
Loading…
x
Reference in New Issue
Block a user