From 63b27bbecea64d88cfeeee7ae1b517db1ef6d0bb Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 4 Dec 2015 10:10:13 -0800 Subject: [PATCH] Add option to show minmax on x axis --- panoramix/forms.py | 10 ++++++++-- panoramix/static/widgets/viz_nvd3.js | 4 ++-- panoramix/viz.py | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/panoramix/forms.py b/panoramix/forms.py index d9408f10b0086..f8289f54a9cff 100644 --- a/panoramix/forms.py +++ b/panoramix/forms.py @@ -185,7 +185,8 @@ def __init__(self, viz): 'step-before', 'step-after']), default='linear', description="Line interpolation as defined by d3.js"), - 'code': TextAreaField("Code", description="Put your code here", default=''), + 'code': TextAreaField( + "Code", description="Put your code here", default=''), 'pandas_aggfunc': SelectField( "Aggregation function", choices=self.choicify([ @@ -204,10 +205,15 @@ def __init__(self, viz): description="Font size for the biggest value in the list"), 'show_brush': BetterBooleanField( "Range Selector", default=True, - description="Whether to display the time range interactive selector"), + description=( + "Whether to display the time range interactive selector")), 'show_legend': BetterBooleanField( "Legend", default=True, description="Whether to display the legend (toggles)"), + 'x_axis_showminmax': BetterBooleanField( + "X axis show min/max", default=True, + description=( + "Whether to display the min and max values of the axis")), 'rich_tooltip': BetterBooleanField( "Rich Tooltip", default=True, description="The rich tooltip shows a list of all series for that point in time"), diff --git a/panoramix/static/widgets/viz_nvd3.js b/panoramix/static/widgets/viz_nvd3.js index bbb88996c5be2..86d1408dc2320 100644 --- a/panoramix/static/widgets/viz_nvd3.js +++ b/panoramix/static/widgets/viz_nvd3.js @@ -45,7 +45,7 @@ function viz_nvd3(data_attribute) { //chart.lines2.xScale( d3.time.scale.utc()); chart.lines2.xScale(d3.time.scale.utc()); chart.x2Axis - .showMaxMin(true) + .showMaxMin(viz.form_data.x_axis_showminmax) .tickFormat(formatDate); } else { chart = nv.models.lineChart() @@ -55,7 +55,7 @@ function viz_nvd3(data_attribute) { chart.xScale(d3.time.scale.utc()); chart.interpolate(viz.form_data.line_interpolation); chart.xAxis - .showMaxMin(true) + .showMaxMin(viz.form_data.x_axis_showminmax) .tickFormat(formatDate); chart.showLegend(viz.form_data.show_legend); chart.yAxis.tickFormat(d3.format('.3s')); diff --git a/panoramix/viz.py b/panoramix/viz.py index 78ff03fed4211..6e28bb2691bce 100644 --- a/panoramix/viz.py +++ b/panoramix/viz.py @@ -475,7 +475,7 @@ class NVD3TimeSeriesViz(NVD3Viz): ('show_brush', 'show_legend'), ('rich_tooltip', 'y_axis_zero'), ('y_log_scale', 'contribution'), - ('y_axis_format', None) + ('y_axis_format', 'x_axis_showminmax'), ] def get_df(self, query_obj=None):