mma-server/src/main/resources/com/aliyun/odps/mma/server/ui/static/dag-viz.js
/*
 * Helper function to size the SVG appropriately such that all elements are displayed.
 * This assumes that all outermost elements are clusters (rectangles).
 */
Helper function to size the SVG appropriately such that all elements are displayed.
This assumes that all outermost elements are clusters (rectangles).
Helper function to size the SVG appropriately such that all elements are displayed . This assumes that all outermost elements are clusters ( rectangles ) .
function resizeSvg(svg) {
  var allClusters = svg.selectAll("g.cluster rect")[0];
  var startX = -VizConstants.svgMarginX +
      toFloat(d3.min(allClusters, function(e) {
        return getAbsolutePosition(d3.select(e)).x;
      }));
  var startY = -VizConstants.svgMarginY +
      toFloat(d3.min(allClusters, function(e) {
        return getAbsolutePosition(d3.select(e)).y;
      }));
  var endX = VizConstants.svgMarginX +
      toFloat(d3.max(allClusters, function(e) {
        var t = d3.select(e);
        return getAbsolutePosition(t).x + toFloat(t.attr("width"));
      }));
  var endY = VizConstants.svgMarginY +
      toFloat(d3.max(allClusters, function(e) {
        var t = d3.select(e);
        return getAbsolutePosition(t).y + toFloat(t.attr("height"));
      }));
  var width = endX - startX;
  var height = endY - startY;
  svg.attr("viewBox", startX + " " + startY + " " + width + " " + height)
  .attr("width", width)
  .attr("height", height);
}
function resizeSvg ( svg ) { var allClusters = svg . selectAll ( "g.cluster rect" ) [ 0 ] ; var startX = - VizConstants . svgMarginX + toFloat ( d3 . min ( allClusters , function ( e ) { return getAbsolutePosition ( d3 . select ( e ) ) . x ; } ) ) ; var startY = - VizConstants . svgMarginY + toFloat ( d3 . min ( allClusters , function ( e ) { return getAbsolutePosition ( d3 . select ( e ) ) . y ; } ) ) ; var endX = VizConstants . svgMarginX + toFloat ( d3 . max ( allClusters , function ( e ) { var t = d3 . select ( e ) ; return getAbsolutePosition ( t ) . x + toFloat ( t . attr ( "width" ) ) ; } ) ) ; var endY = VizConstants . svgMarginY + toFloat ( d3 . max ( allClusters , function ( e ) { var t = d3 . select ( e ) ; return getAbsolutePosition ( t ) . y + toFloat ( t . attr ( "height" ) ) ; } ) ) ; var width = endX - startX ; var height = endY - startY ; svg . attr ( "viewBox" , startX + " " + startY + " " + width + " " + height ) . attr ( "width" , width ) . attr ( "height" , height ) ; }
Helper function to size the SVG appropriately such that all elements are displayed.
Helper function to size the SVG appropriately such that all elements are displayed .