diff options
author | Tibor Frank <tifrank@cisco.com> | 2022-07-21 13:40:50 +0200 |
---|---|---|
committer | Tibor Frank <tifrank@cisco.com> | 2022-07-21 13:40:50 +0200 |
commit | aa9f6d2b4d417b439e2953a9c82c31b0d561f632 (patch) | |
tree | 39e7ec4ed6199b332ae7ab5ac59510e677e1e144 /resources/tools/dash/app/pal/trending/graphs.py | |
parent | ae1fe880286d7b0414664bce2b2c7c91c3f543f3 (diff) |
UTI: Move common functions to utils.
Change-Id: Ic390359afcea7855a964f8f9793f6d17a5b9b616
Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/dash/app/pal/trending/graphs.py')
-rw-r--r-- | resources/tools/dash/app/pal/trending/graphs.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/resources/tools/dash/app/pal/trending/graphs.py b/resources/tools/dash/app/pal/trending/graphs.py index 0b4968082f..4cd8285f72 100644 --- a/resources/tools/dash/app/pal/trending/graphs.py +++ b/resources/tools/dash/app/pal/trending/graphs.py @@ -23,13 +23,7 @@ import hdrh.codec from datetime import datetime from ..utils.constants import Constants as C -from ..utils.utils import classify_anomalies - - -def _get_color(idx: int) -> str: - """ - """ - return C.PLOT_COLORS[idx % len(C.PLOT_COLORS)] +from ..utils.utils import classify_anomalies, get_color def _get_hdrh_latencies(row: pd.Series, name: str) -> dict: @@ -272,7 +266,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict, else: norm_factor = 1.0 traces = _generate_trending_traces( - itm["testtype"], name, df, start, end, _get_color(idx), norm_factor + itm["testtype"], name, df, start, end, get_color(idx), norm_factor ) if traces: if not fig_tput: @@ -281,7 +275,7 @@ def graph_trending(data: pd.DataFrame, sel:dict, layout: dict, if itm["testtype"] == "pdr": traces = _generate_trending_traces( - "pdr-lat", name, df, start, end, _get_color(idx), norm_factor + "pdr-lat", name, df, start, end, get_color(idx), norm_factor ) if traces: if not fig_lat: @@ -348,7 +342,7 @@ def graph_hdrh_latency(data: dict, layout: dict) -> go.Figure: legendgroup=C.GRAPH_LAT_HDRH_DESC[lat_name], showlegend=bool(idx % 2), line=dict( - color=_get_color(int(idx/2)), + color=get_color(int(idx/2)), dash="solid", width=1 if idx % 2 else 2 ), |