Add custom plotting support for vehicle signal

- Plot pie chart for engine load state
This commit is contained in:
2026-07-23 15:37:50 +02:00
parent 0eac7a571f
commit 89a9124a83
2 changed files with 94 additions and 8 deletions
+13 -6
View File
@@ -410,12 +410,10 @@ def update_corr(method, target, vehicle, bus, tab):
Input('vehicles-vehicle-selector', 'value')
)
def render_vehicles(vehicle):
"""Render small graph boxes for every decoded signal, combining both buses."""
if not vehicle or vehicle not in DATA:
return html.Div("No data available", className="text-muted")
brand = VEHICLE_META.get(vehicle, {}).get("brand", "")
vehicle_module = get_vehicle_module(brand)
dfs = []
@@ -431,13 +429,22 @@ def render_vehicles(vehicle):
df = df.sort_values('Timestamp', kind='stable').reset_index(drop=True)
cards = []
for nid, frame_def in vehicle_module.DECODER_RULES.items():
decoded = vehicle_module.decode_dataframe(df, frame_def.can_id)
for sig in frame_def.signals:
unit_str = f" ({sig.unit})" if sig.unit else ""
title = f"{frame_def.can_id} - {sig.name}{unit_str}"
fig = vehicle_module.plot_signal(decoded, sig.name, title=title, color=frame_def.color)
for item in frame_def.signals:
if hasattr(item, 'plot_func') and callable(item.plot_func):
title = f"{frame_def.can_id} - {item.name}"
fig = item.plot_func(decoded, frame_def.color)
else:
sig = item
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}"
fig = vehicle_module.plot_signal(decoded, sig.name, title=title, color=frame_def.color)
card = dbc.Card([
dbc.CardBody([