@@ -337,10 +337,17 @@ def get_output_layout(register: Callable) -> dcc.Graph:
337337 dcc.Graph
338338 The layouts for the output block.
339339 """
340- return dcc .Graph (
341- register ("graph" , "figure" ),
342- style = {"height" : config .FIGURE_HEIGHT },
343- config = {"toImageButtonOptions" : {"scale" : config .FIGURE_DOWNLOAD_SCALE }},
340+ return html .Div (
341+ dcc .Graph (
342+ register ("graph" , "figure" ),
343+ config = {"toImageButtonOptions" : {"scale" : config .FIGURE_DOWNLOAD_SCALE }},
344+ style = {"width" : "1200px" , "height" : "800px" },
345+ ),
346+ style = {
347+ "overflowX" : "scroll" ,
348+ "overflowY" : "scroll" ,
349+ "height" : "500px" ,
350+ },
344351 )
345352
346353 @staticmethod
@@ -430,17 +437,26 @@ def load_outputs(run, inputs, outputs) -> go.Figure: # type: ignore
430437 colorscale = "aggrnyl" ,
431438 )
432439
440+ # Margin size is dynamically computed depending on the length of the labels
441+ char_width_px = 8
442+ max_label_length = max ([len (label ) for label in data .keys ()])
443+ top_margin = max_label_length * char_width_px
444+ left_margin = max_label_length * char_width_px
445+
433446 figure = go .Figure (
434447 data = go .Parcoords (
435448 line = line ,
436449 dimensions = list ([d for d in data .values ()]),
437- labelangle = 45 ,
450+ labelangle = 30 ,
438451 ),
439452 layout = dict (
440- margin = dict (t = 150 , b = 50 , l = 100 , r = 0 ),
453+ margin = dict (t = top_margin , b = 50 , l = left_margin , r = 0 ),
441454 font = dict (size = config .FIGURE_FONT_SIZE ),
442455 ),
443456 )
457+
458+ figure .update_layout (width = max (1000 , len (list ([d for d in data .values ()])) * 100 ))
459+
444460 save_image (figure , "parallel_coordinates.pdf" )
445461
446462 return figure
0 commit comments