[PATCH 6/8] HTML: add temperature curve to profile.

Miika Turkia miika.turkia at gmail.com
Fri Jul 4 04:37:10 PDT 2014


From: Gehad elrobey <gehadelrobey at gmail.com>

Add temperature curve to profile view, The curve is tracable by mouse.
The temperature has a hidden axis that doesn't appear in the detailed
view.

Signed-off-by: Gehad elrobey <gehadelrobey at gmail.com>
Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 theme/list_lib.js | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 67e80e4..92177dc 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -898,6 +898,8 @@ function canvas_draw()
 	var d1 = new Array();
 	var d2 = new Array();
 	var d3 = new Array();
+	var d4 = new Array();
+	var last = 0 ;
 	for (var i = 0; i < items[dive_id].samples.length; i++) {
 		d1.push([
 			items[dive_id].samples[i][0] / 60,
@@ -909,6 +911,21 @@ function canvas_draw()
 				mbar_to_bar(items[dive_id].samples[i][2])
 			]);
 		}
+		if (items[dive_id].samples[i][3] != 0) {
+			d4.push([
+				items[dive_id].samples[i][0] / 60,
+				mkelvin_to_C(items[dive_id].samples[i][3]),
+			]);
+			last = items[dive_id].samples[i][3];
+		}
+		else {
+			if(last != 0) {
+				d4.push([
+					items[dive_id].samples[i][0] / 60,
+					mkelvin_to_C(last),
+				]);
+			}
+		}
 	}
 	for (var i = 0; i < items[dive_id].events.length; i++) {
 		//var x = get_sample(items[dive_id].events[i].time);
@@ -921,7 +938,8 @@ function canvas_draw()
 	plot1 = $.jqplot('chart1', [
 					   d1,
 					   d2,
-					   d3
+					   d3,
+					   d4,
 				   ],
 			 {
 				 grid : {
@@ -965,6 +983,12 @@ function canvas_draw()
 						  markerOptions: { size: 10, style:"o" },
 						  pointLabels: { show:false, } ,
 					 },
+					 {
+						  showLine:true,
+						  showMarker : false,
+						  pointLabels: { show:false, } ,
+						  yaxis : 'y3axis',
+					 },
 				 ],
 				 axes : {
 					 xaxis : {
@@ -991,6 +1015,15 @@ function canvas_draw()
 						 },
 						 pad : 3.05
 					 },
+					 y3axis : {
+						padMax : 3.05,
+						tickOptions: {
+							showGridline: false,
+							showMark: false,
+							showLabel: false,
+							shadow: false,
+						},
+					 },
 				 }
 			 });
 }
-- 
1.9.1



More information about the subsurface mailing list