You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2014/12/18 13:13:38 UTC

[6/9] stratos git commit: application topology zoom option added

application topology zoom option added


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d902418e
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d902418e
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d902418e

Branch: refs/heads/master
Commit: d902418e6828eee4cf21dbf951421efd0229e9da
Parents: 228dd18
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Thu Dec 18 13:46:07 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Thu Dec 18 17:43:21 2014 +0530

----------------------------------------------------------------------
 .../theme0/partials/applications_topology.hbs       | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d902418e/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_topology.hbs
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_topology.hbs b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_topology.hbs
index 18aa9ce..463dd21 100644
--- a/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_topology.hbs
+++ b/components/org.apache.stratos.manager.console/console/themes/theme0/partials/applications_topology.hbs
@@ -120,23 +120,29 @@ $(document).ready(function () {
 // ************** Generate the tree diagram	 *****************
     var margin = {top: 40, right: 120, bottom: 20, left: 120},
             width = 960 - margin.right - margin.left,
-            height = 500 - margin.top - margin.bottom;
+            height = 900 - margin.top - margin.bottom;
 
     var i = 0;
 
     var tree = d3.layout.tree()
-            .size([height, width]);
+            .separation(function(a, b) { return ((a.parent == root) && (b.parent == root)) ? 5 : 4; })
+            .size([height+100, width]);
 
     var diagonal = d3.svg.diagonal()
             .projection(function (d) {
                 return [d.x, d.y];
             });
+    function redraw() {
+        svg.attr("transform",
+                        "translate(" + d3.event.translate + ")"
+                        + " scale(" + d3.event.scale + ")");
+    }
 
     var svg = d3.select(".application-topology").append("svg")
             .attr("width", width + margin.right + margin.left)
             .attr("height", height + margin.top + margin.bottom)
-            .append("g")
-            .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+            .call(d3.behavior.zoom().on("zoom", redraw))
+            .append("g");
 
     var i = 0;
     duration = 750;
@@ -153,7 +159,7 @@ $(document).ready(function () {
 
         // Normalize for fixed-depth.
         nodes.forEach(function (d) {
-            d.y = d.depth * 80;
+            d.y = d.depth * 100;
         });
 
         // Declare the nodes…