paper.setDimensions(width, height)

Change dimensions of a paper. Dimensions should always be passed to the options object of the joint.dia.Paper constructor. Use setDimensions() to change dimensions of the paper later on if needed. If the method is called a "resize" event is triggered on the paper.

Type Description
Number Dimension in pixels (e.g 800).
String Dimension as CSS property value (e.g "100%").
Make sure the paper container element has size defined.
// Responsive Paper
var paper = new joint.dia.Paper({ width: '100%', height: '100%' });
window.on('resize', joint.util.debounce(function() {
  paper.scaleContentToFit({ padding: 10 });
}), false);
null No dimension set. Useful when size of the paper controlled in CSS.