diff options
-rw-r--r-- | dash/pages/locations.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dash/pages/locations.py b/dash/pages/locations.py index 85adcfc..c5ed558 100644 --- a/dash/pages/locations.py +++ b/dash/pages/locations.py @@ -88,7 +88,7 @@ def make_content_all(days, date): figure = go.Figure() figure.add_trace(go.Pie( labels=[item['locationname'][0:9] for item in data if item['ip'] == sat], - values=[int(item['totalSessionTime'] / 3600) for item in data if item['ip'] == sat], + values=[item['totalSessionTime'] for item in data if item['ip'] == sat], text=[str(int(item['totalSessionTime'] / 3600)) + ' h' for item in data if item['ip'] == sat], hole=0.3, textinfo='none', @@ -99,7 +99,8 @@ def make_content_all(days, date): title_text = '<sub>Sessiontime per Location</sub><br>' + sat, showlegend=False ) - figures.append(dbc.Col(width=12, md=6, xl=4, children=dcc.Graph(figure=figure))) + if len([item for item in data if item['ip'] == sat and item['totalSessionTime'] > 0]) > 0: + figures.append(dbc.Col(width=12, md=6, xl=4, children=dcc.Graph(figure=figure))) return figures |