diff --git a/panoramix/forms.py b/panoramix/forms.py index 2f204a1a50..3527598024 100644 --- a/panoramix/forms.py +++ b/panoramix/forms.py @@ -130,6 +130,8 @@ class FormFactory(object): description="Based on granularity, number of time periods to compare against"), 'compare_suffix': TextField('Comparison suffix', description="Suffix to apply after the percentage display"), + 'y_axis_format': TextField('Y axis format', + description="D3 format syntax for y axis"), 'markup_type': SelectField( "Markup Type", choices=self.choicify(['markdown', 'html']), diff --git a/panoramix/static/widgets/viz_nvd3.js b/panoramix/static/widgets/viz_nvd3.js index 29ec245ad8..4a3b00d424 100644 --- a/panoramix/static/widgets/viz_nvd3.js +++ b/panoramix/static/widgets/viz_nvd3.js @@ -137,6 +137,9 @@ function viz_nvd3(data_attribute) { if (viz.form_data.x_log_scale) { chart.xScale(d3.scale.log()); } + if (viz.form_data.y_axis_format) { + chart.yAxis.tickFormat(d3.format(viz.form_data.y_axis_format)); + } chart.duration(0); diff --git a/panoramix/viz.py b/panoramix/viz.py index 80e575ef20..4295a4a358 100644 --- a/panoramix/viz.py +++ b/panoramix/viz.py @@ -420,6 +420,7 @@ class NVD3TimeSeriesViz(NVD3Viz): ('show_brush', 'show_legend'), ('rich_tooltip', 'y_axis_zero'), ('y_log_scale', 'contribution'), + 'y_axis_format' ] def get_df(self, query_obj=None):