Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.

Commit ad3acd8

Browse files
Optimize the screen space for dependencyBrowseGraph
1 parent 221e5fb commit ad3acd8

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/main/resources/graph.html

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@
3737
<script src="dependencies.dot.js"></script>
3838

3939
<style>
40-
svg {
41-
border: 1px solid #999;
40+
body {
41+
margin: 0;
4242
overflow: hidden;
4343
}
44-
4544
.node {
4645
white-space: nowrap;
4746
}
@@ -76,8 +75,6 @@
7675

7776
<body onLoad="initialize()">
7877

79-
<h1>Dependencies</h1>
80-
8178
<svg width=1280 height=1024>
8279
<g/>
8380
</svg>
@@ -91,28 +88,20 @@ <h1>Dependencies</h1>
9188
inner.attr("transform", "translate(" + d3.event.translate + ")" +
9289
"scale(" + d3.event.scale + ")");
9390
});
91+
svg.attr("width", window.innerWidth);
92+
9493
svg.call(zoom);
9594
// Create and configure the renderer
9695
var render = dagreD3.render();
9796
function tryDraw(inputGraph) {
9897
var g;
9998
{
10099
g = graphlibDot.read(inputGraph);
101-
// Set margins, if not present
102-
if (!g.graph().hasOwnProperty("marginx") &&
103-
!g.graph().hasOwnProperty("marginy")) {
104-
g.graph().marginx = 20;
105-
g.graph().marginy = 20;
106-
g.graph().rankdir = "LR";
107-
}
108-
g.graph().transition = function(selection) {
109-
return selection.transition().duration(500);
110-
};
111-
// Render the graph into svg g
100+
g.graph().rankdir = "LR";
112101
d3.select("svg g").call(render, g);
113102

114103
// Center the graph
115-
var initialScale = 0.75;
104+
var initialScale = 0.10;
116105
zoom
117106
.translate([(svg.attr("width") - g.graph().width * initialScale) / 2, 20])
118107
.scale(initialScale)

0 commit comments

Comments
 (0)