commit 84d41c81eb9f4ed5f3aaeb8e7ec3860c98ea4195
parent 01c992395c26ace79d4dc2160c30090da6d7e43f
Author: Andy Khramtsov <>
Date: Sat, 30 May 2026 13:32:30 +0300
feat: touch up figure layout
Diffstat:
2 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/src/deps/assets/styles.css b/src/deps/assets/styles.css
@@ -267,6 +267,11 @@ p {
background-color: var(--c-bg-contrast-hover);
}
+.graph {
+ height: 90vh;
+ height: 90dvh;
+}
+
.hidden {
visibility: hidden;
position: absolute;
diff --git a/src/deps/pages/home.py b/src/deps/pages/home.py
@@ -76,6 +76,16 @@ class NodeFigData:
custom_data: list[str]
+def default_figure_layout() -> go.Layout:
+ return go.Layout(
+ margin=go.layout.Margin(b=0, l=0, r=0, t=30),
+ xaxis=go.layout.XAxis(showgrid=False, zeroline=False, showticklabels=False),
+ yaxis=go.layout.YAxis(showgrid=False, zeroline=False, showticklabels=False),
+ plot_bgcolor=colors.background,
+ uirevision=0,
+ )
+
+
def layout():
return html.Div(
className="padded-box vertical-content vertical-content_large-gap",
@@ -231,18 +241,24 @@ def layout():
),
],
),
- dcc.Loading(
- dcc.Graph(
- id=ids.dependency_graph,
- figure={},
- style={"height": 1000},
- ),
- show_initially=False,
- delay_show=500,
- delay_hide=300,
- fullscreen=True,
+ html.Div(
+ [
+ dcc.Loading(
+ dcc.Graph(
+ className="graph",
+ id=ids.dependency_graph,
+ figure=go.Figure(
+ layout=default_figure_layout(),
+ ),
+ ),
+ show_initially=False,
+ delay_show=500,
+ delay_hide=300,
+ fullscreen=True,
+ ),
+ html.Div(id=ids.selected_node_details),
+ ]
),
- html.Div(id=ids.selected_node_details),
],
),
],
@@ -550,15 +566,12 @@ def draw_graph_figure(
node_scatter_highlight,
],
layout=go.Layout(
+ **default_figure_layout().to_plotly_json(),
showlegend=False,
hovermode="closest",
hoverlabel=go.layout.Hoverlabel(
bgcolor=colors.background,
),
- margin=go.layout.Margin(b=20, l=20, r=20, t=20),
- xaxis=go.layout.XAxis(showgrid=False, zeroline=False, showticklabels=False),
- yaxis=go.layout.YAxis(showgrid=False, zeroline=False, showticklabels=False),
- plot_bgcolor=colors.background,
),
)
@@ -757,13 +770,15 @@ def visualize(inputs, state):
else ""
).split("<br>")
for item in (part, html.Br())
- ]
+ ][:-1]
old_fig = state["figure"]
old_uirevision = old_fig.get("layout", {}).get("uirevision", 0)
fig = draw_graph_figure(df_graph, positions, adjacency_list, selected)
- fig.update_layout(uirevision=old_uirevision + 1 if clean else old_uirevision)
+ fig.update_layout(
+ uirevision=old_uirevision + 1 if clean else old_uirevision,
+ )
return dict(
graph=fig,