diff --git a/squad-track-duration b/squad-track-duration index 9ec5120..dece84e 100755 --- a/squad-track-duration +++ b/squad-track-duration @@ -14,6 +14,7 @@ import os import sys from datetime import datetime, timedelta from pathlib import Path +from dash import Dash, html, dcc import pandas as pd import plotly.express as px @@ -28,6 +29,7 @@ logger = logging.getLogger(__name__) ARTIFACTORIAL_FILENAME = "builds.json" +app = Dash(__name__) class MetaFigure: def __init__(self, plotly_fig, title, description): @@ -340,22 +342,20 @@ def run(): count_per_device1, on="device", how="inner", suffixes=("_1", "_2") ) - # Create the figure to display this data - figure_colletion.append( - MetaFigure( - px.line( + fig1 = px.line( mean_boottimes1, x="created_at", y="boottime", color="device_count", markers=True, labels={"device_count": "Device (# boottimes)"}, - ) - .update_xaxes( + ).update_xaxes( tickvals=mean_boottimes1["created_at"], ticktext=mean_boottimes1["git_describe"], - ) - .update_layout(xaxis_title="Version", yaxis_title="Boot time"), + ).update_layout(xaxis_title="Version", yaxis_title="Boot time") + # Create the figure to display this data + figure_colletion.append( + MetaFigure(fig1, f"Line graph, {args.build_name}", f"This line graph, is generated from an average over {count_per_device1[col_name_boottime_count].sum()} boottimes for build_name {args.build_name}.", ) @@ -404,36 +404,43 @@ def run(): count_per_device2, on="build_name_device", how="inner", suffixes=("_1", "_2") ) + # Create the figure for this visualisation - figure_colletion.append( - MetaFigure( - px.line( + fig2 = px.line( mean_boottimes2, x="created_at", y="boottime", color="build_name_device_count", markers=True, labels={"build_name_device_count": "Build name - device (# boottimes)"}, - ) - .update_xaxes( + ).update_xaxes( tickvals=mean_boottimes2["created_at"], ticktext=mean_boottimes2["git_describe"], - ) - .update_layout(xaxis_title="Version", yaxis_title="Boot time"), + ).update_layout(xaxis_title="Version", yaxis_title="Boot time") + figure_colletion.append( + MetaFigure( + fig2, f"Line graph, {args.build_name.split('-')[-1]}", f"This line graph, is generated from an average over {count_per_device2[col_name_boottime_count].sum()} boottimes for \"{args.build_name.split('-')[-1]}\".", ) ) - combine_plotly_figs_to_html( - figure_colletion, - "index.html", - "This page show some interesting data around LKFT's builds", - f"These graphs is based on LKFT's {args.project} branch", - ) + app.layout = html.Div([ + html.Div(children="This page show some interesting data around LKFT's builds"), + dcc.Graph(figure=fig1), + dcc.Graph(figure=fig2), + ]) + + # combine_plotly_figs_to_html( + # figure_colletion, + # "index.html", + # "This page show some interesting data around LKFT's builds", + # f"These graphs is based on LKFT's {args.project} branch", + # ) + - exit(0) if __name__ == "__main__": - sys.exit(run()) + run() + app.run_server()