Skip to content

Commit 2fbaa21

Browse files
committed
positioning d3 in the beginning
1 parent ec8664a commit 2fbaa21

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/app/components/Chart.jsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,23 @@ class Chart extends Component {
3535
duration=0;
3636

3737
var margin = {top: 20, right: 120, bottom: 20, left: 120},
38-
width = 800 - margin.right - margin.left,
39-
height = 800 - margin.top - margin.bottom;
38+
width = 400 - margin.right - margin.left,
39+
height = 400 - margin.top - margin.bottom;
4040

4141
var i = 0;
4242

4343
var tree = d3.layout.tree()
44-
.size([400, 400]);
44+
.size([height, width]);
4545

4646
var diagonal = d3.svg.diagonal()
4747
.projection(function(d) { return [d.y, d.x]; });
4848

4949
var svg = d3.select(this.refs.anchor).append("svg")
50-
.attr("width", width + margin.right + margin.left)
51-
.attr("height", height + margin.top + margin.bottom)
50+
// .attr("width", width + margin.right + margin.left)
51+
// .attr("height", height + margin.top + margin.bottom)
52+
.attr("width", "100%")
53+
.attr("height","100%")
54+
.attr("preserveAspectRatio", "xMinYMin slice")
5255
.call(d3.behavior.zoom().on("zoom", function () {
5356
svg.attr("transform", "translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")")
5457
}))

src/app/styles/components/_d3Tree.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.d3Container{
2-
overflow: scroll;
32
height: 100%;
43
width: 100%;
54
}

0 commit comments

Comments
 (0)