Commit aa1be1d7 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update report_tools.py to deal with the new Summary, Graph fields and widgets.

parent 033092a5
......@@ -206,8 +206,14 @@ class Graph2(object):
# report configuration
config = metric2d.config
selector = metric2d.selector
selector.graph = json.loads(selector.graph)
config_graph = (selector.graph if selector.is_graph else config.graph)
print config_graph
# protection
config_graph = metric2d.config.graph
if config_graph[u"kind"] not in GRAPHS:
self.ax = None
return
......@@ -518,15 +524,18 @@ class Metric2D2(BaseReport):
config_x = config.summary_x
config_y = config.summary_y
is_summary_x = selector.is_summary_x
is_summary_y = selector.is_summary_y
selector_x = json.loads(selector.summary_x)
selector_y = json.loads(selector.summary_y)
summary_x = (selector_x if selector_x[u"compute"] else config_x)
summary_y = (selector_y if selector_y[u"compute"] else config_y)
summary_x = (selector_x if is_summary_x else config_x)
summary_y = (selector_y if is_summary_y else config_y)
# preserve the original DataFrame in order to avoid pollution
# when series of summaries is computed
if summary_x[u"compute"] or summary_y[u"compute"]:
if len(summary_x["functions"]) > 0 or len(summary_y["functions"]) > 0:
self.df0 = df0 = df.copy()
dfx = self.summaries(df0, summary_x, axis="columns")
......@@ -567,22 +576,18 @@ class Metric2D2(BaseReport):
"""
df1 = pd.DataFrame()
if not config[u"compute"]:
return df1
funcs = config[u"function(s)"]
funcs = config[u"functions"]
if funcs in ("", '""', "''", '[]'):
return df1
funcs = json.loads(funcs)
if not isinstance(funcs, list):
return df1
labels = config[u"label(s)"]
labels = config[u"labels"]
if labels in ("", '""', "''", "[]"):
labels = funcs
else:
labels = json.loads(config[u"label(s)"])
labels = labels.split(",")
if len(labels) != len(funcs):
labels = funcs
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment