Navigation Menu

Skip to content

Commit

Permalink
Bugfix for nvd3 charts
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Sep 30, 2015
1 parent c9e4239 commit 7172be9
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions panoramix/viz.py
Expand Up @@ -419,11 +419,11 @@ def get_json(self):
for i, ds in enumerate(df.timestamp)]
}
chart_data.append(d)
data = {
'chart_data': chart_data,
'query': self.results.query,
'duration': self.results.duration,
}
data = {
'chart_data': chart_data,
'query': self.results.query,
'duration': self.results.duration,
}
return dumps(data)


Expand Down Expand Up @@ -496,7 +496,11 @@ def get_json(self):
df = df.reset_index()
df.columns = ['x', 'y']
df['color'] = map(utils.color, df.x)
return df.to_json(orient="records")
return dumps({
'chart_data': df.to_dict(orient="records"),
'query': self.results.query,
'duration': self.results.duration,
})


class DistributionBarViz(DistributionPieViz):
Expand All @@ -514,7 +518,7 @@ def get_df(self):
def get_json(self):
df = self.get_df()
series = df.to_dict('series')
datas = []
chart_data = []
for name, ys in series.items():
if df[name].dtype.kind not in "biufc":
continue
Expand All @@ -532,8 +536,12 @@ def get_json(self):
{'x': ds, 'y': ys[i]}
for i, ds in enumerate(df.timestamp)]
}
datas.append(d)
return dumps(datas)
chart_data.append(d)
return dumps({
'chart_data': chart_data,
'query': self.results.query,
'duration': self.results.duration,
})


viz_types = OrderedDict([
Expand Down

0 comments on commit 7172be9

Please sign in to comment.