Hi Miika, Sorry for the delay, I had some family vacations this week. I Implemented the yearly statistics into the HTML exports (Patches are attached), also there are some patches not applied to current master yet.. I am waiting your feedback.
Regards, Gehad On Mon, Jul 28, 2014 at 5:14 PM, Miika Turkia <[email protected]> wrote: > Thanks, you had one 'return' missing, which I added and did some rewording > on the commit messages. > > The lines on the horizontal axis are a bit weird currently. Shown on the > attached screenshot. The depth and pressure units get misaligned due to the > static temperature fix (I guess). > > miika > > > > On Sun, Jul 27, 2014 at 11:01 PM, Gehad Elrobey <[email protected]> > wrote: > >> I Attached four patches that fix the mentioned bugs. I ll still work on >> more improvements for the current javascript code. >> >> Regards, >> Gehad >> >> >> On Fri, Jul 25, 2014 at 8:02 AM, Miika Turkia <[email protected]> >> wrote: >> >>> On Thu, Jul 24, 2014 at 10:29 PM, Gehad Elrobey <[email protected]> >>> wrote: >>> >>>> >>>> I attached a patch with two more fixes. >>>> Now most of the bugs list seems to be resolved. >>>> >>> >>> It seems that the temperature graph is not drawn, if the temperature is >>> constant the whole dive. >>> >>> The layout seems to change for me when I open a dive on the divelist. >>> This is due to scrollbar appears on the browser window. If you could come >>> up with something that keeps the layout the same in this case. This >>> requires on my screen that I export just a few dives, having 10 dives on >>> the page causes the scroll bar to be there to begin with. >>> >>> Could give a - as value for such events that don't have any sensible >>> values. I suppose that heading is the only event where value 0 makes sense. >>> >>> Dive equipments seems to only include the cylinder information. It could >>> have also weight and suite... or the title should be changed to cylinder. >>> >>> >>> >>>> what do you recommend to be added for now? and what things are missing >>>> or need to be fixed as a priority? >>>> >>> >>> A statistics page could be next one to implement. Yearly and trip based >>> stats of the key values. You could also implement something that is >>> currently missing from Subsurface GUI - statistics of how many specific >>> tags are there, how many dives with certain buddies etc. One could come up >>> with quite a few ideas about how to graph different statistics out of the >>> date that is kept... But take small steps implementing this stuff. Better >>> to have basic stuff properly implemented first than a whole lot of >>> incomplete mess... >>> >>> >>>> On Mon, Jul 21, 2014 at 7:32 AM, Miika Turkia <[email protected]> >>>> wrote: >>>> >>>>> On Mon, Jul 21, 2014 at 8:16 AM, Gehad Elrobey <[email protected] >>>>> > wrote: >>>>> >>>>>> >>>>>> Hi miika, >>>>>> >>>>>> On Sun, Jul 20, 2014 at 8:02 AM, Miika Turkia <[email protected] >>>>>> > wrote: >>>>>> >>>>>>> New bugs I spotted: >>>>>>> >>>>>>> - The tooltip on temperature graphs shows actually the time >>>>>>> (concatenated with temperature unit). >>>>>>> >>>>>> >>>>>> what is it supposed to show? I think this is consistent will all the >>>>>> other curves in the profile. >>>>>> >>>>> >>>>> It should show the temperature value. The temperature graph is drawn >>>>> based on the temperature correctly, but the tooltip shows time since start >>>>> of the time, not the temperature. >>>>> >>>> >>>> I Can't reproduce this at all, this is working correctly with me in all >>>> the dives I have (Please see the attachments). >>>> >>> >>> Seems that I mis-read the value - thought the time is part of the >>> temperature. Maybe you could use colon instead of comma to separate the >>> time from the actual value. It would be a bit clearer that it is not 8,6 C >>> :D >>> >>> miika >>> >>>> >>>> >>>>> >>>>> >>>>>> I Also fixed the previous patches, and attached some new patches with >>>>>> them. >>>>>> There are still three bugs that I am working on them now. >>>>>> >>>>> >>>>> Thanks, I'll have a look later. >>>>> >>>>> >>>>>> - I am not sure about the search of location - e.g. if I write >>>>>>> "Mexico somethingthatdoesnotexist", I get all the locations in Mexico. >>>>>>> - Zooming in (ctrl++) and out (ctrl+-) and restoring zoom level >>>>>>> (ctrl+0) on firefox does not rescale the graph properly >>>>>>> - The heading and gaschange switches should use the value field from >>>>>>> the event, not the type field (type is still internal to subsurface, and >>>>>>> does not provide any useful information to the users, on the other hand >>>>>>> value would e.g. tell what gas we changed to) >>>>>>> >>>>>> >>>>>> Regarding the event value, is exporting the event value as a number >>>>>> is useful? or there is some enum strings that must be shown instead? >>>>>> >>>>> >>>>> The heading is degrees, as in compass. >>>>> >>>>> The gas change event's value contains the o2 per centage, of the gas >>>>> mix, or it can also contain the o2 and he content. Low order bits being o2 >>>>> and high order bits the he: >>>>> he = cur_event.value >> 16 >>>>> o2 = cur_event.value & 0xffff >>>>> >>>>> miika >>>>> >>>>> >>>>>> - If I go to next dive on detailed view, and hit one extra right >>>>>>> arrows after reaching the last dive, first click on left does not change >>>>>>> the selection, only re-clicking on left does >>>>>>> >>>>>>> I'll still do a bit of poking around once I have more time... >>>>>>> >>>>>>> miika >>>>>>> >>>>>>> >>>>>>> On Sat, Jul 19, 2014 at 6:30 AM, Gehad Elrobey < >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>>> I Attached some bug fixes, Still working on the remaining bugs. >>>>>>>> >>>>>>>> Regards, >>>>>>>> Gehad. >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Jul 15, 2014 at 11:22 PM, Tomaz Canabrava < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> On Tue, Jul 15, 2014 at 4:31 PM, Anton Lundin <[email protected]> >>>>>>>>> wrote: >>>>>>>>> > On 15 July, 2014 - Anton Lundin wrote: >>>>>>>>> > >>>>>>>>> >> On 15 July, 2014 - Miika Turkia wrote: >>>>>>>>> >> >>>>>>>>> >> > A few more bugs: >>>>>>>>> >> > - Trimix dives are missing He content (use e.g. test20.xml >>>>>>>>> for testing >>>>>>>>> >> > purposes) - Reported by Roberto, but mailing list was not >>>>>>>>> included >>>>>>>>> >> >>>>>>>>> >> Gaah. This is code that uses the event data straight off. In >>>>>>>>> the case of >>>>>>>>> >> SAMPLE_EVENT_GASCHANGE especially we need to map the event to >>>>>>>>> the >>>>>>>>> >> available cylinders and that way figure out which gas we are >>>>>>>>> using. >>>>>>>>> >> >>>>>>>>> >> Almost every place where we use get_gasmix_from_event we should >>>>>>>>> be using >>>>>>>>> >> get_cylinder_index instead and grab the "real" gasmix from the >>>>>>>>> cylinder, >>>>>>>>> >> except the case where get_gasmix_from_event is called from >>>>>>>>> >> get_cylinder_index =) >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> >> This was more work than anticipated when i first gave it a >>>>>>>>> stab. If no >>>>>>>>> >> one else untangles this I'll give it another stab later. >>>>>>>>> >> >>>>>>>>> >> >>>>>>>>> > >>>>>>>>> > Gaah 2. >>>>>>>>> > >>>>>>>>> > I of course miss-read the report and i was talking about what we >>>>>>>>> write >>>>>>>>> > in the regular-non-html-ui. >>>>>>>>> > >>>>>>>>> > I found another bug. >>>>>>>>> >>>>>>>>> :P >>>>>>>>> >>>>>>>>> > //Anton >>>>>>>>> _______________________________________________ >>>>>>>>> subsurface mailing list >>>>>>>>> [email protected] >>>>>>>>> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
From 21a5a59e15ad84bd0f447c076bd267f63d35b1e9 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Mon, 4 Aug 2014 16:26:08 +0300 Subject: [PATCH 8/8] HTML: don't replot the graph if not plotted before. Prevent plotting the graph when screen is resized before the graph is plotted for the first time. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/theme/list_lib.js b/theme/list_lib.js index 9be8079..438563f 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -1205,5 +1205,6 @@ function switchDives(e) } window.onresize = function(event) { - plot1.replot( { resetAxes: true } ); + if (plot1) + plot1.replot( { resetAxes: true } ); }; -- 1.9.1
From 4be26d77d17aa5571d66d39dad2bb7b5c9facba1 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Mon, 4 Aug 2014 14:02:16 +0300 Subject: [PATCH 7/8] HTML: Make export statistics optional. make exporting statistics to the HTML page optional. Signed-off-by: Gehad elrobey <[email protected]> --- qt-ui/divelogexportdialog.cpp | 41 ++++++++++++++++++++++------------------- qt-ui/divelogexportdialog.ui | 4 ++-- theme/dive_export.html | 3 +++ 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 03bdaf9..0b6ab73 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -93,6 +93,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename) exportHTMLsettings(json_settings); exportHTMLstatistics(stat_file); + export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked()); QString searchPath = getSubsurfaceDataPath("theme"); @@ -140,25 +141,27 @@ void DiveLogExportDialog::exportHTMLstatistics(const QString &filename) QTextStream out(&file); int i = 0; out << "divestat=["; - while (stats_yearly != NULL && stats_yearly[i].period) { - out << "{"; - out << "\"YEAR\":\"" << stats_yearly[i].period << "\","; - out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\","; - out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\","; - out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\","; - out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\","; - out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\","; - out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\","; - out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\","; - out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\","; - out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\","; - out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\","; - out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\","; - out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\","; - out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\","; - out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\","; - out << "},"; - i++; + if (ui->exportStatistics->isChecked()) { + while (stats_yearly != NULL && stats_yearly[i].period) { + out << "{"; + out << "\"YEAR\":\"" << stats_yearly[i].period << "\","; + out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\","; + out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\","; + out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\","; + out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\","; + out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\","; + out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\","; + out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\","; + out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\","; + out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\","; + out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\","; + out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\","; + out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\","; + out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\","; + out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\","; + out << "},"; + i++; + } } out << "]"; file.close(); diff --git a/qt-ui/divelogexportdialog.ui b/qt-ui/divelogexportdialog.ui index aeed088..0e8ef4a 100644 --- a/qt-ui/divelogexportdialog.ui +++ b/qt-ui/divelogexportdialog.ui @@ -216,9 +216,9 @@ </widget> </item> <item row="1" column="0"> - <widget class="QCheckBox" name="checkBox_2"> + <widget class="QCheckBox" name="exportStatistics"> <property name="text"> - <string>Minimum Javascript</string> + <string>Export Yearly Statistics</string> </property> </widget> </item> diff --git a/theme/dive_export.html b/theme/dive_export.html index 524f39a..83240a5 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -121,6 +121,9 @@ window.onload=function(){ showAllDives(); document.getElementById("divePanel").style.display='none'; document.getElementById("diveStat").style.display='none'; + if (divestat.length <= 0) + document.getElementById("stats_button").style.display='none'; + document.body.style.visibility='visible'; document.onkeydown = switchDives; -- 1.9.1
From d1bbddb421277dc30a7d0b3d788a6c42cf958269 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Mon, 4 Aug 2014 12:36:08 +0300 Subject: [PATCH 6/8] HTML: add Yearly Statistics view to the HTML export View JSON data of yearly statistics in HTML exports. Signed-off-by: Gehad elrobey <[email protected]> --- theme/dive_export.html | 13 +++++++++++++ theme/light.css | 24 ++++++++++++++++++++++++ theme/list_lib.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ theme/sand.css | 20 +++++++++++++++++++- 4 files changed, 104 insertions(+), 1 deletion(-) diff --git a/theme/dive_export.html b/theme/dive_export.html index a326e3b..524f39a 100644 --- a/theme/dive_export.html +++ b/theme/dive_export.html @@ -35,6 +35,10 @@ function load_scripts() document.getElementsByTagName("head")[0].appendChild(fileref); fileref=document.createElement('script'); + fileref.setAttribute("src", location.pathname + "_files/stat.json"); + document.getElementsByTagName("head")[0].appendChild(fileref); + + fileref=document.createElement('script'); fileref.setAttribute("src", location.pathname + "_files/settings.json"); document.getElementsByTagName("head")[0].appendChild(fileref); @@ -116,6 +120,7 @@ window.onload=function(){ sizeofpage=10; showAllDives(); document.getElementById("divePanel").style.display='none'; + document.getElementById("diveStat").style.display='none'; document.body.style.visibility='visible'; document.onkeydown = switchDives; @@ -155,6 +160,7 @@ function changeAdvSearch(e){ <button onClick="expandAll()"> Expand All </button> <button onClick="collapseAll()"> Collapse All </button> <button id="trip_button" onclick="toggleTrips();">trips</button> + <button id="stats_button" onclick="toggleStats();">Stats</button> </div> </div> <div id="header"> @@ -213,5 +219,12 @@ function changeAdvSearch(e){ </div> </div> </div> + <div id="diveStat"> + <center> + <button onClick="toggleStats()">Back to List</button> + </center> + <div id="diveStatsData"> + </div> + </div> </body> </html> diff --git a/theme/light.css b/theme/light.css index 6f69880..a1acbfa 100644 --- a/theme/light.css +++ b/theme/light.css @@ -144,6 +144,30 @@ input[type=checkbox]{ box-shadow: 10px 10px 5px #888888; } +#diveStat{ + padding:5px; + width:90%; + margin:0% 5% 0% 5%; + margin-bottom:50px; + background-color: rgba(88,121,139,0.3); + box-shadow: 10px 10px 5px #888888; +} + +#diveStatsData{ + overflow:scroll; + overflow-y:hidden; +} + +.statscell{ + min-width:100px; + margin:0px; +} + +#stats_header{ + background-color:#5f7f8f; +} + + button,#no_dives_selector{ font-size:13px; min-width:55px; diff --git a/theme/list_lib.js b/theme/list_lib.js index f5dc001..9be8079 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; diff --git a/theme/sand.css b/theme/sand.css index d17824c..befa861 100644 --- a/theme/sand.css +++ b/theme/sand.css @@ -128,7 +128,6 @@ input[type=checkbox]{ font-weight:bold; } - #controller{ min-width:200px; padding:10px; @@ -143,6 +142,25 @@ input[type=checkbox]{ box-shadow: 7px 7px 5px rgba(215, 107, 27, 0.43); } +#diveStat{ + padding:5px; + width:90%; + margin:0% 5% 0% 5%; + margin-bottom:50px; + background-color: rgba(88,121,139,0.3); + box-shadow: 10px 10px 5px #888888; +} + +#diveStatsData{ + overflow:scroll; + overflow-y:hidden; +} +.statscell{ + border-style:solid; + padding-right:100px; + margin:0px; +} + button,#no_dives_selector{ font-size:13px; min-width:55px; -- 1.9.1
From 6f94c29af22eaf310259a3102aec3dab0960d8af Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Mon, 4 Aug 2014 10:30:31 +0300 Subject: [PATCH 5/8] HTML: export yearly statistics to JSON files. Save Yearly statistics as JSON data to the stats_files. Signed-off-by: Gehad elrobey <[email protected]> --- qt-ui/divelogexportdialog.cpp | 34 ++++++++++++++++++++++++++++++++++ qt-ui/divelogexportdialog.h | 1 + 2 files changed, 35 insertions(+) diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 33b037d..03bdaf9 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -14,6 +14,7 @@ #include "worldmap-save.h" #include "save-html.h" #include "helpers.h" +#include "statistics.h" DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent), ui(new Ui::DiveLogExportDialog) @@ -85,11 +86,13 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename) QString json_dive_data = exportFiles + QDir::separator() + "file.json"; QString json_settings = exportFiles + QDir::separator() + "settings.json"; + QString stat_file = exportFiles + QDir::separator() + "stat.json"; QString photos_directory = exportFiles + QDir::separator() + "photos" + QDir::separator(); mainDir.mkdir(photos_directory); exportFiles += "/"; exportHTMLsettings(json_settings); + exportHTMLstatistics(stat_file); export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked()); QString searchPath = getSubsurfaceDataPath("theme"); @@ -130,6 +133,37 @@ void DiveLogExportDialog::exportHTMLsettings(const QString &filename) file.close(); } +void DiveLogExportDialog::exportHTMLstatistics(const QString &filename) +{ + QFile file(filename); + file.open(QIODevice::WriteOnly | QIODevice::Text); + QTextStream out(&file); + int i = 0; + out << "divestat=["; + while (stats_yearly != NULL && stats_yearly[i].period) { + out << "{"; + out << "\"YEAR\":\"" << stats_yearly[i].period << "\","; + out << "\"DIVES\":\"" << stats_yearly[i].selection_size << "\","; + out << "\"TOTAL_TIME\":\"" << get_time_string(stats_yearly[i].total_time.seconds, 0) << "\","; + out << "\"AVERAGE_TIME\":\"" << get_minutes(stats_yearly[i].total_time.seconds / stats_yearly[i].selection_size) << "\","; + out << "\"SHORTEST_TIME\":\"" << get_minutes(stats_yearly[i].shortest_time.seconds) << "\","; + out << "\"LONGEST_TIME\":\"" << get_minutes(stats_yearly[i].longest_time.seconds) << "\","; + out << "\"AVG_DEPTH\":\"" << get_depth_string(stats_yearly[i].avg_depth) << "\","; + out << "\"MIN_DEPTH\":\"" << get_depth_string(stats_yearly[i].min_depth) << "\","; + out << "\"MAX_DEPTH\":\"" << get_depth_string(stats_yearly[i].max_depth) << "\","; + out << "\"AVG_SAC\":\"" << get_volume_string(stats_yearly[i].avg_sac) << "\","; + out << "\"MIN_SAC\":\"" << get_volume_string(stats_yearly[i].min_sac) << "\","; + out << "\"MAX_SAC\":\"" << get_volume_string(stats_yearly[i].max_sac) << "\","; + out << "\"AVG_TEMP\":\"" << QString::number(stats_yearly[i].combined_temp / stats_yearly[i].combined_count, 'f', 1) << "\","; + out << "\"MIN_TEMP\":\"" << get_temp_units(stats_yearly[i].min_temp, NULL) << "\","; + out << "\"MAX_TEMP\":\"" << get_temp_units(stats_yearly[i].max_temp, NULL) << "\","; + out << "},"; + i++; + } + out << "]"; + file.close(); +} + void DiveLogExportDialog::on_exportGroup_buttonClicked(QAbstractButton *button) { showExplanation(); diff --git a/qt-ui/divelogexportdialog.h b/qt-ui/divelogexportdialog.h index 1177505..e398a5a 100644 --- a/qt-ui/divelogexportdialog.h +++ b/qt-ui/divelogexportdialog.h @@ -25,6 +25,7 @@ private: void showExplanation(); void exportHtmlInit(const QString &filename); void exportHTMLsettings(const QString &filename); + void exportHTMLstatistics(const QString &filename); void copy_and_overwrite(const QString &fileName, const QString &newName); }; -- 1.9.1
From b3f112952a7377e8951cbc65855580309096d04b Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sun, 27 Jul 2014 21:38:50 +0200 Subject: [PATCH 4/8] HTML: add weight systems to the dive equipments section. add weights systems to the dive equipmenets. which contains weight and suite. Signed-off-by: Gehad elrobey <[email protected]> --- save-html.c | 22 ++++++++++++++++++++++ theme/list_lib.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/save-html.c b/save-html.c index f777de0..652ffb4 100644 --- a/save-html.c +++ b/save-html.c @@ -44,6 +44,27 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) put_string(b, "],"); } +static void put_weightsystem_HTML(struct membuffer *b, struct dive *dive) +{ + int i, nr; + + nr = nr_weightsystems(dive); + + put_string(b, "\"Weights\":["); + + for (i = 0; i < nr; i++) { + weightsystem_t *ws = dive->weightsystem + i; + int grams = ws->weight.grams; + const char *description = ws->description; + + put_string(b, "{"); + put_format(b, "\"weight\":\"%d\",", grams); + write_attribute(b, "description", description); + put_string(b, "},"); + } + put_string(b, "],"); +} + static void put_cylinder_HTML(struct membuffer *b, struct dive *dive) { int i, nr; @@ -199,6 +220,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d put_HTML_notes(b, dive, "\"notes\":\"", "\","); if (!list_only) { put_cylinder_HTML(b, dive); + put_weightsystem_HTML(b, dive); put_HTML_samples(b, dive); put_HTML_bookmarks(b, dive); write_dive_status(b, dive); diff --git a/theme/list_lib.js b/theme/list_lib.js index 465ef23..f5dc001 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -736,6 +736,28 @@ function lastNonZero() } /** +*Return the HTML string for a dive weight entry in the table. +*/ +function get_weight_HTML(weight) +{ + return '<tr><td class="Cyl">' + gram_to_km(weight.weight) + ' kg ' + '</td><td class="Cyl">' + weight.description + '</td></tr>'; +} + +/** +*Return HTML table of weights of a dive. +*/ +function get_weights_HTML(dive) +{ + var result = ""; + result += '<table><tr><td class="words">Weight</td><td class="words">Type</td></tr>'; + for (var i in dive.Weights) { + result += get_weight_HTML(dive.Weights[i]); + } + result += '</table>'; + return result; +} + +/** *Return the HTML string for a dive cylinder entry in the table. */ function get_cylinder_HTML(cylinder) @@ -890,6 +912,11 @@ function mm_to_meter(mm) return mm / (1000); } +function gram_to_km(gram) +{ + return gram / 1000; +} + function ml_to_litre(ml) { return ml / (1000); @@ -1067,6 +1094,7 @@ function showDiveDetails(dive) //draw the canvas and initialize the view document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]); document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]); + document.getElementById("dive_equipments").innerHTML += get_weights_HTML(items[dive_id]); document.getElementById("bookmarks").innerHTML = get_bookmarks_HTML(items[dive_id]); document.getElementById("divestats").innerHTML = get_status_HTML(items[dive_id]); document.getElementById("slider").innerHTML = get_dive_photos(items[dive_id]); -- 1.9.1
From 4add4e89669fd14a4e5c44867299247229206406 Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 26 Jul 2014 16:59:49 +0200 Subject: [PATCH 3/8] HTML: Fix constant value temperature curve. when temperature is constant the temperature curve is stucking at the top of the profile view. Maximum temperature value is set to 50 degrees cel. this will always put the curve in the right place. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 1 + 1 file changed, 1 insertion(+) diff --git a/theme/list_lib.js b/theme/list_lib.js index a5e5cf6..465ef23 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -1038,6 +1038,7 @@ function canvas_draw() }, y3axis : { padMax : 3.05, + max : 50, tickOptions: { showGridline: false, showMark: false, -- 1.9.1
From 590ef3d75de70b65224a3c53aee8fcde9682e87f Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 26 Jul 2014 16:58:27 +0200 Subject: [PATCH 2/8] HTML: fix jqplot memory leaks when replot the profile. When replot the profile, old plots must be deleted to avoid memory leaks. Signed-off-by: Gehad elrobey <[email protected]> --- theme/list_lib.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/theme/list_lib.js b/theme/list_lib.js index e4b9837..a5e5cf6 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -949,6 +949,11 @@ function canvas_draw() 0 ]); } + if (plot1) + { + $('chart1').unbind(); + plot1.destroy(); + } plot1 = $.jqplot('chart1', [ depthData, pressureData, -- 1.9.1
From d1629562ed8e8471b0092d8b0522fd135e5e116a Mon Sep 17 00:00:00 2001 From: Gehad elrobey <[email protected]> Date: Sat, 26 Jul 2014 16:29:16 +0200 Subject: [PATCH 1/8] HTML: Fix event value fields. -The gas event values can contain o2 and he mix in gas change events. -Give a '-' value for events that don't have any sensible values. -show event value if event type is heading. Signed-off-by: Gehad elrobey <[email protected]> --- save-html.c | 1 + theme/list_lib.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/save-html.c b/save-html.c index 75f7542..f777de0 100644 --- a/save-html.c +++ b/save-html.c @@ -37,6 +37,7 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) while (ev) { put_format(b, "{\"name\":\"%s\",", ev->name); put_format(b, "\"value\":\"%d\",", ev->value); + put_format(b, "\"type\":\"%d\",", ev->type); put_format(b, "\"time\":\"%d\",},", ev->time.seconds); ev = ev->next; } diff --git a/theme/list_lib.js b/theme/list_lib.js index 904bde5..e4b9837 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -769,12 +769,25 @@ function get_cylinders_HTML(dive) return result; } +function get_event_value(event) +{ + if (event.type == 11 || event.type == 25) { // gas change + var he = event.value >> 16; + var o2 = event.value & 0xffff; + return 'He: ' + he + ' - O2: ' + o2; + } + if (event.type == 23) { // heading + event.value; + } + return '-'; +} + /** Return the HTML string for a bookmark entry in the table. */ function get_bookmark_HTML(event) { - return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td><td class="Cyl">' + event.value + '</td></tr>'; + return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td><td class="Cyl">' + get_event_value(event) + '</td></tr>'; } /** -- 1.9.1
_______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
