Compare commits
3 Commits
1e5506de50
...
d0141e821f
| Author | SHA1 | Date | |
|---|---|---|---|
| d0141e821f | |||
| 23d7696076 | |||
| 92ff701dab |
@@ -560,7 +560,7 @@ def render_vehicles(vehicle):
|
||||
if getattr(sig, "skip_plot", False):
|
||||
continue
|
||||
unit_str = f" ({sig.unit})" if sig.unit else ""
|
||||
title = f"{frame_def.can_id} - {sig.name}{unit_str}"
|
||||
title = f"{sig.name}{unit_str}"
|
||||
fig = vehicle_module.plot_signal(
|
||||
decoded, sig.name, title=title, color=frame_def.color
|
||||
)
|
||||
|
||||
+26
-7
@@ -42,7 +42,7 @@ load_state_sig.skip_plot = True
|
||||
DECODER_RULES: Dict[str, FrameDef] = {
|
||||
normalize_id("0x011F"): FrameDef(
|
||||
can_id="0x011F",
|
||||
description="Engine ECM Main Broadcast",
|
||||
description="ECM",
|
||||
color="#e41a1c",
|
||||
signals=[
|
||||
SignalDef(
|
||||
@@ -56,7 +56,7 @@ DECODER_RULES: Dict[str, FrameDef] = {
|
||||
unit="RPM",
|
||||
),
|
||||
SignalDef(
|
||||
name="Pressure / Load",
|
||||
name="Engine Load",
|
||||
bit_start=16,
|
||||
bit_length=16,
|
||||
factor=0.05,
|
||||
@@ -69,7 +69,7 @@ DECODER_RULES: Dict[str, FrameDef] = {
|
||||
),
|
||||
normalize_id("0x0CFF3300"): FrameDef(
|
||||
can_id="0x0CFF3300",
|
||||
description="Engine temperature and load state block",
|
||||
description="Engine temperatures",
|
||||
color="#0080fe",
|
||||
signals=[
|
||||
SignalDef(
|
||||
@@ -94,7 +94,7 @@ DECODER_RULES: Dict[str, FrameDef] = {
|
||||
),
|
||||
load_state_sig,
|
||||
CustomPlotDef(
|
||||
name="Engine Load State",
|
||||
name="Engine Load",
|
||||
plot_func=lambda decoded, color: plot_load_state_pie(decoded, color),
|
||||
),
|
||||
],
|
||||
@@ -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