code: function zoomToFit(kgraph) {
        // scale everything so that it fits the specified size
        var scale = width / kgraph.width || 1;
        var sh = height / kgraph.height || 1;
        if (sh < scale) {
          scale = sh;
        }
        // if a transformation group was specified we
        // perform a 'zoomToFit'
        if (transformGroup) {
          transformGroup.attr("transform", "scale(" + scale + ")");
        }
      }
docs: If a top level transform group is specified,
  we set the scale such that the available
  space is used to its maximum.