score:0

another way to solve this is create a constant that takes the height size of the dom and set the constant to the height of options.

const myheight = math.round(parseint(window.innerheight) * 0.7) + 'px';

const options = {
    autoresize: true,
    height: myheight
};

thus, it is possible to control the percentage.

score:1

i suggest the reason that set option width and height 100% not working is that the network is attaching on a div which height and width is not defined, so you could try the code below:

const options = {
  autoresize: ture,
  height: '100%',
  width: '100%'
};

// initialize your network!
class visnetwork extends component {
  constructor() {
  super();
  this.network = {};
  this.appref = createref();
}

componentdidmount() {
  this.network = new network(this.appref.current, data, options);

}




render() {

let containerstyle = {  //define container width and height.
   width:"500px",
   height:"500px",  
}

return (
   <div style={containerstyle} ref={this.appref} />   
);
}
}

export default visnetwork;

if code above doesn't work , i would suggest use this.network.setsize(width, height) to force the canvas to change.


Related Query

More Query from same tag