Skip to content

Commit 9705dde

Browse files
committed
HTML preview now reflects the fill_percent param settings
1 parent b149e0d commit 9705dde

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

plotly/dashboard_objs/dashboard_objs.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,13 @@ def _container(box_1=None, box_2=None,
9797
def _draw_line_through_box(dashboard_html, top_left_x, top_left_y, box_w,
9898
box_h, is_horizontal, direction, fill_percent=50):
9999
if is_horizontal:
100-
print 'draw it hori'
101-
print 'fill_percent: {}'.format(fill_percent)
102-
print (fill_percent / 100.)
103-
new_top_left_x = box_w * (fill_percent / 100.)
104-
print new_top_left_x
100+
new_top_left_x = top_left_x + box_w * (fill_percent / 100.)
105101
new_top_left_y = top_left_y
106102
new_box_w = 1
107103
new_box_h = box_h
108104
else:
109105
new_top_left_x = top_left_x
110-
new_top_left_y = top_left_y + box_h / 2
106+
new_top_left_y = top_left_y + box_h * (fill_percent / 100.)
111107
new_box_w = box_w
112108
new_box_h = 1
113109

@@ -364,7 +360,6 @@ def get_preview(self):
364360
current_box_specs = path_to_box_specs[path]
365361

366362
if self._path_to_box(path)['type'] == 'split':
367-
print path
368363
fill_percent = self._path_to_box(path)['size']
369364
direction = self._path_to_box(path)['direction']
370365
is_horizontal = (direction == 'horizontal')
@@ -385,7 +380,7 @@ def get_preview(self):
385380
print 'is horizontal'
386381
new_top_left_x = top_left_x
387382
new_top_left_y = top_left_y
388-
new_box_w = box_w * ((fill_percent) / 100.)
383+
new_box_w = box_w * (fill_percent / 100.)
389384
new_box_h = box_h
390385

391386
new_top_left_x_2 = top_left_x + new_box_w
@@ -394,15 +389,15 @@ def get_preview(self):
394389
new_box_h_2 = box_h
395390
else:
396391
print 'is vertical'
397-
#new_box_w = box_w
398-
#new_box_h = box_h / 2
399-
#new_top_left_x = top_left_x
400-
#new_top_left_y = top_left_y + box_h / 2
401-
392+
new_top_left_x = top_left_x
393+
new_top_left_y = top_left_y
402394
new_box_w = box_w
403395
new_box_h = box_h * (fill_percent / 100.)
404-
new_top_left_x = top_left_x
405-
new_top_left_y = top_left_y + box_h * (fill_percent / 100.)
396+
397+
new_top_left_x_2 = top_left_x
398+
new_top_left_y_2 = top_left_y + box_h * (fill_percent / 100.)
399+
new_box_w_2 = box_w
400+
new_box_h_2 = box_h * ((100 - fill_percent) / 100.)
406401

407402
first_box_specs = {
408403
'top_left_x': top_left_x,

0 commit comments

Comments
 (0)