diff options
Diffstat (limited to 'resources/tools/dash/app/pal/trending/layout.py')
-rw-r--r-- | resources/tools/dash/app/pal/trending/layout.py | 63 |
1 files changed, 43 insertions, 20 deletions
diff --git a/resources/tools/dash/app/pal/trending/layout.py b/resources/tools/dash/app/pal/trending/layout.py index 377621425c..bd8dd8b240 100644 --- a/resources/tools/dash/app/pal/trending/layout.py +++ b/resources/tools/dash/app/pal/trending/layout.py @@ -15,7 +15,6 @@ """ -import json import pandas as pd from dash import dcc @@ -27,7 +26,7 @@ from yaml import load, FullLoader, YAMLError from datetime import datetime, timedelta from ..data.data import Data -from .graphs import trending_tput +from .graphs import graph_trending_tput, graph_hdrh_latency class Layout: @@ -35,8 +34,12 @@ class Layout: """ STYLE_HIDEN = {"display": "none"} - STYLE_BLOCK = {"display": "block"} - STYLE_INLINE ={"display": "inline-block", "width": "50%"} + STYLE_BLOCK = {"display": "block", "vertical-align": "top"} + STYLE_INLINE ={ + "display": "inline-block", + "vertical-align": "top", + "width": "33%" + } NO_GRAPH = {"data": [], "layout": {}, "frames": []} def __init__(self, app, html_layout_file, spec_file, graph_layout_file, @@ -190,13 +193,10 @@ class Layout: html.Div( id="div-tput-metadata", children=[ - dcc.Markdown(""" - **Metadata** - - Click on data points in the graph. - """), + dcc.Markdown("**Throughput**"), html.Pre( - id="tput-metadata" + id="tput-metadata", + children="Click on data points in the graph" ) ], style=self.STYLE_HIDEN @@ -204,13 +204,25 @@ class Layout: html.Div( id="div-latency-metadata", children=[ - dcc.Markdown(""" - **Metadata** - - Click on data points in the graph. - """), + dcc.Markdown("**Latency**"), html.Pre( - id="latency-metadata" + id="latency-metadata", + children="Click on data points in the graph" + ) + ], + style=self.STYLE_HIDEN + ), + html.Div( + id="div-latency-hdrh", + children=[ + dcc.Loading( + id="loading-hdrh-latency-graph", + children=[ + dcc.Graph( + id="graph-latency-hdrh" + ) + ], + type="circle" ) ], style=self.STYLE_HIDEN @@ -615,7 +627,7 @@ class Layout: }) elif trigger_id in ("btn-sel-display", "dpr-period"): - fig_tput, fig_lat = trending_tput( + fig_tput, fig_lat = graph_trending_tput( self.data, store_sel, self.layout, d_start, d_end ) output.set_values({ @@ -641,7 +653,7 @@ class Layout: new_store_sel.append(item) store_sel = new_store_sel if store_sel: - fig_tput, fig_lat = trending_tput( + fig_tput, fig_lat = graph_trending_tput( self.data, store_sel, self.layout, d_start, d_end ) output.set_values({ @@ -681,13 +693,24 @@ class Layout: def _show_tput_metadata(hover_data): if not hover_data: raise PreventUpdate - return json.dumps(hover_data, indent=2) + return hover_data["points"][0]["text"].replace("<br>", "\n"), @app.callback( Output("latency-metadata", "children"), + Output("graph-latency-hdrh", "figure"), + Output("div-latency-hdrh", "style"), Input("graph-latency", "clickData") ) def _show_latency_metadata(hover_data): if not hover_data: raise PreventUpdate - return json.dumps(hover_data, indent=2) + graph = graph_hdrh_latency( + hover_data["points"][0]["customdata"], self.layout + ) + if not graph: + graph = no_update + return ( + hover_data["points"][0]["text"].replace("<br>", "\n"), + graph, + self.STYLE_INLINE if graph else self.STYLE_HIDEN + ) |