aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/wqflask/show_trait/SampleList.py12
-rw-r--r--wqflask/wqflask/templates/show_trait.html2
2 files changed, 14 insertions, 0 deletions
diff --git a/wqflask/wqflask/show_trait/SampleList.py b/wqflask/wqflask/show_trait/SampleList.py
index dc98eb2b..aa6ada5a 100644
--- a/wqflask/wqflask/show_trait/SampleList.py
+++ b/wqflask/wqflask/show_trait/SampleList.py
@@ -112,6 +112,18 @@ class SampleList(object):
self.attributes[key].distinct_values = [item.Value for item in values]
self.attributes[key].distinct_values.sort(key=natural_sort_key)
+ all_numbers = True
+ for value in self.attributes[key].distinct_values:
+ try:
+ val_as_float = float(value)
+ except:
+ all_numbers = False
+
+ if all_numbers:
+ self.attributes[key].alignment = "right"
+ else:
+ self.attributes[key].alignment = "left"
+
def get_extra_attribute_values(self):
if self.attributes:
query = '''
diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html
index 0b4618f1..6719485a 100644
--- a/wqflask/wqflask/templates/show_trait.html
+++ b/wqflask/wqflask/templates/show_trait.html
@@ -260,6 +260,7 @@
{% if sample_groups[0].attributes|length > 0 %}
{% for attribute in sample_groups[0].attributes|sort() %}
$('td', row).eq(attribute_start_pos + {{ loop.index }}).addClass("column_name-{{ sample_groups[0].attributes[attribute].name }}")
+ $('td', row).eq(attribute_start_pos + {{ loop.index }}).attr("style", "text-align: {{ sample_groups[0].attributes[attribute].alignment }}; padding-top: 2px; padding-bottom: 0px;")
{% endfor %}
{% endif %}
},
@@ -403,6 +404,7 @@
{% if sample_groups[1].attributes|length > 0 %}
{% for attribute in sample_groups[1].attributes|sort() %}
$('td', row).eq(attribute_start_pos + {{ loop.index }}).addClass("column_name-{{ sample_groups[1].attributes[attribute].name }}")
+ $('td', row).eq(attribute_start_pos + {{ loop.index }}).attr("style", "text-align: {{ sample_groups[1].attributes[attribute].alignment }}; padding-top: 2px; padding-bottom: 0px;")
{% endfor %}
{% endif %}
},