diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-08-04 12:36:08 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-04 10:03:15 -0700 |
commit | e968d91943bbcaf25cd3a1df84fc4d09bc889c94 (patch) | |
tree | fca9f4fd360e558058a505902af755526110e356 /theme/list_lib.js | |
parent | 5076e431d5388b2d142628cb2c5a18a45e22666a (diff) | |
download | subsurface-e968d91943bbcaf25cd3a1df84fc4d09bc889c94.tar.gz |
HTML: add Yearly Statistics view to the HTML export
View JSON data of yearly statistics in HTML exports.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'theme/list_lib.js')
-rw-r--r-- | theme/list_lib.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/theme/list_lib.js b/theme/list_lib.js index 88a621028..be2f969d5 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -646,6 +646,54 @@ function searchin(value, node) return null; } +//stats + +var statsShows; + +/** +*This is the main function called to show/hide trips +*/ +function toggleStats() +{ + var stats_button = document.getElementById('stats_button'); + if (statsShows) { + statsShows = false; + stats_button.style.backgroundColor = "#dfdfdf"; + document.getElementById('diveListPanel').style.display='block'; + document.getElementById('diveStat').style.display='none'; + } else { + document.getElementById('diveListPanel').style.display='none'; + document.getElementById('diveStat').style.display='block'; + stats_button.style.backgroundColor = "#5f7f8f"; + statsShows = true; + showStats(); + } +} + +function showStats() +{ + document.getElementById('diveStatsData').innerHTML = ''; + document.getElementById('diveStatsData').innerHTML += getDiveStats(); +} + +function getDiveStats(){ + var res = ""; + res += '<table><tr id="stats_header">'; + res += '<td class="statscell">Year</td><td class="statscell">#</td><td class="statscell">Total Time</td><td class="statscell">Avarage Time</td><td class="statscell">Shortest Time</td><td class="statscell">Longest Time</td><td class="statscell">Avarage Depth</td><td class="statscell">Min Depth</td><td class="statscell">Max Depth</td><td class="statscell">Average SAC</td><td class="statscell">Min SAC</td><td class="statscell">Max SAC</td><td class="statscell">Average Temp</td><td class="statscell">Min Temp</td><td class="statscell">Max Temp</td>'; + res += '</tr>'; + res += getStatsRows(); + res += '</table>'; + return res; +} + +function getStatsRows(){ + var res = ""; + for(var i = 0; i < divestat.length ; i++) { + res += '<tr><td class="statscell">'+divestat[i].YEAR+'</td><td class="statscell">'+divestat[i].DIVES+'</td><td class="statscell">'+divestat[i].TOTAL_TIME+'</td><td class="statscell">'+divestat[i].AVERAGE_TIME+'</td><td class="statscell">'+divestat[i].SHORTEST_TIME+'</td><td class="statscell">'+divestat[i].LONGEST_TIME+'</td><td class="statscell">'+divestat[i].AVG_DEPTH+'</td><td class="statscell">'+divestat[i].MIN_DEPTH+'</td><td class="statscell">'+divestat[i].MAX_DEPTH+'</td><td class="statscell">'+divestat[i].AVG_SAC+'</td><td class="statscell">'+divestat[i].MIN_SAC+'</td><td class="statscell">'+divestat[i].MAX_SAC+'</td><td class="statscell">'+divestat[i].AVG_TEMP+'</td><td class="statscell">'+divestat[i].MIN_TEMP+'</td><td class="statscell">'+divestat[i].MAX_TEMP+'</td></tr>'; + } + return res; +} + //trips var tripsShown; |