zavavan commited on
Commit
18a06db
·
verified ·
1 Parent(s): e9e30fc

Update dashboard.py

Browse files
Files changed (1) hide show
  1. dashboard.py +14 -24
dashboard.py CHANGED
@@ -416,32 +416,22 @@ def legend_hook(plot, element):
416
  '''
417
 
418
  def create_overlay_plots(df):
419
-
420
  def move_legend_below(plot, element):
421
  p = plot.state
422
- legends = p.legend
423
- if legends:
424
- leg = legends[0]
425
- #leg.orientation = 'horizontal'
426
- #leg.legend_position = 'top_left'
427
- leg.legend_cols = 8
428
- leg.background_fill_color = 'white'
429
- leg.border_line_color = 'black'
430
- leg.label_text_font_size = '12pt'
431
- leg.label_text_color = 'black'
432
- leg.spacing = 10
433
- leg.margin = 10
434
- leg.label_standoff = 5
435
-
436
- # Number of columns
437
- try:
438
- leg.columns = 8 # works in Bokeh 3.x
439
- except Exception:
440
- pass
441
-
442
- # Remove it from its current location and re-add below
443
- p.legend = []
444
- p.add_layout(leg,'below')
445
 
446
 
447
 
 
416
  '''
417
 
418
  def create_overlay_plots(df):
 
419
  def move_legend_below(plot, element):
420
  p = plot.state
421
+ if p.legend:
422
+ legend = p.legend[0]
423
+ legend.orientation = 'horizontal'
424
+ legend.location = 'center' # center of the below layout, not plot area
425
+ legend.ncols = 8
426
+ legend.background_fill_color = 'white'
427
+ legend.border_line_color = 'black'
428
+ legend.label_text_font_size = '12pt'
429
+ legend.label_text_color = 'black'
430
+ legend.spacing = 10
431
+ legend.margin = 10
432
+ legend.label_standoff = 5
433
+
434
+ p.add_layout(legend, 'below')
 
 
 
 
 
 
 
 
 
435
 
436
 
437