Change pie chart font for consistency
This commit is contained in:
+22
-3
@@ -118,7 +118,18 @@ _LOAD_STATE_COLORS = {
|
||||
def plot_load_state_pie(decoded_df, color):
|
||||
"""Render a pie chart showing the distribution of engine load states."""
|
||||
if decoded_df is None or decoded_df.empty or "Engine Load State" not in decoded_df.columns:
|
||||
return px.pie(title="No data for Engine Load State")
|
||||
fig = px.pie()
|
||||
fig.update_layout(
|
||||
title=dict(
|
||||
text="Engine Load State",
|
||||
font=dict(size=14, color="#1a1a1a"),
|
||||
x=0.5, xanchor="center", pad=dict(b=10)
|
||||
),
|
||||
height=280,
|
||||
template="plotly_white",
|
||||
annotations=[dict(text="No data", showarrow=False, x=0.5, y=0.5, font=dict(size=13, color="#888"))]
|
||||
)
|
||||
return fig
|
||||
|
||||
states = pd.to_numeric(decoded_df["Engine Load State"], errors="coerce").dropna().astype(int)
|
||||
|
||||
@@ -135,7 +146,6 @@ def plot_load_state_pie(decoded_df, color):
|
||||
values="Count",
|
||||
names="Legend",
|
||||
color="State",
|
||||
title="Engine Load State Distribution",
|
||||
color_discrete_map=_LOAD_STATE_COLORS,
|
||||
)
|
||||
|
||||
@@ -145,7 +155,16 @@ def plot_load_state_pie(decoded_df, color):
|
||||
domain={"x": [0.05, 0.55], "y": [0.05, 0.95]},
|
||||
)
|
||||
fig.update_layout(
|
||||
margin=dict(l=0, r=10, t=40, b=0),
|
||||
title=dict(
|
||||
text="Engine Load State",
|
||||
font=dict(size=14, color="#1a1a1a"),
|
||||
x=0.5, xanchor="center", pad=dict(b=10)
|
||||
),
|
||||
height=280,
|
||||
autosize=True,
|
||||
template="plotly_white",
|
||||
margin=dict(l=20, r=20, t=55, b=45),
|
||||
font=dict(family="Segoe UI, Arial, sans-serif", size=11, color="#2a2a2a"),
|
||||
legend=dict(x=0.6, y=0.5),
|
||||
)
|
||||
return fig
|
||||
|
||||
Reference in New Issue
Block a user