From 203349bdf21dc43b89c9776c57ee545651f5460f Mon Sep 17 00:00:00 2001
From: zsloan
Date: Thu, 1 Dec 2022 20:39:23 +0000
Subject: Variety of changes to basic stats figures
- Left-aligned bar-chart title
- Changed y-axis label for Violin Plot to 'Density'
- Always display modebar options
- Increase font size for y axis label for Violin Plot
---
.../wqflask/static/new/javascript/show_trait.js | 28 +++++++++++++++++-----
1 file changed, 22 insertions(+), 6 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/static/new/javascript/show_trait.js b/wqflask/wqflask/static/new/javascript/show_trait.js
index 7dcfbd89..1f76dbdf 100644
--- a/wqflask/wqflask/static/new/javascript/show_trait.js
+++ b/wqflask/wqflask/static/new/javascript/show_trait.js
@@ -1248,6 +1248,7 @@ if (Object.keys(js_data.sample_group_types).length > 1) {
// Define Plotly Options (for the options bar at the top of each figure)
root.modebar_options = {
+ displayModeBar: true,
modeBarButtonsToAdd:[{
name: 'Export as SVG',
icon: Plotly.Icons.disk,
@@ -1343,7 +1344,12 @@ if (js_data.num_values < 256) {
bottomMargin = getBarBottomMargin(sampleLists[0])
root.bar_layout = {
- title: "Trait " + js_data.trait_id + ": " + js_data.short_description + "",
+ title: {
+ x: 0,
+ y: 10,
+ xanchor: 'left',
+ text: "Trait " + js_data.trait_id + ": " + js_data.short_description + "",
+ },
xaxis: {
type: 'category',
titlefont: {
@@ -1397,7 +1403,10 @@ var hist_trace = {
root.histogram_data = [hist_trace];
root.histogram_layout = {
bargap: 0.05,
- title: "Trait " + js_data.trait_id + ": " + js_data.short_description + "",
+ title: {
+ xanchor: 'left',
+ text: "Trait " + js_data.trait_id + ": " + js_data.short_description + "",
+ },
xaxis: {
autorange: true,
title: js_data.unit_type,
@@ -1449,6 +1458,7 @@ $('.histogram_samples_group').change(function() {
// Violin Plot
root.violin_layout = {
+ title: "Trait " + js_data.trait_id + ": " + js_data.short_description + "",
xaxis: {
showline: true,
titlefont: {
@@ -1460,7 +1470,13 @@ root.violin_layout = {
}
},
yaxis: {
- title: ""+js_data.unit_type+"",
+ title: {
+ text: ""+js_data.unit_type+"",
+ font: {
+ family: 'arial',
+ size: 20
+ }
+ },
autorange: true,
showline: true,
titlefont: {
@@ -1478,7 +1494,7 @@ root.violin_layout = {
margin: {
l: 90,
r: 30,
- t: 30,
+ t: 100,
b: 80
}
};
@@ -1536,7 +1552,7 @@ if (fullSampleLists.length > 1) {
}
root.violin_data = [trace1, trace2, trace3]
} else {
- root.violin_layout['width'] = 300;
+ root.violin_layout['width'] = 400;
root.violin_layout['height'] = 400;
root.violin_data = [
{
@@ -1550,7 +1566,7 @@ if (fullSampleLists.length > 1) {
visible: true
},
name: "Trait " + js_data.trait_id + "",
- x0: "Trait " + js_data.trait_id + ""
+ x0: "Density"
}
]
}
--
cgit v1.2.3