Skip to content

Commit

Permalink
Merge pull request #59 from patrickleotardif/y_axis_format
Browse files Browse the repository at this point in the history
Adding y-axis format option
  • Loading branch information
mistercrunch committed Nov 10, 2015
2 parents 774ca9f + 93c660f commit 3c5867c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions panoramix/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ def __init__(self, viz):
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 "
"https://github.com/mbostock/\n"
"d3/wiki/Formatting"),
'markup_type': SelectField(
"Markup Type",
choices=self.choicify(['markdown', 'html']),
Expand Down
7 changes: 7 additions & 0 deletions panoramix/static/widgets/viz_nvd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ 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));

if (chart.y2Axis != undefined) {
chart.y2Axis.tickFormat(d3.format(viz.form_data.y_axis_format));
}
}

chart.duration(0);

Expand Down
1 change: 1 addition & 0 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ class NVD3TimeSeriesViz(NVD3Viz):
('show_brush', 'show_legend'),
('rich_tooltip', 'y_axis_zero'),
('y_log_scale', 'contribution'),
('y_axis_format', None)
]

def get_df(self, query_obj=None):
Expand Down

0 comments on commit 3c5867c

Please sign in to comment.