From 7471d9fa636a4f2396c2130d4265a99f788bdeb4 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 19 Sep 2019 08:05:54 +1000 Subject: [PATCH] Add units to axis labels --- daqviewer/daqviewer.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/daqviewer/daqviewer.py b/daqviewer/daqviewer.py index a2b4b70..b2877be 100644 --- a/daqviewer/daqviewer.py +++ b/daqviewer/daqviewer.py @@ -136,7 +136,15 @@ def update_objects(json_data): trace = go.Scatter(x=df.index, y=df[col], name=col, opacity=0.8) ts.append(trace) - layout = {'title': info['filename'], 'xaxis': {'rangeslider': {}}} + layout = { + 'title': info['filename'], + 'xaxis': { + 'rangeslider': {} + }, + 'yaxis': { + 'title': 'Amplitude ({})'.format(info['units']) + } + } graph_timeseries = dcc.Graph(id='time-series', figure={ 'data': ts, @@ -163,7 +171,9 @@ def update_objects(json_data): 'title': 'Frequency (Hz)', }, 'yaxis': { - 'title': 'Energy (mm^2.s)', + 'title': + 'Energy ({}^2.s)'.format( + info['units']), } } })