superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [nvd3] fix single metric showing up in legend (#3563)
Date Mon, 02 Oct 2017 17:42:18 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new b39d165  [nvd3] fix single metric showing up in legend (#3563)
b39d165 is described below

commit b39d165913affba3d146c4dbbe7c1c02dac135f2
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Mon Oct 2 10:42:16 2017 -0700

    [nvd3] fix single metric showing up in legend (#3563)
---
 superset/viz.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/superset/viz.py b/superset/viz.py
index 75da129..22d2ea9 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -884,9 +884,15 @@ class NVD3TimeSeriesViz(NVD3Viz):
             if df[name].dtype.kind not in "biufc":
                 continue
             series_title = name
+            if (
+                    isinstance(series_title, (list, tuple)) and
+                    len(series_title) > 1 and
+                    len(self.metrics) == 1):
+                # Removing metric from series name if only one metric
+                series_title = series_title[1:]
             if isinstance(series_title, string_types):
                 series_title += title_suffix
-            elif title_suffix and isinstance(series_title, list):
+            elif title_suffix and isinstance(series_title, (list, tuple)):
                 series_title.append(title_suffix)
 
             d = {

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message