Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
[WIP] Experiment with Dash
Browse files Browse the repository at this point in the history
  • Loading branch information
katieworton committed May 9, 2024
1 parent bae5aba commit 72a5c2c
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions squad-track-duration
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,6 +29,7 @@ logger = logging.getLogger(__name__)

ARTIFACTORIAL_FILENAME = "builds.json"

app = Dash(__name__)

class MetaFigure:
def __init__(self, plotly_fig, title, description):
Expand Down Expand Up @@ -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}.",
)
Expand Down Expand Up @@ -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()

0 comments on commit 72a5c2c

Please sign in to comment.