From a099e6f6b6c22dafc5923f01369b2d97be3033e5 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Thu, 24 Aug 2017 15:30:46 +0200 Subject: [PATCH] DASH: Py:None,JS:null inst.of Py:float('nan'),JS:NaN --- python_suite/dashboard/dashboard.py | 6 +++--- python_suite/dashboard/static/js/sparkline.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python_suite/dashboard/dashboard.py b/python_suite/dashboard/dashboard.py index 4b906f4..318e5ea 100755 --- a/python_suite/dashboard/dashboard.py +++ b/python_suite/dashboard/dashboard.py @@ -32,7 +32,7 @@ def register_pv_value_in_history(pv_name, ts, value): # If we are asked to put a float:NaN value into the history, # repeat the previous value just before our new NaN value # This is important to extend plot lines until the value gets invalid. - if len(HISTORY[pv_name]) > 0 and math.isnan(value): + if len(HISTORY[pv_name]) > 0 and value is None: HISTORY[pv_name].append( [ts-0.1, HISTORY[pv_name][1]] ) HISTORY[pv_name].append( [ts, value] ) @@ -65,7 +65,7 @@ def cb_connection_change(**kwargs): pv['unit'] = '' pv['classes'] = 'disconnected' pv['precision'] = None - register_pv_value_in_history(kwargs['pvname'], time.time(), float('nan')) + register_pv_value_in_history(kwargs['pvname'], time.time(), None) def cb_value_update(**kwargs): @@ -93,7 +93,7 @@ def cb_value_update(**kwargs): pv['value'] = kwargs['value'] pv['num_value'] = kwargs['value'] if kwargs['severity'] == epics.INVALID_ALARM: - pv['num_value'] = float('nan') + pv['num_value'] = None register_pv_value_in_history(kwargs['pvname'], kwargs['timestamp'], pv['num_value']) pv['precision'] = kwargs['precision'] #if type(kwargs['precision']) == int and ('double' in kwargs['type'] or 'float' in kwargs['type']): diff --git a/python_suite/dashboard/static/js/sparkline.js b/python_suite/dashboard/static/js/sparkline.js index 1b4bc62..61ca92b 100644 --- a/python_suite/dashboard/static/js/sparkline.js +++ b/python_suite/dashboard/static/js/sparkline.js @@ -128,7 +128,7 @@ function sparkline() { data.forEach(function (d) { d[0] = new Date(d[0]); - d[1] = +d[1]; + d[1] = d[1]; }); // Scale the range of the data -- 2.43.0