mirror of
https://github.com/apache/superset.git
synced 2024-09-17 19:19:38 -04:00
[nvd3] fixing the legend toggle bug
This commit is contained in:
parent
ec0566860a
commit
c7ecb331e4
@ -17,7 +17,7 @@ class BetterBooleanField(BooleanField):
|
|||||||
"""
|
"""
|
||||||
def __call__(self, **kwargs):
|
def __call__(self, **kwargs):
|
||||||
html = super(BetterBooleanField, self).__call__(**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)
|
||||||
return widgets.HTMLString(html)
|
return widgets.HTMLString(html)
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ function viz_nvd3(slice) {
|
|||||||
chart.xAxis
|
chart.xAxis
|
||||||
.showMaxMin(fd.x_axis_showminmax)
|
.showMaxMin(fd.x_axis_showminmax)
|
||||||
.staggerLabels(true);
|
.staggerLabels(true);
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
} else if (viz_type === 'bar') {
|
} else if (viz_type === 'bar') {
|
||||||
chart = nv.models.multiBarChart()
|
chart = nv.models.multiBarChart()
|
||||||
.showControls(true)
|
.showControls(true)
|
||||||
@ -34,7 +33,6 @@ function viz_nvd3(slice) {
|
|||||||
chart.xAxis
|
chart.xAxis
|
||||||
.showMaxMin(false)
|
.showMaxMin(false)
|
||||||
.staggerLabels(true);
|
.staggerLabels(true);
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
chart.stacked(fd.bar_stacked);
|
chart.stacked(fd.bar_stacked);
|
||||||
|
|
||||||
} else if (viz_type === 'dist_bar') {
|
} else if (viz_type === 'dist_bar') {
|
||||||
@ -46,11 +44,9 @@ function viz_nvd3(slice) {
|
|||||||
chart.xAxis
|
chart.xAxis
|
||||||
.showMaxMin(false);
|
.showMaxMin(false);
|
||||||
chart.stacked(fd.bar_stacked);
|
chart.stacked(fd.bar_stacked);
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
} else if (viz_type === 'pie') {
|
} else if (viz_type === 'pie') {
|
||||||
chart = nv.models.pieChart()
|
chart = nv.models.pieChart()
|
||||||
colorKey = 'x';
|
colorKey = 'x';
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
chart.valueFormat(f);
|
chart.valueFormat(f);
|
||||||
if (fd.donut) {
|
if (fd.donut) {
|
||||||
chart.donut(true);
|
chart.donut(true);
|
||||||
@ -70,7 +66,6 @@ function viz_nvd3(slice) {
|
|||||||
chart.xAxis
|
chart.xAxis
|
||||||
.showMaxMin(false)
|
.showMaxMin(false)
|
||||||
.staggerLabels(true);
|
.staggerLabels(true);
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
|
|
||||||
} else if (viz_type === 'bubble') {
|
} else if (viz_type === 'bubble') {
|
||||||
var row = function(col1, col2){
|
var row = function(col1, col2){
|
||||||
@ -79,7 +74,6 @@ function viz_nvd3(slice) {
|
|||||||
chart = nv.models.scatterChart();
|
chart = nv.models.scatterChart();
|
||||||
chart.showDistX(true);
|
chart.showDistX(true);
|
||||||
chart.showDistY(true);
|
chart.showDistY(true);
|
||||||
chart.showLegend(fd.show_legend);
|
|
||||||
chart.tooltip.contentGenerator(function (obj) {
|
chart.tooltip.contentGenerator(function (obj) {
|
||||||
p = obj.point;
|
p = obj.point;
|
||||||
var s = "<table>"
|
var s = "<table>"
|
||||||
@ -99,7 +93,10 @@ function viz_nvd3(slice) {
|
|||||||
chart.xAxis
|
chart.xAxis
|
||||||
.showMaxMin(false)
|
.showMaxMin(false)
|
||||||
.staggerLabels(true);
|
.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();
|
var height = slice.height();
|
||||||
|
@ -202,8 +202,8 @@ def log_this(f):
|
|||||||
log = models.Log(
|
log = models.Log(
|
||||||
action=f.__name__,
|
action=f.__name__,
|
||||||
json=json.dumps(d),
|
json=json.dumps(d),
|
||||||
dashboard_id=d.get('dashboard_id'),
|
dashboard_id=d.get('dashboard_id') or None,
|
||||||
slice_id=d.get('slice_id'),
|
slice_id=d.get('slice_id') or None,
|
||||||
user_id=user_id)
|
user_id=user_id)
|
||||||
db.session.add(log)
|
db.session.add(log)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user