From fcb4152db446442fe1f8f5f967246bf0fbdb70d0 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Mon, 16 Sep 2019 17:01:43 +1000 Subject: [PATCH] Add filename to time series --- daqviewer/daqviewer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/daqviewer/daqviewer.py b/daqviewer/daqviewer.py index 953961f..89cdfb9 100644 --- a/daqviewer/daqviewer.py +++ b/daqviewer/daqviewer.py @@ -107,6 +107,7 @@ def parse_contents(contents, filename): json_data['timeseries'] = df.to_json(orient='table') json_data['spectrum'] = dfs.to_json(orient='table') json_data['statistics'] = stats.to_json(orient='table') + json_data['filename'] = filename return json.dumps(json_data) @@ -132,7 +133,8 @@ def read_json_data(json_data): trace = go.Scatter(x=df.index, y=df[col], name=col, opacity=0.8) ts.append(trace) - layout = {'title': 'basename', 'xaxis': {'rangeslider': {}}} + filename = json.loads(json_data)['filename'] + layout = {'title': filename, 'xaxis': {'rangeslider': {}}} graph_timeseries = dcc.Graph(id='time-series', figure={ 'data': ts,