Skip to content

Commit b797fd4

Browse files
committed
Yup
1 parent 3fcbbdd commit b797fd4

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/_App/BotAnalysis/Networks/TestGraph.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Spinner from '../../Spinner'
1414

1515
function MyGraph(props){
1616
var height = props.height || 500
17-
var width = props.width || 900
17+
var width = props.width || window.innerWidth * 0.75 // todo:use container ref instead
1818
//var data = props.data
1919
return <span>
2020
<p>Height: {height} Width: {width}</p>
@@ -25,7 +25,7 @@ function MyGraph(props){
2525
export default class NetworkGraph extends PureComponent {
2626
constructor(props) {
2727
super(props)
28-
this.state = {parsedResponse: null, windowSize:""}
28+
this.state = {parsedResponse: null, width: null}
2929
this.containerRef = createRef()
3030
this.handleResize = this.handleResize.bind(this)
3131
}
@@ -38,7 +38,7 @@ export default class NetworkGraph extends PureComponent {
3838
<Spinner/> :
3939

4040
<div ref={this.containerRef}>
41-
<MyGraph width={this.state.windowSize * 0.5}/>
41+
<MyGraph width={this.state.width}/>
4242
</div>
4343
}
4444
</Card.Body>
@@ -58,9 +58,9 @@ export default class NetworkGraph extends PureComponent {
5858
}
5959

6060
handleResize(event){
61-
const windowSize = window.innerWidth // todo:use container ref instead
62-
console.log("RESIZED THE WINDOW!!", windowSize)
63-
this.setState({windowSize: windowSize})
61+
const width = window.innerWidth * 0.75 // todo:use container ref instead
62+
console.log("RESIZED THE WINDOW!!", width)
63+
this.setState({width: width})
6464
}
6565

6666
componentDidUpdate(){

0 commit comments

Comments
 (0)