Skip to content

Commit

Permalink
Add option to show minmax on x axis
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 4, 2015
1 parent 618e117 commit 63b27bb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions panoramix/forms.py
Expand Up @@ -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([
Expand All @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions panoramix/static/widgets/viz_nvd3.js
Expand Up @@ -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()
Expand All @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion panoramix/viz.py
Expand Up @@ -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):
Expand Down

0 comments on commit 63b27bb

Please sign in to comment.