From d8343f962c3c882b09f6a8a157dae679a23cd493 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sun, 10 Apr 2016 08:46:01 +0200 Subject: added the web part Signed-off-by: Olivier Gayot --- webapp/index.html | 27 + webapp/js/back_up.js | 128 + webapp/js/fusioncharts.js | 1463 +++++ webapp/js/fusioncharts.theme.fint.js | 18 + webapp/js/fusioncharts.widgets.js | 458 ++ webapp/js/jquery-2.2.3.js | 9842 ++++++++++++++++++++++++++++++++++ webapp/js/jquery.notify.js | 156 + webapp/style/back_up.css | 8 + webapp/style/jquery.dynameter.css | 104 + 9 files changed, 12204 insertions(+) create mode 100644 webapp/index.html create mode 100644 webapp/js/back_up.js create mode 100644 webapp/js/fusioncharts.js create mode 100644 webapp/js/fusioncharts.theme.fint.js create mode 100644 webapp/js/fusioncharts.widgets.js create mode 100644 webapp/js/jquery-2.2.3.js create mode 100644 webapp/js/jquery.notify.js create mode 100644 webapp/style/back_up.css create mode 100644 webapp/style/jquery.dynameter.css (limited to 'webapp') diff --git a/webapp/index.html b/webapp/index.html new file mode 100644 index 0000000..9b81d2a --- /dev/null +++ b/webapp/index.html @@ -0,0 +1,27 @@ + + + + + Back'Up + + + + + + + + + + + + + + + + + +
MeasurementValue
Pressure Top
Pressure Bottom
Flexion
Angle x
Angle y
Angle z
+ +
+ + diff --git a/webapp/js/back_up.js b/webapp/js/back_up.js new file mode 100644 index 0000000..d242506 --- /dev/null +++ b/webapp/js/back_up.js @@ -0,0 +1,128 @@ +var BackUp = function() { + var ws; + + var self = this; + + var $pressionTop = $('#pression-top-val'); + var $pressionBottom = $('#pression-bottom-val'); + var $flexion = $('#flexion-val'); + var $angleX = $('#angle-x-val'); + var $angleY = $('#angle-y-val'); + var $angleZ = $('#angle-z-val'); + + var gauge; + + FusionCharts.ready(function () { + gauge = new FusionCharts({ + 'id': 'chart', + 'type': 'angulargauge', + 'renderAt': 'fusioncharts-div', + 'width': '1000', + 'height': '500', + 'dataFormat': 'json', + 'dataSource': { + 'chart': { + //'caption': 'Inclinaison', + 'lowerLimit': '160', + 'upperLimit': '200', + 'theme': 'fint', + "gaugeFillMix": "{dark-40},{light-40},{dark-20}", + 'bgColor': '#00b0c0', + }, + 'colorRange': { + 'color': [ + { + 'minValue': '160', + 'maxValue': '171', + 'code': '#b41527', + }, { + 'minValue': '171', + 'maxValue': '175', + 'code': '#e48739', + }, { + 'minValue': '175', + 'maxValue': '185', + 'code': '#399e38', + }, { + 'minValue': '185', + 'maxValue': '189', + 'code': '#e48739', + }, { + 'minValue': '189', + 'maxValue': '200', + 'code': '#b41527', + }, + ], + }, + 'dials': { + 'dial': [ { + 'id': 'Dial1', + 'value': '180', + 'borderalpha': '0', + 'bgColor': '0,#aaaaaa,0', + 'basewidth': '40', + 'topwidth': '1', + 'radius': '300', + }, ], + }, + }, + }); + + gauge.render(); + + window.gauge = gauge; + }); + + this.run = function() { + var uri = 'ws://' + document.location.hostname + ':1234'; + + ws = new WebSocket(uri); + + ws.onopen = function() { + console.log('open'); + }; + + ws.onerror = function(evt) { + console.log(evt); + }; + + ws.onclose = function() { + console.log('connection closed by remote host') + }; + + ws.onmessage = function(evt) { + /* TODO */ + + var message = JSON.parse(evt.data); + + //console.log(message); + + $pressionTop.text(message['pressure_top']); + $pressionBottom.text(message['pressure_bottom']); + $flexion.text(message['flexion']); + + if (message['angle_x']) { + angle = parseInt(message['angle_x'], 10) + 90; + + ref = FusionCharts.getObjectReference('chart'); + + ref.feedData('value=' + angle); + $angleX.text(angle); + } + + $angleY.text(message['angle_y']); + $angleZ.text(message['angle_z']); + }; + }; +}; + +var back_up; + +window.back_up = back_up; + +$(document).ready(function() { + back_up = new BackUp(); + + back_up.run(); +}); + diff --git a/webapp/js/fusioncharts.js b/webapp/js/fusioncharts.js new file mode 100644 index 0000000..0a7ca47 --- /dev/null +++ b/webapp/js/fusioncharts.js @@ -0,0 +1,1463 @@ +/* + FusionCharts JavaScript Library + Copyright FusionCharts Technologies LLP + License Information at + FusionCharts JavaScript Library + Copyright FusionCharts Technologies LLP + License Information at + + @version 3.10.1 + + @attributions (infers respective third-party copyrights) + Raphael 2.1.0 (modified as 'Red Raphael') + JSON v2 + Firebug Lite 1.3.0 +*/ +(function(){if(!window.FusionCharts||!window.FusionCharts.version){var e=window,q=e.document,F=e.navigator,u={window:e},d=u.modules={},a=u.interpreters={},t=Object.prototype.toString,E=/msie/i.test(F.userAgent)&&!e.opera,c=/loaded|complete/,l=!1,b=function(){var a=u.ready;u.ready=!0;u.raiseEvent&&(u.readyNotified=!0,u.raiseEvent("ready",{version:u.core.version,now:!a},u.core));u.readyNow=!a},r=function(a,b){var g,k;if(b instanceof Array)for(g=0;g\x3c/script>'):q.write('