feat(uti): hrdh latency graph 01/36001/1
authorTibor Frank <tifrank@cisco.com>
Wed, 20 Apr 2022 07:40:34 +0000 (09:40 +0200)
committerTibor Frank <tifrank@cisco.com>
Wed, 20 Apr 2022 07:40:34 +0000 (09:40 +0200)
Change-Id: Ib08b31b6dda79c66f4d204145a1b2ed78e9636b4
Signed-off-by: Tibor Frank <tifrank@cisco.com>
resources/tools/dash/app/pal/trending/graphs.py
resources/tools/dash/app/pal/trending/layout.py
resources/tools/dash/app/pal/trending/layout.yaml

index dc4e7af..4273d9d 100644 (file)
@@ -386,11 +386,6 @@ def graph_hdrh_latency(data: dict, layout: dict) -> go.Figure:
 
     fig = None
 
-    try:
-        name = data.pop("name")
-    except (KeyError, AttributeError):
-        return None
-
     traces = list()
     for idx, (lat_name, lat_hdrh) in enumerate(data.items()):
         try:
@@ -450,7 +445,6 @@ def graph_hdrh_latency(data: dict, layout: dict) -> go.Figure:
         fig.add_traces(traces)
         layout_hdrh = layout.get("plot-hdrh-latency", None)
         if lat_hdrh:
-            layout_hdrh["title"]["text"] = f"<b>{name}</b>"
             fig.update_layout(layout_hdrh)
 
     return fig
index c12d64a..dd097b4 100644 (file)
@@ -910,11 +910,20 @@ class Layout:
                 txt = lat_data["points"][0]["text"].replace("<br>", "\n")
                 hdrh_data = lat_data["points"][0].get("customdata", None)
                 if hdrh_data:
-                    graph = [dcc.Graph(
-                        id="hdrh-latency-graph",
-                        figure=graph_hdrh_latency(hdrh_data, self.layout)
-                    ), ]
-
+                    graph = [dbc.Card(
+                        class_name="g-0",
+                        children=[
+                            dbc.CardHeader(hdrh_data.pop("name")),
+                            dbc.CardBody(children=[
+                                dcc.Graph(
+                                    id="hdrh-latency-graph",
+                                    figure=graph_hdrh_latency(
+                                        hdrh_data, self.layout
+                                    )
+                                )
+                            ])
+                        ])
+                    ]
             metadata = [
                 dbc.Card(
                     class_name="g-0",
index 9645b74..0c0b62d 100644 (file)
@@ -155,10 +155,10 @@ plot-trending-lat:
     namelength: -1
 
 plot-hdrh-latency:
-  title:
-    text: "Latency by Percentile Distribution"
-    xanchor: "center"
-    x: 0.5
+  title:
+    text: "Latency by Percentile Distribution"
+    xanchor: "center"
+    x: 0.5
     # font:
     #   size: 10
   showlegend: True
@@ -192,7 +192,7 @@ plot-hdrh-latency:
     # tickfont:
     #   size: 14
   yaxis:
-    title: "One-Way Latency per Direction [uSec]"
+    title: "One-Way Latency per Direction [us]"
     # titlefont:
     #   size: 14
     gridcolor: "rgb(230, 230, 230)"