Skip to content

Commit 865dc14

Browse files
committed
fixed d3 graph alignment
1 parent 94f6d36 commit 865dc14

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/app/components/Chart.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ class Chart extends Component {
3636

3737
maked3Tree() {
3838
this.removed3Tree();
39-
let width = 960;
40-
let height = 1060;
41-
// const margin = {
42-
// top: 0,
43-
// right: 60,
44-
// bottom: 80,
45-
// left: 120,
46-
// };
39+
let width = 600;
40+
// let height = 1060;
41+
const margin = {
42+
top: 0,
43+
right: 60,
44+
bottom: 80,
45+
left: 120,
46+
};
4747
// const width = 600 - margin.right - margin.left;
48-
// const height = 600 - margin.top - margin.bottom;
48+
const height = 700 - margin.top - margin.bottom;
4949

5050
let chartContainer = d3.select(this.chartRef.current)
5151
.append('svg') // chartContainer is now pointing to svg
@@ -70,7 +70,7 @@ class Chart extends Component {
7070

7171
let tree = d3.tree()
7272
// this assigns width of tree to be 2pi
73-
.size([2 * Math.PI, radius])
73+
.size([2 * Math.PI, radius / 1.5])
7474
.separation(function (a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth });
7575

7676
let d3root = tree(hierarchy);

0 commit comments

Comments
 (0)