5252 */
5353
5454var VizConstants = {
55- svgMarginX : 20 ,
56- svgMarginY : 20 ,
55+ svgMarginX : 16 ,
56+ svgMarginY : 16 ,
5757 stageSep : 50 ,
5858 graphPrefix : "graph_" ,
5959 nodePrefix : "node_" ,
@@ -63,14 +63,14 @@ var VizConstants = {
6363} ;
6464
6565var JobPageVizConstants = {
66- clusterLabelSize : 11 ,
66+ clusterLabelSize : 12 ,
6767 stageClusterLabelSize : 14
68- }
68+ } ;
6969
7070var StagePageVizConstants = {
7171 clusterLabelSize : 14 ,
72- stageClusterLabelSize : 18
73- }
72+ stageClusterLabelSize : 14
73+ } ;
7474
7575/*
7676 * Show or hide the RDD DAG visualization.
@@ -151,9 +151,9 @@ function renderDagVizForStage(svgContainer) {
151151 var container = svgContainer . append ( "g" ) . attr ( "id" , containerId ) ;
152152 renderDot ( dot , container ) ;
153153
154- // Round corners on RDDs
154+ // Round corners on rectangles
155155 svgContainer
156- . selectAll ( "g.node rect" )
156+ . selectAll ( "rect" )
157157 . attr ( "rx" , "5" )
158158 . attr ( "ry" , "5" ) ;
159159}
@@ -209,6 +209,12 @@ function renderDagVizForJob(svgContainer) {
209209 // Actually render the stage
210210 renderDot ( dot , container ) ;
211211
212+ // Round corners on rectangles
213+ container
214+ . selectAll ( "rect" )
215+ . attr ( "rx" , "4" )
216+ . attr ( "ry" , "4" ) ;
217+
212218 // If there are any incoming edges into this graph, keep track of them to render
213219 // them separately later. Note that we cannot draw them now because we need to
214220 // put these edges in a separate container that is on top of all stage graphs.
@@ -248,12 +254,13 @@ function metadataContainer() { return d3.select("#dag-viz-metadata"); }
248254 * In general, the clustering support for dagre-d3 is quite limited at this point.
249255 */
250256function drawClusterLabels ( svgContainer , forJob ) {
257+ var clusterLabelSize , stageClusterLabelSize ;
251258 if ( forJob ) {
252- var clusterLabelSize = JobPageVizConstants . clusterLabelSize ;
253- var stageClusterLabelSize = JobPageVizConstants . stageClusterLabelSize ;
259+ clusterLabelSize = JobPageVizConstants . clusterLabelSize ;
260+ stageClusterLabelSize = JobPageVizConstants . stageClusterLabelSize ;
254261 } else {
255- var clusterLabelSize = StagePageVizConstants . clusterLabelSize ;
256- var stageClusterLabelSize = StagePageVizConstants . stageClusterLabelSize ;
262+ clusterLabelSize = StagePageVizConstants . clusterLabelSize ;
263+ stageClusterLabelSize = StagePageVizConstants . stageClusterLabelSize ;
257264 }
258265 svgContainer . selectAll ( "g.cluster" ) . each ( function ( ) {
259266 var cluster = d3 . select ( this ) ;
@@ -283,7 +290,7 @@ function drawClusterLabel(d3cluster, fontSize) {
283290 . attr ( "x" , labelX )
284291 . attr ( "y" , labelY )
285292 . attr ( "text-anchor" , "end" )
286- . style ( "font-size" , fontSize )
293+ . style ( "font-size" , fontSize + "px" )
287294 . text ( labelText ) ;
288295}
289296
@@ -303,12 +310,12 @@ function resizeSvg(svg) {
303310 } ) ) ;
304311 var endX = VizConstants . svgMarginX +
305312 toFloat ( d3 . max ( allClusters , function ( e ) {
306- var t = d3 . select ( e )
313+ var t = d3 . select ( e ) ;
307314 return getAbsolutePosition ( t ) . x + toFloat ( t . attr ( "width" ) ) ;
308315 } ) ) ;
309316 var endY = VizConstants . svgMarginY +
310317 toFloat ( d3 . max ( allClusters , function ( e ) {
311- var t = d3 . select ( e )
318+ var t = d3 . select ( e ) ;
312319 return getAbsolutePosition ( t ) . y + toFloat ( t . attr ( "height" ) ) ;
313320 } ) ) ;
314321 var width = endX - startX ;
@@ -338,7 +345,7 @@ function drawCrossStageEdges(edges, svgContainer) {
338345 if ( ! dagreD3Marker . empty ( ) ) {
339346 svgContainer
340347 . append ( function ( ) { return dagreD3Marker . node ( ) . cloneNode ( true ) ; } )
341- . attr ( "id" , "marker-arrow" )
348+ . attr ( "id" , "marker-arrow" ) ;
342349 svgContainer . selectAll ( "g > path" ) . attr ( "marker-end" , "url(#marker-arrow)" ) ;
343350 svgContainer . selectAll ( "g.edgePaths def" ) . remove ( ) ; // We no longer need these
344351 }
@@ -394,12 +401,13 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
394401 toPos . x += delta ;
395402 }
396403
404+ var points ;
397405 if ( fromPos . y == toPos . y ) {
398406 // If they are on the same rank, curve the middle part of the edge
399407 // upward a little to avoid interference with things in between
400408 // e.g. _______
401409 // _____/ \_____
402- var points = [
410+ points = [
403411 [ fromPos . x , fromPos . y ] ,
404412 [ fromPos . x + ( toPos . x - fromPos . x ) * 0.2 , fromPos . y ] ,
405413 [ fromPos . x + ( toPos . x - fromPos . x ) * 0.3 , fromPos . y - 20 ] ,
@@ -413,7 +421,7 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
413421 // /
414422 // |
415423 // _____/
416- var points = [
424+ points = [
417425 [ fromPos . x , fromPos . y ] ,
418426 [ fromPos . x + ( toPos . x - fromPos . x ) * 0.4 , fromPos . y ] ,
419427 [ fromPos . x + ( toPos . x - fromPos . x ) * 0.6 , toPos . y ] ,
0 commit comments