You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/09/28 15:15:32 UTC

[60/69] [abbrv] stratos git commit: Show data not available message to Member Count Gadget

Show data not available message to Member Count Gadget


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8293e362
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8293e362
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8293e362

Branch: refs/heads/stratos-4.1.x
Commit: 8293e362e14d2b06d6c5cf4244beb26cd7743f25
Parents: 2565bd5
Author: Thanuja <th...@wso2.com>
Authored: Sat Sep 26 22:03:35 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon Sep 28 18:44:19 2015 +0530

----------------------------------------------------------------------
 .../Gadget_Member_Count/Member_Count/js/main.js | 57 +++++++++++---------
 1 file changed, 31 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/8293e362/extensions/das/metering-service/capps/stratos-metering-service/Gadget_Member_Count/Member_Count/js/main.js
----------------------------------------------------------------------
diff --git a/extensions/das/metering-service/capps/stratos-metering-service/Gadget_Member_Count/Member_Count/js/main.js b/extensions/das/metering-service/capps/stratos-metering-service/Gadget_Member_Count/Member_Count/js/main.js
index d54087a..303e282 100644
--- a/extensions/das/metering-service/capps/stratos-metering-service/Gadget_Member_Count/Member_Count/js/main.js
+++ b/extensions/das/metering-service/capps/stratos-metering-service/Gadget_Member_Count/Member_Count/js/main.js
@@ -131,34 +131,39 @@ function makeRows(data) {
 
 function drawChart(data) {
     var dataTable = makeDataTable(data);
-    gadgetConfig.chartConfig.width = $("#placeholder").width();
-    gadgetConfig.chartConfig.height = $("#placeholder").height() - 65;
-    var chartType = gadgetConfig.chartConfig.chartType;
-    var xAxis = gadgetConfig.chartConfig.xAxis;
-    var chart;
-    jQuery("#noChart").html("");
-    if (chartType === "bar" && dataTable.metadata.types[xAxis] === "N") {
-        dataTable.metadata.types[xAxis] = "C";
-    }
-
-    if (gadgetConfig.chartConfig.chartType === "tabular" || gadgetConfig.chartConfig.chartType === "singleNumber") {
-        gadgetConfig.chartConfig.height = $("#placeholder").height();
-        chart = igviz.draw("#placeholder", gadgetConfig.chartConfig, dataTable);
-        chart.plot(dataTable.data);
+    if (dataTable.data.length != 0) {
+        gadgetConfig.chartConfig.width = $("#placeholder").width();
+        gadgetConfig.chartConfig.height = $("#placeholder").height() - 65;
+        var chartType = gadgetConfig.chartConfig.chartType;
+        var xAxis = gadgetConfig.chartConfig.xAxis;
+        var chart;
+        jQuery("#noChart").html("");
+        if (chartType === "bar" && dataTable.metadata.types[xAxis] === "N") {
+            dataTable.metadata.types[xAxis] = "C";
+        }
 
+        if (gadgetConfig.chartConfig.chartType === "tabular" || gadgetConfig.chartConfig.chartType === "singleNumber") {
+            gadgetConfig.chartConfig.height = $("#placeholder").height();
+            chart = igviz.draw("#placeholder", gadgetConfig.chartConfig, dataTable);
+            chart.plot(dataTable.data);
+
+        } else {
+            chart = igviz.setUp("#placeholder", gadgetConfig.chartConfig, dataTable);
+            chart.setXAxis({
+                "labelAngle": -35,
+                "labelAlign": "right",
+                "labelDy": 0,
+                "labelDx": 0,
+                "titleDy": 25
+            })
+                .setYAxis({
+                    "titleDy": -30
+                });
+            chart.plot(dataTable.data);
+        }
     } else {
-        chart = igviz.setUp("#placeholder", gadgetConfig.chartConfig, dataTable);
-        chart.setXAxis({
-            "labelAngle": -35,
-            "labelAlign": "right",
-            "labelDy": 0,
-            "labelDx": 0,
-            "titleDy": 25
-        })
-            .setYAxis({
-                "titleDy": -30
-            });
-        chart.plot(dataTable.data);
+        jQuery("#placeholder").html("");
+        jQuery("#placeholder").append('<div id="noChart"><table><tr><td style="padding:30px 20px 0px 20px"><img src="../../portal/images/noEvents.png" align="left" style="width:24;height:24"/></td><td><br/><b><p><br/> Data is not available for plotting with selected values</p></b></td></tr></table></div>');
     }
     //releasing the latch so that we can request data again from the backend.
     dataLoaded = true;