diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-07-04 14:37:08 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-04 06:35:18 -0700 |
commit | 11d2364c129bf828563a07bc48e33c742bfc72c5 (patch) | |
tree | 62d755d9d496ab1e33eeb48e97181082f0bf1a69 | |
parent | f7f8c0b1b2b9bd0fbd81c8b01e996591d57df134 (diff) | |
download | subsurface-11d2364c129bf828563a07bc48e33c742bfc72c5.tar.gz |
HTML: add events to detailed profile view
Export events to detailed dive view and add events to the profile.
Events names must appear on mouse hover.
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>
-rw-r--r-- | save-html.c | 2 | ||||
-rw-r--r-- | theme/list_lib.js | 35 |
2 files changed, 33 insertions, 4 deletions
diff --git a/save-html.c b/save-html.c index d459b0e6e..e1116aa77 100644 --- a/save-html.c +++ b/save-html.c @@ -17,7 +17,7 @@ void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) put_string(b, "\"events\":["); while (ev) { put_format(b, "{\"name\":\"%s\",", ev->name); - put_format(b, "\"time\":\"%d:%02d min\",},", FRACTION(ev->time.seconds, 60)); + put_format(b, "\"time\":\"%d\",},", ev->time.seconds); ev = ev->next; } put_string(b, "],"); diff --git a/theme/list_lib.js b/theme/list_lib.js index 4347475c6..da63f0ca6 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -822,7 +822,7 @@ 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">' + event.time + '</td></tr>'; + return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + int_to_time(event.time) + '</td></tr>'; } /** @@ -878,6 +878,14 @@ function mm_to_meter(mm) return mm / (1000); } +function format_two_digit(n){ + return n > 9 ? "" + n: "0" + n; +} + +function int_to_time (n){ + return Math.floor((n) /60) +":"+ format_two_digit((n) % (60))+" min"; +} + var plot1; /** @@ -889,6 +897,7 @@ function canvas_draw() document.getElementById("chart1").innerHTML = ""; var d1 = new Array(); var d2 = new Array(); + var d3 = new Array(); for (var i = 0; i < items[dive_id].samples.length; i++) { d1.push([ items[dive_id].samples[i][0] / 60, @@ -901,9 +910,18 @@ function canvas_draw() ]); } } + for (var i = 0; i < items[dive_id].events.length; i++) { + //var x = get_sample(items[dive_id].events[i].time); + d3.push([ + items[dive_id].events[i].time / 60, + 0, + //-1 * mm_to_meter(items[dive_id].samples[x][1]) + ]); + } plot1 = $.jqplot('chart1', [ d1, - d2 + d2, + d3 ], { grid : { @@ -912,7 +930,13 @@ function canvas_draw() background : 'rgba(0,0,0,0)' }, highlighter : { - show : true + show : true, + tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) { + if(seriesIndex===2) + return items[dive_id].events[pointIndex].name; + else + return str; + } }, seriesDefaults : { shadowAlpha : 0.1, @@ -936,6 +960,11 @@ function canvas_draw() }, yaxis : 'y2axis', }, + { + showLine:false, + markerOptions: { size: 10, style:"o" }, + pointLabels: { show:false, } , + }, ], axes : { xaxis : { |