[nvd3] fix single metric showing up in legend (#3563)

This commit is contained in:
Maxime Beauchemin 2017-10-02 10:42:16 -07:00 committed by GitHub
parent bc3ad64619
commit b39d165913

View File

@ -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 = {