From 56ce69ceff0748c24ff9c65bb8c45ac0e9f892e6 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 8 Apr 2021 05:21:39 -0400 Subject: [PATCH] Fix divide by zero issues on Trend indicator (#2148) --- panel/widgets/indicators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/widgets/indicators.py b/panel/widgets/indicators.py index cb6baa643b..68b4eeea62 100644 --- a/panel/widgets/indicators.py +++ b/panel/widgets/indicators.py @@ -647,7 +647,7 @@ def _process_param_change(self, msg): if 'value_change' in msg and msg['value_change'] == 'auto': if len(ys) > 1: y1, y2 = self._data.get(self.plot_y)[-2:] - msg['value_change'] = y2/y1 - 1 + msg['value_change'] = 0 if y1 == 0 else (y2/y1 - 1) else: msg['value_change'] = 0 return msg