From a5154cf2692912f0b348f98da68aeda41699e7a6 Mon Sep 17 00:00:00 2001 From: thisaripatabendi Date: Wed, 28 Jun 2017 12:39:52 +0530 Subject: [PATCH] Adding coffee level graph to realtime-analytics view --- .../analytics-view.hbs | 12 +++++----- .../analytics-view.js | 8 +++---- .../public/js/device-stats.js | 24 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.hbs b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.hbs index dfeb700d..09067e4c 100644 --- a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.hbs +++ b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.hbs @@ -17,26 +17,26 @@ }} {{unit "cdmf.unit.lib.rickshaw-graph"}} -
+
-
Temperature
+
Temperature
-
+
Time
-
+
-
Coffee Level
+
Coffee Level
-
+
Time
diff --git a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.js b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.js index 6f9583d2..2ef444f6 100644 --- a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.js +++ b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/analytics-view.js @@ -35,16 +35,16 @@ function onRequest(context) { if (tokenPair) { token = tokenPair.accessToken; } - websocketEndpoint1 = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?" + websocketEndpointTemperature = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type+ "&websocketToken=" + token; - websocketEndpoint2 = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.coffeelevel/1.0.0?" + websocketEndpointCoffeeLevel = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.coffeelevel/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type+ "&websocketToken=" + token; var websocketToken= {'name':'websocket-token','value': token, 'path':'/', "maxAge":18000}; response.addCookie(websocketToken); } return { "device": device, - "websocketEndpoint1": websocketEndpoint1, - "websocketEndpoint2": websocketEndpoint2 + "websocketEndpointTemperature": websocketEndpointTemperature, + "websocketEndpointCoffeeLevel": websocketEndpointCoffeeLevel }; } \ No newline at end of file diff --git a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/public/js/device-stats.js b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/public/js/device-stats.js index dc8240c1..17381ee5 100644 --- a/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/public/js/device-stats.js +++ b/modules/distribution/src/core/samples/connectedcup/component/ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.connectedcup.realtime.analytics-view/public/js/device-stats.js @@ -16,25 +16,25 @@ * under the License. */ -var wsConnection1; -var wsConnection2; -var graphForSensorType1; -var graphForSensorType2; -var chartDataSensorType1 = []; -var chartDataSensorType2 = []; +var wsConnectionTemperature; +var wsConnectionCoffeeLevel; +var graphForSensorTypeTemperature; +var graphForSensorTypeCoffeeLevel; +var chartDataSensorTypeTemperature = []; +var chartDataSensorTypeCoffeeLevel = []; var palette = new Rickshaw.Color.Palette({scheme: "classic9"}); $(window).load(function () { - drawGraph(wsConnection1, "#div-chart", "y_axis", "chart", chartDataSensorType1 - , graphForSensorType1); - drawGraph(wsConnection2, "#div-chart2", "y_axis2", "chart2", chartDataSensorType2 - , graphForSensorType2); + drawGraph(wsConnectionTemperature, "#div-chartTemperature", "y_axisTemperature", "chartTemperature", chartDataSensorTypeTemperature + , graphForSensorTypeTemperature); + drawGraph(wsConnectionCoffeeLevel, "#div-chartCoffeeLevel", "y_axisCoffeeLevel", "chartCoffeeLevel", chartDataSensorTypeCoffeeLevel + , graphForSensorTypeCoffeeLevel); }); window.onbeforeunload = function() { - disconnect(wsConnection1); - disconnect(wsConnection2); + disconnect(wsConnectionTemperature); + disconnect(wsConnectionCoffeeLevel); }; function drawGraph(wsConnection, placeHolder, yAxis, chat, chartData, graph) {