Skip to content

Commit

Permalink
Make all plots dynamic by width
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed May 11, 2023
1 parent d32cf0f commit 4ae732d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions distributed/dashboard/components/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3411,8 +3411,14 @@ def handle_selector_chng(attr, old, new):
self.root = column(
self.function_selector,
self.unit_selector,
row([self.task_exec_by_prefix_chart, self.task_exec_by_activity_chart]),
row([self.senddata_by_activity_chart]),
row(
[
self.task_exec_by_prefix_chart,
self.task_exec_by_activity_chart,
self.senddata_by_activity_chart,
],
sizing_mode="stretch_width",
),
sizing_mode="scale_width",
)

Expand Down Expand Up @@ -3510,9 +3516,9 @@ def update(self):
# renderers, but it's needed when new functions and/or activities show up to
# rerender plot
if self.substantial_change:
self.root.children[-2].children[0] = task_exec_barchart
self.root.children[-2].children[1] = task_exec_piechart
self.root.children[-1].children[0] = senddata_piechart
self.root.children[-1].children[0] = task_exec_barchart
self.root.children[-1].children[1] = task_exec_piechart
self.root.children[-1].children[2] = senddata_piechart
self.substantial_change = False
else:
self.task_exec_by_prefix_chart.renderers = task_exec_piechart.renderers
Expand Down Expand Up @@ -3549,6 +3555,7 @@ def _build_task_execution_by_activity_chart(

piechart = figure(
height=500,
sizing_mode="stretch_width",
title="Task execution, by activity",
tools="hover",
tooltips="@{activity}: @text",
Expand Down Expand Up @@ -3577,9 +3584,9 @@ def _build_task_execution_by_prefix_chart(
barchart = figure(
x_range=task_exec_data["functions"],
height=500,
sizing_mode="stretch_width",
title="Task execution, by function",
tools="pan,wheel_zoom,box_zoom,reset",
sizing_mode="scale_width",
)
barchart.yaxis.visible = False
barchart.xaxis.major_label_orientation = 0.2
Expand Down Expand Up @@ -3638,6 +3645,7 @@ def _build_senddata_chart(self, senddata: defaultdict[str, list]) -> figure:
self.sendsrc.data = piedata
senddata_piechart = figure(
height=500,
sizing_mode="stretch_width",
title="Send data, by activity",
tools="hover",
tooltips="@{activity}: @text",
Expand Down

0 comments on commit 4ae732d

Please sign in to comment.