From 649f0ec99d2026a7d4a9002ee4a25478ca4b9504 Mon Sep 17 00:00:00 2001 From: zsloan Date: Tue, 14 Jun 2016 20:42:12 +0000 Subject: Added y axis line to probability plot and bar chart Automatically determines number of decimal places to show on y axis of probability plot; still need to figure out how to do it with bar chart Added some logging to figure out MySQL connection issue --- wqflask/wqflask/collect.py | 2 +- wqflask/wqflask/model.py | 0 wqflask/wqflask/static/new/javascript/draw_probability_plot.js | 7 ++++++- wqflask/wqflask/static/new/javascript/show_trait.js | 5 +++++ wqflask/wqflask/static/new/packages/nvd3/nv.d3.css | 2 +- wqflask/wqflask/static/new/packages/nvd3/nv.d3.js | 5 +++-- wqflask/wqflask/templates/show_trait.html | 2 +- wqflask/wqflask/user_manager.py | 4 ++++ 8 files changed, 21 insertions(+), 6 deletions(-) mode change 100755 => 100644 wqflask/wqflask/model.py (limited to 'wqflask') diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index cd4c6fdc..9227d641 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -15,7 +15,7 @@ import urlparse import simplejson as json -from sqlalchemy import orm +#from sqlalchemy import orm #from redis import StrictRedis import redis diff --git a/wqflask/wqflask/model.py b/wqflask/wqflask/model.py old mode 100755 new mode 100644 diff --git a/wqflask/wqflask/static/new/javascript/draw_probability_plot.js b/wqflask/wqflask/static/new/javascript/draw_probability_plot.js index 3eb6295f..1eeb6e73 100644 --- a/wqflask/wqflask/static/new/javascript/draw_probability_plot.js +++ b/wqflask/wqflask/static/new/javascript/draw_probability_plot.js @@ -46,7 +46,7 @@ chart.pointRange([50, 50]); chart.legend.updateState(false); chart.xAxis.axisLabel("Theoretical quantiles").tickFormat(d3.format('.02f')); - chart.yAxis.axisLabel("Sample quantiles").tickFormat(d3.format('.02f')); + //chart.yAxis.axisLabel("Sample quantiles").tickFormat(d3.format('.02f')); chart.tooltipContent(function(obj) { return '' + obj.point.name + ''; }); @@ -66,15 +66,20 @@ sorted_names = names.sort(function(x, y) { return all_samples[x].value - all_samples[y].value; }); + max_decimals = 0 sorted_values = (function() { var j, len, results; results = []; for (j = 0, len = sorted_names.length; j < len; j++) { x = sorted_names[j]; results.push(all_samples[x].value); + if (all_samples[x].value.countDecimals() > max_decimals) { + max_decimals = all_samples[x].value.countDecimals()-1 + } } return results; })(); + chart.yAxis.axisLabel("Sample quantiles").tickFormat(d3.format('.0'+max_decimals.toString()+'f')); sw_result = ShapiroWilkW(sorted_values); W = sw_result.w.toFixed(3); pvalue = sw_result.p.toFixed(3); diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js index 34d1a139..589b1074 100644 --- a/wqflask/wqflask/static/new/javascript/show_trait.js +++ b/wqflask/wqflask/static/new/javascript/show_trait.js @@ -521,5 +521,10 @@ $('#reset').click(edit_data_change); return console.log("end"); }); + + Number.prototype.countDecimals = function () { + if(Math.floor(this.valueOf()) === this.valueOf()) return 0; + return this.toString().split(".")[1].length || 0; + } }).call(this); diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css index 726f76c3..694b9218 100644 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css +++ b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.css @@ -16,7 +16,7 @@ } .nvd3 .nv-axis.nv-x path.domain { - stroke-opacity: 0; + stroke-opacity: 1; } .nvd3 .nv-axis line { diff --git a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js index b11ce58f..4d8b9d65 100644 --- a/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js +++ b/wqflask/wqflask/static/new/packages/nvd3/nv.d3.js @@ -1556,7 +1556,7 @@ nv.models.axis = function() { , width = 75 //only used for tickLabel currently , height = 60 //only used for tickLabel currently , axisLabelText = null - , showMaxMin = true //TODO: showMaxMin should be disabled on all ordinal scaled axes + , showMaxMin = false //TODO: showMaxMin should be disabled on all ordinal scaled axes , rotateLabels = 0 , rotateYLabel = true , staggerLabels = false @@ -7894,7 +7894,8 @@ nv.models.multiBar = function() { bars.select('polyline') .attr('fill', 'none') - .attr('stroke', function(d, i, j) { return errorBarColor(d, j, i); }) + .attr('stroke', 'black') + //.attr('stroke', function(d, i, j) { return errorBarColor(d, j, i); }) .attr('points', function(d,i) { var yerr = getYerr(d,i) , mid = 0.8 * x.rangeBand() / ((stacked ? 1 : data.length) * 2); diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 5e2dc6fa..1890cf3f 100755 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -7,7 +7,7 @@ - + diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py index e16a397d..e334a9aa 100755 --- a/wqflask/wqflask/user_manager.py +++ b/wqflask/wqflask/user_manager.py @@ -12,6 +12,7 @@ import os import hashlib import datetime import time +import logging import uuid import hashlib @@ -141,6 +142,9 @@ class UserSession(object): """Actual sqlalchemy record""" # Only look it up once if needed, then store it try: + logging.basicConfig() + logging.getLogger('sqlalchemy.pool').setLevel(logging.DEBUG) + # Already did this before return self.db_object except AttributeError: -- cgit v1.2.3