Skip to content

Commit

Permalink
Fix bug with breakdown (#2312)
Browse files Browse the repository at this point in the history
* Fix bug with breakdown

* allow distribution graph to scroll horizontally

* don't stringify i
  • Loading branch information
vera-liu authored and Alanna Scott committed Mar 3, 2017
1 parent 4e848c8 commit 266c049
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion superset/assets/visualizations/nvd3_vis.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ text.nv-axislabel {
font-size: 14px;
}

.dist_bar .slice_container {
.dist_bar {
overflow-x: auto;
}

Expand Down
19 changes: 6 additions & 13 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ def get_data(self, df):
pt = (pt / pt.sum()).T
pt = pt.reindex(row.index)
chart_data = []
for name, ys in df.iteritems():
if df[name].dtype.kind not in "biufc" or name in self.groupby:
for name, ys in pt.iteritems():
if pt[name].dtype.kind not in "biufc" or name in self.groupby:
continue
if isinstance(name, string_types):
series_title = name
Expand All @@ -1159,19 +1159,12 @@ def get_data(self, df):
l = [str(s) for s in name[1:]]
series_title = ", ".join(l)
values = []
for i, v in ys.iteritems():
idx = pt.index[i]
if isinstance(idx, (tuple, list)):
idx = ', '.join([str(s) for s in idx])
else:
idx = str(idx)
values.append({
'x': idx,
'y': v,
})
d = {
"key": series_title,
"values": values,
"values": [
{'x': i, 'y': v}
for i, v in ys.iteritems()
]
}
chart_data.append(d)
return chart_data
Expand Down

0 comments on commit 266c049

Please sign in to comment.