Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nvd3] fixing the legend toggle bug #132

Merged
merged 2 commits into from
Feb 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion panoramix/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BetterBooleanField(BooleanField):
"""
def __call__(self, **kwargs):
html = super(BetterBooleanField, self).__call__(**kwargs)
html += u'<input type="hidden" name="show_brush" value="false">'
html += u'<input type="hidden" name="{}" value="false">'.format(self.name)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickleotardif , took me a while to get to this bug...

return widgets.HTMLString(html)


Expand Down
11 changes: 4 additions & 7 deletions panoramix/static/widgets/viz_nvd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ function viz_nvd3(slice) {
chart.xAxis
.showMaxMin(fd.x_axis_showminmax)
.staggerLabels(true);
chart.showLegend(fd.show_legend);
} else if (viz_type === 'bar') {
chart = nv.models.multiBarChart()
.showControls(true)
.groupSpacing(0.1);
chart.xAxis
.showMaxMin(false)
.staggerLabels(true);
chart.showLegend(fd.show_legend);
chart.stacked(fd.bar_stacked);

} else if (viz_type === 'dist_bar') {
Expand All @@ -46,11 +44,9 @@ function viz_nvd3(slice) {
chart.xAxis
.showMaxMin(false);
chart.stacked(fd.bar_stacked);

} else if (viz_type === 'pie') {
chart = nv.models.pieChart()
colorKey = 'x';
chart.showLegend(fd.show_legend);
chart.valueFormat(f);
if (fd.donut) {
chart.donut(true);
Expand All @@ -70,7 +66,6 @@ function viz_nvd3(slice) {
chart.xAxis
.showMaxMin(false)
.staggerLabels(true);
chart.showLegend(fd.show_legend);

} else if (viz_type === 'bubble') {
var row = function(col1, col2){
Expand All @@ -79,7 +74,6 @@ function viz_nvd3(slice) {
chart = nv.models.scatterChart();
chart.showDistX(true);
chart.showDistY(true);
chart.showLegend(fd.show_legend);
chart.tooltip.contentGenerator(function (obj) {
p = obj.point;
var s = "<table>"
Expand All @@ -99,7 +93,10 @@ function viz_nvd3(slice) {
chart.xAxis
.showMaxMin(false)
.staggerLabels(true);
chart.showLegend(fd.show_legend);
}
if ("showLegend" in chart) {
if ('show_legend' in fd)
chart.showLegend(fd.show_legend);
}

var height = slice.height();
Expand Down
4 changes: 2 additions & 2 deletions panoramix/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ def wrapper(*args, **kwargs):
log = models.Log(
action=f.__name__,
json=json.dumps(d),
dashboard_id=d.get('dashboard_id'),
slice_id=d.get('slice_id'),
dashboard_id=d.get('dashboard_id') or None,
slice_id=d.get('slice_id') or None,
user_id=user_id)
db.session.add(log)
db.session.commit()
Expand Down