diff --git a/app/static/css/style.css b/app/static/css/style.css index e69de29..959f091 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -0,0 +1,3 @@ +.tagChart { + margin-bottom: 40px; +} diff --git a/app/static/index.html b/app/static/index.html index 363d272..31567ef 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -10,6 +10,7 @@ + diff --git a/app/static/js/gaugeoff.controller.js b/app/static/js/gaugeoff.controller.js index e8adf7f..fbf8aca 100644 --- a/app/static/js/gaugeoff.controller.js +++ b/app/static/js/gaugeoff.controller.js @@ -1,6 +1,7 @@ poconsole.controller('gaugeOffCtrl',function($scope, Page, $q, $http) { Page.setTitle('Gauge Off'); Page.setPage('gaugeoff'); + var colors = ['#d7191c','#fdae61','#abdda4','#2b83ba']; var getGaugeOffData = function(page_number){ var deferred = $q.defer(); $http.get('/api/gauge_off?q={"order_by":[{"field":"created_on","direction":"desc"}]}&page='+ page_number).success(function(data) { @@ -22,6 +23,159 @@ poconsole.controller('gaugeOffCtrl',function($scope, Page, $q, $http) { $scope.page_list = []; $scope.page_num = d.page; $scope.total = d.total; + var stroke_columns = [ + {key: "downhole_gross_stroke_average", label: "DH Gross Stroke Avg"}, + {key: "downhole_net_stroke_average", label: "DH Net Stroke Avg"}, + {key: "surface_stroke_length_average", label: "Surface Stroke Avg"}, + {key: "tubing_movement_average", label: "Tubing Movement Avg"} + ]; + var monetary_columns = [ + {key: "electricity_cost_total", label: "Electricity Cost"}, + {key: "lifting_cost_average", label: "Lifting Cost Avg"} + ]; + var energy_columns = [ + {key: "kWh_used_total", label: "kWh Used"}, + {key: "kWh_regen_total", label: "kWh Regen."} + ]; + var load_columns = [ + {key: "min_pr_load", label: "Min. PR Load"}, + {key: "peak_pr_load", label: "Peak PR Load"} + ]; + var other_columns = [ + + {key: "percent_run", label: "Percent Run"}, + {key: "fluid_level_average", label: "Fluid Level Avg"}, + {key: "inflow_rate_average", label: "Inflow Rate Avg"}, + {key: "polished_rod_hp_average", label: "PR HP Avg"}, + {key: "pump_hp_average", label: "Pump HP Avg"}, + {key: "spm_average", label: "SPM Avg"} + ]; + + $scope.stroke_options = { + series: [], + axes: { + x: { + key: "created_on", + type: "date" + } + } + }; + + $scope.monetary_options = { + series: [], + axes: { + x: { + key: "created_on", + type: "date" + } + } + }; + + $scope.energy_options = { + series: [], + axes: { + x: { + key: "created_on", + type: "date" + } + } + }; + $scope.load_options = { + series: [], + axes: { + x: { + key: "created_on", + type: "date" + } + } + }; + $scope.other_options = { + series: [], + axes: { + x: { + key: "created_on", + type: "date" + } + } + }; + + $scope.graphData = {}; + $scope.graphData.go_data = d.objects; + for (var s_col in stroke_columns){ + $scope.stroke_options.series.push( + { + axis: 'y', + dataset: 'go_data', + key: stroke_columns[s_col].key, + label: stroke_columns[s_col].label, + id: stroke_columns[s_col].key, + type: ['line'], + color: colors[s_col % colors.length], + drawDots:false + } + ); + } + + for (var m_col in monetary_columns){ + $scope.monetary_options.series.push( + { + axis: 'y', + dataset: 'go_data', + key: monetary_columns[m_col].key, + label: monetary_columns[m_col].label, + id: monetary_columns[m_col].key, + type: ['line'], + color: colors[m_col % colors.length], + drawDots:false + } + ); + } + + for (var e_col in energy_columns){ + $scope.energy_options.series.push( + { + axis: 'y', + dataset: 'go_data', + key: energy_columns[e_col].key, + label: energy_columns[e_col].label, + id: energy_columns[e_col].key, + type: ['line'], + color: colors[e_col % colors.length], + drawDots:false + } + ); + } + + for (var l_col in load_columns){ + $scope.load_options.series.push( + { + axis: 'y', + dataset: 'go_data', + key: load_columns[l_col].key, + label: load_columns[l_col].label, + id: load_columns[l_col].key, + type: ['line'], + color: colors[l_col % colors.length], + drawDots:false + } + ); + } + + for (var o_col in other_columns){ + $scope.other_options.series.push( + { + axis: 'y', + dataset: 'go_data', + key: other_columns[o_col].key, + label: other_columns[o_col].label, + id: other_columns[o_col].key, + type: ['line'], + color: colors[o_col % colors.length], + drawDots:false + } + ); + } + }); }; diff --git a/app/static/js/tagVals.controller.js b/app/static/js/tagVals.controller.js index d781623..facd2c4 100644 --- a/app/static/js/tagVals.controller.js +++ b/app/static/js/tagVals.controller.js @@ -119,6 +119,7 @@ poconsole.controller('tagValsCtrl', function($scope, $route, $http, $routeParams axis: "y", dataset: "vals", key: tagDefData[i2].name, + id: i2.toString(), label: tagDefData[i2].name, // color: "#1f77b4", color: colors[i2 % colors.length], @@ -126,6 +127,7 @@ poconsole.controller('tagValsCtrl', function($scope, $route, $http, $routeParams drawDots:false }); } + console.log($scope.options); }); }); }; diff --git a/app/static/templates/gaugeOff.html b/app/static/templates/gaugeOff.html index e3224fc..01b0714 100644 --- a/app/static/templates/gaugeOff.html +++ b/app/static/templates/gaugeOff.html @@ -51,4 +51,40 @@ +
+
+

Stroke Data

+
+ +
+
+ +
+

Monetary Data

+
+ +
+
+ +
+

Energy Data

+
+ +
+
+ +
+

Load Data

+
+ +
+
+ +
+

Other Data

+
+ +
+
+