Skip to content

Commit

Permalink
changes for linters
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhn committed Apr 10, 2016
1 parent b448a9c commit 1b6b9e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion caravel/assets/javascripts/modules/caravel.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var color = function () {
// Color factory
var seen = {};
return function (s) {
if (!s) return;
if (!s) { return; }
// next line is for caravel series that should have the same color
s = s.replace('---', '');
if (seen[s] === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions caravel/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ function nvd3Vis(slice) {
case 'box_plot':
colorKey = 'label';
chart = nv.models.boxPlotChart();
chart.x(function(d) { return d.label })
chart.staggerLabels(true)
chart.x(function (d) { return d.label; });
chart.staggerLabels(true);
chart.maxBoxWidth(75); // prevent boxes from being incredibly wide
break;

Expand Down
9 changes: 4 additions & 5 deletions caravel/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def get_df(self, query_obj=None):

df = df.fillna(0)

## conform to NVD3 names
# conform to NVD3 names
def Q1(series): # need to be named functions - can't use lambdas
return np.percentile(series, 25)

Expand All @@ -533,7 +533,7 @@ def whisker_high(series):

def whisker_low(series):
lower_outer_lim = Q1(series) - 1.5 * (Q3(series) - Q1(series))
## find the closest value above the lower outer limit
# find the closest value above the lower outer limit
series = series[series >= lower_outer_lim]
return series[np.abs(series - lower_outer_lim).argmin()]

Expand All @@ -545,7 +545,6 @@ def whisker_high(series):
def whisker_low(series):
return series.min()


elif " percentiles" in whisker_type:
low, high = whisker_type.replace(" percentiles", "").split("/")

Expand All @@ -561,7 +560,7 @@ def whisker_low(series):
def outliers(series):
above = series[series > whisker_high(series)]
below = series[series < whisker_low(series)]
## pandas sometimes doesn't like getting lists back here
# pandas sometimes doesn't like getting lists back here
return set(above.tolist() + below.tolist())

aggregate = [Q1, np.median, Q3, whisker_high, whisker_low, outliers]
Expand All @@ -581,7 +580,7 @@ def to_series(self, df, classed='', title_suffix=''):
boxes[label][key] = value
for label, box in boxes.items():
if len(self.form_data.get("metrics")) > 1:
## need to render data labels with metrics
# need to render data labels with metrics
chart_label = label_sep.join([index_value, label])
else:
chart_label = index_value
Expand Down

0 comments on commit 1b6b9e9

Please sign in to comment.