File tree Expand file tree Collapse file tree
src/_App/BotAnalysis/Networks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import Spinner from '../../Spinner'
1414
1515function MyGraph ( props ) {
1616 var height = props . height || 500
17- var width = props . width || window . innerWidth * 0.75 // todo:use container ref instead
18- //var data = props.data
17+ var width = props . width || 300 // todo: use container ref instead
18+
1919 return < span >
2020 < p > Height: { height } Width: { width } </ p >
2121 < svg height = { height } width = { width } style = { { border :"1px solid black" } } > </ svg >
@@ -49,7 +49,10 @@ export default class NetworkGraph extends PureComponent {
4949 componentDidMount ( ) {
5050 console . log ( "COMPONENT DID MOUNT" )
5151 window . addEventListener ( "resize" , this . handleResize )
52- this . setState ( { parsedResponse :"abc123" } )
52+ //const width = this.containerRef.current.clientWidth
53+ this . setState ( { parsedResponse :"abc123" ,
54+ //width: width
55+ } )
5356 }
5457
5558 componentWillUnmount ( ) {
@@ -58,7 +61,8 @@ export default class NetworkGraph extends PureComponent {
5861 }
5962
6063 handleResize ( event ) {
61- const width = window . innerWidth * 0.75 // todo:use container ref instead
64+ const width = this . containerRef . current . clientWidth // window.innerWidth * 0.75
65+ //const width = this.containerRef.current.width
6266 console . log ( "RESIZED THE WINDOW!!" , width )
6367 this . setState ( { width : width } )
6468 }
You can’t perform that action at this time.
0 commit comments