mirror of https://github.com/apache/superset.git
Adding option for reduceXTicks (#640)
This commit is contained in:
parent
78eb1e6a54
commit
55c549d86f
|
@ -36,6 +36,7 @@ function nvd3Vis(slice) {
|
|||
var fd = payload.form_data;
|
||||
var viz_type = fd.viz_type;
|
||||
var f = d3.format('.3s');
|
||||
var reduceXTicks = fd.reduce_x_ticks || false;
|
||||
|
||||
nv.addGraph(function () {
|
||||
switch (viz_type) {
|
||||
|
@ -63,7 +64,9 @@ function nvd3Vis(slice) {
|
|||
.showControls(true)
|
||||
.groupSpacing(0.1);
|
||||
|
||||
width = barchartWidth();
|
||||
if (!reduceXTicks) {
|
||||
width = barchartWidth();
|
||||
}
|
||||
chart.width(width);
|
||||
chart.xAxis
|
||||
.showMaxMin(false)
|
||||
|
@ -75,7 +78,7 @@ function nvd3Vis(slice) {
|
|||
case 'dist_bar':
|
||||
chart = nv.models.multiBarChart()
|
||||
.showControls(true) //Allow user to switch between 'Grouped' and 'Stacked' mode.
|
||||
.reduceXTicks(false)
|
||||
.reduceXTicks(reduceXTicks)
|
||||
.rotateLabels(45)
|
||||
.groupSpacing(0.1); //Distance between each group of bars.
|
||||
|
||||
|
@ -83,7 +86,9 @@ function nvd3Vis(slice) {
|
|||
.showMaxMin(false);
|
||||
|
||||
chart.stacked(fd.bar_stacked);
|
||||
width = barchartWidth();
|
||||
if (!reduceXTicks) {
|
||||
width = barchartWidth();
|
||||
}
|
||||
chart.width(width);
|
||||
break;
|
||||
|
||||
|
|
|
@ -225,6 +225,16 @@ class FormFactory(object):
|
|||
"default": False,
|
||||
"description": ""
|
||||
}),
|
||||
'reduce_x_ticks': (BetterBooleanField, {
|
||||
"label": _("Reduce X ticks"),
|
||||
"default": False,
|
||||
"description": (
|
||||
"Reduces the number of X axis ticks to be rendered. "
|
||||
"If true, the x axis wont overflow and labels may be "
|
||||
"missing. If false, a minimum width will be applied "
|
||||
"to columns and the width may overflow into an "
|
||||
"horizontal scroll."),
|
||||
}),
|
||||
'include_series': (BetterBooleanField, {
|
||||
"label": _("Include Series"),
|
||||
"default": False,
|
||||
|
@ -562,7 +572,7 @@ class FormFactory(object):
|
|||
"default": '',
|
||||
}),
|
||||
'y_axis_label': (TextField, {
|
||||
"label": _("X Axis Label"),
|
||||
"label": _("Y Axis Label"),
|
||||
"default": '',
|
||||
}),
|
||||
'where': (TextField, {
|
||||
|
|
|
@ -1075,6 +1075,7 @@ class NVD3TimeSeriesBarViz(NVD3TimeSeriesViz):
|
|||
('line_interpolation', 'bar_stacked'),
|
||||
('x_axis_showminmax', 'bottom_margin'),
|
||||
('x_axis_label', 'y_axis_label'),
|
||||
('reduce_x_ticks', None),
|
||||
), }] + [NVD3TimeSeriesViz.fieldsets[2]]
|
||||
|
||||
|
||||
|
@ -1158,6 +1159,7 @@ class DistributionBarViz(DistributionPieViz):
|
|||
('show_legend', 'bar_stacked'),
|
||||
('y_axis_format', 'bottom_margin'),
|
||||
('x_axis_label', 'y_axis_label'),
|
||||
('reduce_x_ticks', None),
|
||||
)
|
||||
},)
|
||||
form_overrides = {
|
||||
|
|
Loading…
Reference in New Issue