Skip to content

Commit

Permalink
Reintroducing showControls as an option (#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jun 24, 2016
1 parent 141dc12 commit 51024b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion caravel/assets/package.json
Expand Up @@ -61,7 +61,7 @@
"less": "^2.6.1",
"less-loader": "^2.2.2",
"mustache": "^2.2.1",
"nvd3": "1.8.2",
"nvd3": "1.8.3",
"react": "^0.14.7",
"react-bootstrap": "^0.28.3",
"react-dom": "^0.14.7",
Expand Down
6 changes: 3 additions & 3 deletions caravel/assets/visualizations/nvd3_vis.js
Expand Up @@ -64,7 +64,7 @@ function nvd3Vis(slice) {

case 'bar':
chart = nv.models.multiBarChart()
.showControls(false)
.showControls(fd.show_controls)
.groupSpacing(0.1);

if (!reduceXTicks) {
Expand All @@ -80,7 +80,7 @@ function nvd3Vis(slice) {

case 'dist_bar':
chart = nv.models.multiBarChart()
.showControls(false)
.showControls(fd.show_controls)
.reduceXTicks(reduceXTicks)
.rotateLabels(45)
.groupSpacing(0.1); //Distance between each group of bars.
Expand Down Expand Up @@ -143,7 +143,7 @@ function nvd3Vis(slice) {

case 'area':
chart = nv.models.stackedAreaChart();
chart.showControls(false);
chart.showControls(fd.show_controls);
chart.style(fd.stacked_style);
chart.xScale(d3.time.scale.utc());
chart.xAxis
Expand Down
8 changes: 8 additions & 0 deletions caravel/forms.py
Expand Up @@ -225,6 +225,14 @@ def __init__(self, viz):
"default": False,
"description": ""
}),
'show_controls': (BetterBooleanField, {
"label": _("Extra Controls"),
"default": False,
"description": (
"Whether to show extra controls or not. Extra controls "
"include things like making mulitBar charts stacked "
"or side by side.")
}),
'reduce_x_ticks': (BetterBooleanField, {
"label": _("Reduce X ticks"),
"default": False,
Expand Down
5 changes: 3 additions & 2 deletions caravel/viz.py
Expand Up @@ -1084,7 +1084,7 @@ class NVD3TimeSeriesBarViz(NVD3TimeSeriesViz):
('line_interpolation', 'bar_stacked'),
('x_axis_showminmax', 'bottom_margin'),
('x_axis_label', 'y_axis_label'),
('reduce_x_ticks', None),
('reduce_x_ticks', 'show_controls'),
), }] + [NVD3TimeSeriesViz.fieldsets[2]]


Expand All @@ -1110,7 +1110,7 @@ class NVD3TimeSeriesStackedViz(NVD3TimeSeriesViz):
('rich_tooltip', 'y_axis_zero'),
('y_log_scale', 'contribution'),
('x_axis_format', 'y_axis_format'),
('x_axis_showminmax'),
('x_axis_showminmax', 'show_controls'),
('line_interpolation', 'stacked_style'),
), }] + [NVD3TimeSeriesViz.fieldsets[2]]

Expand Down Expand Up @@ -1169,6 +1169,7 @@ class DistributionBarViz(DistributionPieViz):
('y_axis_format', 'bottom_margin'),
('x_axis_label', 'y_axis_label'),
('reduce_x_ticks', 'contribution'),
('show_controls', None),
)
},)
form_overrides = {
Expand Down

0 comments on commit 51024b5

Please sign in to comment.