diff options
author | Richard Wall <richard@the-moon.net> | 2013-06-20 23:59:41 +0100 |
---|---|---|
committer | Richard Wall <richard@the-moon.net> | 2013-06-20 23:59:41 +0100 |
commit | 5718df70d0af2c3ad9fb0e7b47b623f3a6e8f360 (patch) | |
tree | bd4a6fdfde2c34cd8d266ef6834ccc95e8f3f194 /jarmon/jarmon.js | |
parent | cfdc61b2569cd0ba5734325cf854e93fc12fa8d2 (diff) |
choose best si based on total length of y axis - negative to positive. Also add a few more step sizes to graphs without any ticks.richardw/independent-ds-transformers-1188220
Diffstat (limited to 'jarmon/jarmon.js')
-rw-r--r-- | jarmon/jarmon.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index a7d0adc..4e58334 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -649,8 +649,7 @@ jarmon.Chart = function(template, recipe, downloader) { }; var si = 0; while(true) { - if( Math.pow(1000, si+1)*0.9 > axis.max - && -(Math.pow(1000, si+1))*0.9 < axis.min ) { + if( Math.pow(1000, si+1)*0.9 > (axis.max - axis.min) ) { break; } si++; @@ -660,7 +659,7 @@ jarmon.Chart = function(template, recipe, downloader) { var maxVal = axis.max/Math.pow(1000, si); var stepSizes = [0.01, 0.05, 0.1, 0.25, 0.5, - 1, 5, 10, 25, 50, 100, 250]; + 1, 2, 5, 10, 20, 25, 50, 100, 250]; var realStep = (maxVal - minVal)/5.0; var stepSize, decimalPlaces = 0; |