Skip to content

Commit eeae75d

Browse files
getting johns pr
1 parent ff173aa commit eeae75d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

app/src/tree/TreeChart.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useRef, useEffect, useContext } from "react";
22
import { select, hierarchy, tree, linkHorizontal } from "d3";
33
import { stateContext } from '../context/context';
4+
5+
// i don't think this does what i need it to do
46
import useResizeObserver from "./useResizeObserver";
57

68
function usePrevious(value) {
@@ -15,6 +17,8 @@ function TreeChart({ data }) {
1517
const [state, dispatch] = useContext(stateContext);
1618
const svgRef = useRef();
1719
const wrapperRef = useRef();
20+
21+
// this needs to be modified
1822
const dimensions = useResizeObserver(wrapperRef);
1923
console.log('dimensions', dimensions);
2024

@@ -33,11 +37,12 @@ function TreeChart({ data }) {
3337

3438
console.log('width', width);
3539
console.log('height', height);
40+
3641
// transform hierarchical data
3742
const root = hierarchy(data[0]);
3843
const treeLayout = tree().size([height, width]);
3944

40-
// Returns a new link generator with horizontal tangents.
45+
// Returns a new link generator with horizontal display.
4146
// To visualize links in a tree diagram rooted on the left edge of the display
4247
const linkGenerator = linkHorizontal()
4348
.x(link => link.y)
@@ -46,7 +51,7 @@ function TreeChart({ data }) {
4651
// insert our data into the tree layout
4752
treeLayout(root);
4853

49-
// nodes - each element in the tree
54+
// node - each element in the tree
5055
svg
5156
.selectAll(".node")
5257
.data(root.descendants())
@@ -62,7 +67,7 @@ function TreeChart({ data }) {
6267
.attr("r", 4) // radius of circle
6368
.attr("opacity", 1);
6469

65-
// links - lines that connect the nodes
70+
// link - lines that connect the nodes
6671
const enteringAndUpdatingLinks = svg
6772
.selectAll(".link")
6873
.data(root.links())

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"connected-react-router": "^6.8.0",
111111
"cookie-parser": "^1.4.5",
112112
"cors": "^2.8.5",
113+
"d3": "^6.2.0",
113114
"electron-debug": "^3.1.0",
114115
"electron-devtools-installer": "^2.2.4",
115116
"electron-splashscreen": "^1.0.0",
@@ -118,9 +119,9 @@
118119
"immutable": "^4.0.0-rc.12",
119120
"js-cookie": "^2.2.1",
120121
"localforage": "^1.7.2",
122+
"node-fetch": "^2.6.0",
121123
"passport": "^0.4.1",
122124
"passport-github2": "^0.1.12",
123-
"node-fetch": "^2.6.0",
124125
"prettier": "^1.19.1",
125126
"prop-types": "^15.6.2",
126127
"react": "^16.13.0",
@@ -129,6 +130,7 @@
129130
"react-dnd-html5-backend": "^11.1.3",
130131
"react-dom": "^16.4.1",
131132
"react-router-dom": "^5.2.0",
133+
"resize-observer-polyfill": "^1.5.1",
132134
"seamless-immutable": "^7.1.4",
133135
"source-map-support": "^0.5.19",
134136
"uuid": "^8.2.0"

0 commit comments

Comments
 (0)