From 1bc7672b4e00010b186f75eacc26bdef1dfab56b Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 26 Jul 2019 11:13:23 -0500 Subject: Scatterplots should have consistent decimal places for axes now --- .../wqflask/static/new/javascript/draw_corr_scatterplot.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js index 4b212f8b..7cc89304 100644 --- a/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js +++ b/wqflask/wqflask/static/new/javascript/draw_corr_scatterplot.js @@ -1,6 +1,18 @@ var chart; var srchart; +x_val_range = js_data.x_range[1] - js_data.x_range[0] +y_val_range = js_data.y_range[1] - js_data.y_range[0] + + +if (x_val_range < 4 || y_val_range < 4){ + tick_digits = '.1f' +} else if (x_val_range < 0.4 || y_val_range < 0.4) { + tick_digits = '.2f' +} else { + tick_digits = 'f' +} + var layout = { height: 700, width: 800, @@ -17,6 +29,7 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + tickformat: tick_digits }, yaxis: { range: [js_data.y_range[0], js_data.y_range[1]], @@ -25,6 +38,7 @@ var layout = { visible: true, linecolor: 'black', linewidth: 1, + tickformat: tick_digits }, hovermode: "closest", showlegend: false -- cgit v1.2.3