You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -167,14 +167,15 @@ function History(props: Record<string, unknown>): JSX.Element {
167
167
constmakeD3Tree=()=>{
168
168
constsvg=d3.select(svgRef.current);// d3.select Selects the first element/node that matches svgRef.current. If no element/node match returns an empty selection. If multiple elements/nodes match the selector, only the first matching element/node (in document order) will be selected.
169
169
svg.selectAll('*').remove();// Selects all elements. The elements will be selected in document order (top-to-bottom). We then remove the selected elements/nodes from the DOM. This is important as to ensure that the SVG is empty before rendering the D3 based visualization to avoid interference/overlap with any previously rendered content.
// function that takes in data and turns it into a d3 tree.
173
173
consttreeRoot=d3.hierarchy(data);// 'd3.hierarchy' constructs a root node from the specified hierarchical data.
174
174
returnd3.tree().size([innerWidth,innerHeight])(treeRoot);// d3.tree creates a new tree layout with a size option of innerWidth (~line 41) and innerHeight (~line 42). We specify our new tree layout's root as 'treeRoot' which assigns an x and y property to each node to represent an [x, y] coordinate system.
175
175
};
176
176
177
177
constd3root=tree(root);// create a d3. tree from our root
178
+
console.log('d3root: ',d3root);
178
179
constcurrNode=labelCurrentNode(d3root);// iterate through our nodes and apply a color property
179
180
180
181
constg=svg//serves as a container for the nodes and links within the D3 Visualization of the tree
@@ -306,12 +307,13 @@ function History(props: Record<string, unknown>): JSX.Element {
306
307
};
307
308
308
309
useEffect(()=>{
310
+
console.log('currLocation: ',currLocation);
309
311
makeD3Tree();
310
-
},[root,currLocation]);// if the 'root' or 'currLocation' changes, re-build the D3 Tree
312
+
},[root/*, currLocation*/]);// if the 'root' or 'currLocation' changes, re-build the D3 Tree
311
313
312
-
useEffect(()=>{
313
-
dispatch(setCurrentTabInApp('history'));// dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'webmetrics' to facilitate render.
314
-
},[]);
314
+
// useEffect(() => {
315
+
// dispatch(setCurrentTabInApp('history')); // dispatch sent at initial page load allowing changing "immer's" draft.currentTabInApp to 'webmetrics' to facilitate render.
316
+
// }, []);
315
317
316
318
// then rendering each node in History tab to render using D3, which will share area with LegendKey
0 commit comments