From 3229b6a521806c09a83f3fc094fe834d431f486d Mon Sep 17 00:00:00 2001 From: hngo Date: Wed, 7 Jun 2017 18:30:09 -0700 Subject: [PATCH] Fixed UI labels --- lib/openeis-ui/openeis/ui/static/openeis-ui/js/app.min.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/openeis-ui/openeis/ui/static/openeis-ui/js/app.min.js b/lib/openeis-ui/openeis/ui/static/openeis-ui/js/app.min.js index cd3ed20..71acd6c 100644 --- a/lib/openeis-ui/openeis/ui/static/openeis-ui/js/app.min.js +++ b/lib/openeis-ui/openeis/ui/static/openeis-ui/js/app.min.js @@ -50,8 +50,8 @@ operated by BATTELLE for the UNITED STATES DEPARTMENT OF ENERGY under Contract DE-AC05-76RL01830 */ !function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.tv4=b()}(this,function(){function a(a){return encodeURI(a).replace(/%25[0-9][0-9]/g,function(a){return"%"+a.substring(3)})}function b(b){var c="";m[b.charAt(0)]&&(c=b.charAt(0),b=b.substring(1));var d="",e="",f=!0,g=!1,h=!1;"+"===c?f=!1:"."===c?(e=".",d="."):"/"===c?(e="/",d="/"):"#"===c?(e="#",f=!1):";"===c?(e=";",d=";",g=!0,h=!0):"?"===c?(e="?",d="&",g=!0):"&"===c&&(e="&",d="&",g=!0);for(var i=[],j=b.split(","),k=[],l={},o=0;o0&&(c+=l.suffices["*"]?d||",":",",l.suffices["*"]&&g&&(c+=l.name+"=")),c+=f?encodeURIComponent(m[n]).replace(/!/g,"%21"):a(m[n])}else if("object"==typeof m){g&&!l.suffices["*"]&&(c+=l.name+"=");var o=!0;for(var p in m)o||(c+=l.suffices["*"]?d||",":","),o=!1,c+=f?encodeURIComponent(p).replace(/!/g,"%21"):a(p),c+=l.suffices["*"]?"=":",",c+=f?encodeURIComponent(m[p]).replace(/!/g,"%21"):a(m[p])}else g&&(c+=l.name,h&&""===m||(c+="=")),null!=l.truncate&&(m=m.substring(0,l.truncate)),c+=f?encodeURIComponent(m).replace(/!/g,"%21"):a(m)}return c};return u.varNames=i,{prefix:e,substitution:u}}function c(a){if(!(this instanceof c))return new c(a);for(var d=a.split("{"),e=[d.shift()],f=[],g=[],h=[];d.length>0;){var i=d.shift(),j=i.split("}")[0],k=i.substring(j.length+1),l=b(j);g.push(l.substitution),f.push(l.prefix),e.push(k),h=h.concat(l.substitution.varNames)}this.fill=function(a){for(var b=e[0],c=0;c0&&"/"===b.charAt(a.length-1)||"#"===c.charAt(0)||"?"===c.charAt(0))return!0}return!1}function l(a){var b,c,d=new o,e={setErrorReporter:function(a){return"string"==typeof a?this.language(a):(c=a,!0)},addFormat:function(){d.addFormat.apply(d,arguments)},language:function(a){return a?(v[a]||(a=a.split("-")[0]),v[a]?(b=a,a):!1):b},addLanguage:function(a,b){var c;for(c in r)b[c]&&!b[r[c]]&&(b[r[c]]=b[c]);var d=a.split("-")[0];if(v[d]){v[a]=Object.create(v[d]);for(c in b)"undefined"==typeof v[d][c]&&(v[d][c]=b[c]),v[a][c]=b[c]}else v[a]=b,v[d]=b;return this},freshApi:function(a){var b=l();return a&&b.language(a),b},validate:function(a,e,f,g){var h=i(b),j=c?function(a,b,d){return c(a,b,d)||h(a,b,d)}:h,k=new o(d,!1,j,f,g);"string"==typeof e&&(e={$ref:e}),k.addSchema("",e);var l=k.validateAll(a,e,null,null,"");return!l&&g&&(l=k.banUnknownProperties(a,e)),this.error=l,this.missing=k.missing,this.valid=null===l,this.valid},validateResult:function(){var a={};return this.validate.apply(a,arguments),a},validateMultiple:function(a,e,f,g){var h=i(b),j=c?function(a,b,d){return c(a,b,d)||h(a,b,d)}:h,k=new o(d,!0,j,f,g);"string"==typeof e&&(e={$ref:e}),k.addSchema("",e),k.validateAll(a,e,null,null,""),g&&k.banUnknownProperties(a,e);var l={};return l.errors=k.errors,l.missing=k.missing,l.valid=0===l.errors.length,l},addSchema:function(){return d.addSchema.apply(d,arguments)},getSchema:function(){return d.getSchema.apply(d,arguments)},getSchemaMap:function(){return d.getSchemaMap.apply(d,arguments)},getSchemaUris:function(){return d.getSchemaUris.apply(d,arguments)},getMissingUris:function(){return d.getMissingUris.apply(d,arguments)},dropSchemas:function(){d.dropSchemas.apply(d,arguments)},defineKeyword:function(){d.defineKeyword.apply(d,arguments)},defineError:function(a,b,c){if("string"!=typeof a||!/^[A-Z]+(_[A-Z]+)*$/.test(a))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeof b||b%1!==0||1e4>b)throw new Error("Code number must be an integer > 10000");if("undefined"!=typeof r[a])throw new Error("Error already defined: "+a+" as "+r[a]);if("undefined"!=typeof s[b])throw new Error("Error code already used: "+s[b]+" as "+b);r[a]=b,s[b]=a,u[a]=u[b]=c;for(var d in v){var e=v[d];e[a]&&(e[b]=e[b]||e[a])}},reset:function(){d.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:h,resolveUrl:f,getDocumentUri:g,errorCodes:r};return e.language(a||"en"),e}Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on non-object");var f=[];for(var g in e)a.call(e,g)&&f.push(g);if(b)for(var h=0;d>h;h++)a.call(e,c[h])&&f.push(c[h]);return f}}()),Object.create||(Object.create=function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return a.prototype=b,new a}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),Object.isFrozen||(Object.isFrozen=function(a){for(var b="tv4_test_frozen_key";a.hasOwnProperty(b);)b+=Math.random();try{return a[b]=!0,delete a[b],!1}catch(c){return!0}});var m={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},n={"*":!0};c.prototype={toString:function(){return this.template},fillFromObject:function(a){return this.fill(function(b){return a[b]})}};var o=function(a,b,c,d,e){if(this.missing=[],this.missingMap={},this.formatValidators=a?Object.create(a.formatValidators):{},this.schemas=a?Object.create(a.schemas):{},this.collectMultiple=b,this.errors=[],this.handleError=b?this.collectError:this.returnError,d&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),e&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=c||i("en"),"string"==typeof this.errorReporter)throw new Error("debug");if(this.definedKeywords={},a)for(var f in a.definedKeywords)this.definedKeywords[f]=a.definedKeywords[f].slice(0)};o.prototype.defineKeyword=function(a,b){this.definedKeywords[a]=this.definedKeywords[a]||[],this.definedKeywords[a].push(b)},o.prototype.createError=function(a,b,c,d,e,f,g){var h=new j(a,b,c,d,e);return h.message=this.errorReporter(h,f,g),h},o.prototype.returnError=function(a){return a},o.prototype.collectError=function(a){return a&&this.errors.push(a),null},o.prototype.prefixErrors=function(a,b,c){for(var d=a;d=p&&q>d)return this.createError(r.NUMBER_MULTIPLE_OF,{value:a,multipleOf:c},"","",null,a,b)}return null},o.prototype.validateMinMax=function(a,b){if("number"!=typeof a)return null;if(void 0!==b.minimum){if(ab.maximum)return this.createError(r.NUMBER_MAXIMUM,{value:a,maximum:b.maximum},"","/maximum",null,a,b);if(b.exclusiveMaximum&&a===b.maximum)return this.createError(r.NUMBER_MAXIMUM_EXCLUSIVE,{value:a,maximum:b.maximum},"","/exclusiveMaximum",null,a,b)}return null},o.prototype.validateNaN=function(a,b){return"number"!=typeof a?null:isNaN(a)===!0||a===1/0||a===-(1/0)?this.createError(r.NUMBER_NOT_A_NUMBER,{value:a},"","/type",null,a,b):null},o.prototype.validateString=function(a,b,c){return this.validateStringLength(a,b,c)||this.validateStringPattern(a,b,c)||null},o.prototype.validateStringLength=function(a,b){return"string"!=typeof a?null:void 0!==b.minLength&&a.lengthb.maxLength?this.createError(r.STRING_LENGTH_LONG,{length:a.length,maximum:b.maxLength},"","/maxLength",null,a,b):null},o.prototype.validateStringPattern=function(a,b){if("string"!=typeof a||"string"!=typeof b.pattern&&!(b.pattern instanceof RegExp))return null;var c;if(b.pattern instanceof RegExp)c=b.pattern;else{var d,e="",f=b.pattern.match(/^\/(.+)\/([img]*)$/);f?(d=f[1],e=f[2]):d=b.pattern,c=new RegExp(d,e)}return c.test(a)?null:this.createError(r.STRING_PATTERN,{pattern:b.pattern},"","/pattern",null,a,b)},o.prototype.validateArray=function(a,b,c){return Array.isArray(a)?this.validateArrayLength(a,b,c)||this.validateArrayUniqueItems(a,b,c)||this.validateArrayItems(a,b,c)||null:null},o.prototype.validateArrayLength=function(a,b){var c;return void 0!==b.minItems&&a.lengthb.maxItems&&(c=this.createError(r.ARRAY_LENGTH_LONG,{length:a.length,maximum:b.maxItems},"","/maxItems",null,a,b),this.handleError(c))?c:null},o.prototype.validateArrayUniqueItems=function(a,b){if(b.uniqueItems)for(var c=0;cb.maxProperties&&(c=this.createError(r.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:d.length,maximum:b.maxProperties},"","/maxProperties",null,a,b),this.handleError(c))?c:null},o.prototype.validateObjectRequiredProperties=function(a,b){if(void 0!==b.required)for(var c=0;c','',""].join(""),scope:{},link:function(c,d,e){var f=b.find("body");c.$watch(function(){return a.modalOpen(e.modalId)},function(a){a?f.addClass("body--modal-open"):f.removeClass("body--modal-open"),c.modalOpen=a})}}}]).service("Modals",function(){var a=this,b={};a.openModal=function(a){b[a]=!0},a.closeModal=function(a){delete b[a]},a.modalOpen=function(a){return"undefined"==typeof a?!angular.equals(b,{}):b.hasOwnProperty(a)}}),angular.module("openeis-ui").controller("AccountCtrl",["$scope","Auth","$timeout",function(a,b,c){var d;b.account().then(function(b){a.account=b,d=angular.copy(b)}),a.$watchCollection("account",function(b){b.first_name!==d.first_name||b.email!=d.email?a.profile.changed=!0:a.profile.changed=!1}),a.profile={clearAlerts:function(){a.profile.success=!1,a.profile.error=!1},update:function(){a.profile.clearAlerts(),b.accountUpdate({first_name:a.account.first_name,email:a.account.email}).then(function(b){a.profile.success=!0,a.profile.changed=!1,d=angular.copy(a.account),c(a.profile.clearAlerts,2e3)},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.profile.error=b})}},a.password={clearAlerts:function(){a.password.mismatch=!1,a.password.success=!1,a.password.error=!1},update:function(){return a.password.clearAlerts(),a.password["new"]!==a.password.newConfirm?void(a.password.mismatch=!0):void b.accountPassword({old_password:a.password.current,new_password:a.password["new"]}).then(function(b){a.password.success=!0,a.password.current="",a.password["new"]="",a.password.newConfirm="",c(a.password.clearAlerts,2e3)},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.password.error=b})}}}]),angular.module("openeis-ui").controller("ConfigureTimestampCtrl",["$scope","DataFiles","$http","Modals",function(a,b,c,d){a.modal={columns:{},timeOffset:a.timestampFile.time_offset||0,timeZone:a.timestampFile.time_zone||jstz.determine().name()},a.timestampFile.timestamp&&a.timestampFile.timestamp.columns&&angular.forEach(a.timestampFile.timestamp.columns,function(b){a.modal.columns[b]=!0}),a.preview=function(){return a.selectedColumns=[],angular.forEach(a.modal.columns,function(b,c){b===!0&&a.selectedColumns.push(parseInt(c))}),a.selectedColumns.length?void b.timestamps(a.timestampFile.id,a.modal.timeOffset,a.modal.timeZone,a.selectedColumns.join(",")).then(function(b){a.modal.confirm=!0,a.modal.timestamps=b},function(a){alert(angular.toJson(a.data))}):void alert("Please select at least one column.")},a.save=function(){var c={columns:a.selectedColumns};b.update({id:a.timestampFile.id,timestamp:c,time_offset:a.modal.timeOffset,time_zone:a.modal.timeZone}).then(function(b){a.timestampFile.timestamp=c,a.timestampFile.time_zone=a.modal.timeZone,d.closeModal("configureTimestamp")},function(a){alert(angular.toJson(a))})}}]),angular.module("openeis-ui").controller("DataMapCtrl",["$scope","dataMap","project",function(a,b,c){a.dataMap=b,a.project=c}]),angular.module("openeis-ui").controller("DataSetCtrl",["$scope","project","dataSet","head",function(a,b,c,d){a.project=b,a.dataSet=c,a.data=d}]),angular.module("openeis-ui").controller("DataSetManipulateCtrl",["$location","$scope","DataMaps","DataSetFilters","DataSets","Modals","project","dataSet",function(a,b,c,d,e,f,g,h){b.Modals=f,b.project=g,b.dataSet=h,b.availableFilters=d.query(),b.topicFilters={},b.globalSettings={performFill:!0,performAggregation:!0,periodSeconds:3600,dropExtra:!0,roundTime:!1},b.$on("$locationChangeStart",function(a){b.filterAdded()&&!confirm("Abandon data set manipulation?")&&a.preventDefault()}),b.filterAdded=function(){var a=!1;return angular.forEach(b.topicFilters,function(b){b.other.length&&(a=!0)}),a},b.initTopicFilters=function(a,d){b.topicFilters[a]={fill:null,aggregation:null,other:[]},c.getDefinition().then(function(c){c.sensors[d.type]&&(b.topicFilters[a].fill=c.sensors[d.type].default_fill,b.topicFilters[a].aggregation=c.sensors[d.type].default_aggregation)})},b.addFilterTo=function(a){b.newFilter={topic:a},f.openModal("newFilter")},b.saveNewFilter=function(){var a={};angular.forEach(b.newFilter.filter.parameters,function(c,d){a[d]=b.newFilter.parameters[d]}),b.topicFilters[b.newFilter.topic].other.push([b.newFilter.topic,b.newFilter.filter.id,a]),f.closeModal("newFilter")},b.raiseFilter=function(a){var c=b.topicFilters[a[0]].other,d=c.indexOf(a);0!==d&&(c.splice(d,1),c.splice(d-1,0,a))},b.lowerFilter=function(a){var c=b.topicFilters[a[0]].other,d=c.indexOf(a);d!==c.length-1&&(c.splice(d,1),c.splice(d+1,0,a))},b.deleteFilter=function(a){var c=b.topicFilters[a[0]].other;c.splice(c.indexOf(a),1)},b.apply=function(){var c=[];b.applying=!0,angular.forEach(b.topicFilters,function(a,d){b.globalSettings.performFill&&a.fill&&c.push([d,a.fill,{period_seconds:b.globalSettings.periodSeconds,drop_extra:b.globalSettings.dropExtra}]),b.globalSettings.performAggregation&&c.push([d,a.aggregation,{period_seconds:b.globalSettings.periodSeconds,round_time:b.globalSettings.roundTime}]),a.other.length&&(c=c.concat(a.other))}),e.manipulate(h,c).then(function(){b.topicFilters={},a.url("projects/"+g.id)},function(a){var b=a.data;angular.isArray(b)?alert(b.join("\n")):alert(b)})["finally"](function(){delete b.applying})}}]),angular.module("openeis-ui").controller("LoginCtrl",["$scope","Auth",function(a,b){a.logIn=function(){b.logIn({username:a.form.username,password:a.form.password})["catch"](function(b){a.form.error=b.status})},a.clearError=function(){a.form.error=null}}]),angular.module("openeis-ui").controller("NewAnalysisCtrl",["$scope","Applications","DataMaps","$q","Modals","Analyses",function(a,b,c,d,e,f){a.newAnalysis={debug:!1},a.$watch("newAnalysis.dataSet",function(){a.availableApps=[],a.newAnalysis.dataSet&&b.query().$promise.then(function(b){a.availableSensors={},allSensors=["TerminalBoxDamperCommand","TerminalBoxFanAirflow","TerminalBoxReheatValvePosition","OccupancyMode","ZoneTemperature","ZoneTemperatureSetPoint"],angular.forEach(a.newAnalysis.dataSet.datamap.sensors,function(b,c){b.type&&(a.availableSensors.hasOwnProperty(b.type)||(a.availableSensors[b.type]=[],allSensors.indexOf(b.type)>-1&&a.availableSensors[b.type].push({display:"All",value:c+"/All"})),a.availableSensors[b.type].push({display:c,value:c}))}),angular.forEach(b,function(b){var c={},d=[];return b.name=b.name||b.id,angular.forEach(b.inputs,function(a){c.hasOwnProperty(a.sensor_type)||(c[a.sensor_type]=0),c[a.sensor_type]+=a.count_min}),angular.forEach(c,function(b,c){var e=0;a.availableSensors[c]&&(e=a.availableSensors[c].length),b>e&&d.push("At least "+b+" "+c+" required, "+e+" available in data set")}),d.length?void a.availableApps.push({name:b.name,description:b.description,note:b.note,missingInputs:d}):void a.availableApps.push(b)})})});var g;a.$watch("newAnalysis.application",function(b,c){b&&b!==g&&(a.newAnalysis.configuration={parameters:{},inputs:{}},angular.forEach(b.inputs,function(b,c){a.newAnalysis.configuration.inputs[c]=[];for(var d=0;d++=a.availableSensors[c].length?!1:d.inputs[b].count_max&&e.inputs[b].length>=d.inputs[b].count_max?!1:!0:!1},a.addInputSensor=function(b){a.newAnalysis.configuration.inputs[b].push({})},a.deleteInputSensor=function(b,c){a.newAnalysis.configuration.inputs[b].splice(c,1)},a.run=function(){f.create({name:a.newAnalysis.dataSet.name+" - "+a.newAnalysis.application.name,dataset:a.newAnalysis.dataSet.id,application:a.newAnalysis.application.id,configuration:a.newAnalysis.configuration,debug:a.newAnalysis.debug}).$promise.then(function(b){a.analyses.push(b),a.statusCheck(),e.closeModal("newAnalysis")},function(a){alert(angular.toJson(a.data,!0))})}}]),angular.module("openeis-ui").controller("NewDataMapCtrl",["$location","$scope","project","dataFiles","DataMaps","DataSets","Modals","newDataMap",function(a,b,c,d,e,f,g,h){b.project=c,b.dataFiles=d,b.Modals=g,b.isObject=angular.isObject,e.ensureFileMetaData(b.dataFiles),b.newDataMap=h,b.$on("$locationChangeStart",function(a){b.newDataMap.map.children.length&&!confirm("Abandon unsaved data map?")&&a.preventDefault()}),b.$watch("newDataMap.map",function(){e.validateMap(b.newDataMap.map).then(function(a){b.newDataMap.valid=a.valid})},!0),b.addChild=function(a){var c,d="Name:",e=function(a){return a.name===c};do{if(c=prompt(d),!c)return;c=c.replace("/","-"),d='Error: "'+c+'" already exists. Name:'}while(b.newDataMap.map.children.some(e));b.newDataMap.map.children.unshift({level:a,name:c})},b.preview=function(){function a(b){angular.forEach(b,function(b){b.deleted!==!0&&(b.file&&(d[b.file.id]||(d[b.file.id]={key:h++ +"",name:b.file.name})),b.sensors&&a(b.sensors),b.children&&a(b.children))})}var c=[],d={},h=0;a(b.newDataMap.map.children),b.dataMapPreviewFiles={},angular.forEach(d,function(a,d){c.push({name:a.key,file:d}),b.dataMapPreviewFiles[a.key]=a.name}),f.preview(e.flattenMap(b.newDataMap.map),c).$promise.then(function(a){b.dataMapPreview=a,g.openModal("dataMapPreview")})},b.showError=function(a){alert([b.dataMapPreviewFiles[a.file],": row ",a.row,", column ",a.column,"\n",a.error].join(""))},b.save=function(){e.create(b.newDataMap).$promise.then(function(){b.newDataMap.map.children=[],a.url("projects/"+c.id)},function(a){alert(a.data.__all__.join("\n"))})}}]),angular.module("openeis-ui").controller("NewDataSetCtrl",["$filter","$location","$scope","project","dataFiles","dataMaps","DataMaps","DataSets","Modals",function(a,b,c,d,e,f,g,h,i){c.project=d,c.dataFiles=e,c.dataMaps=f,c.Modals=i,c.isObject=angular.isObject,g.ensureFileMetaData(c.dataFiles),c.newDataSet={files:{}},c.showError=function(a){alert([c.newDataSet.files[a.file].name,": row ",a.row,", column ",a.column,"\n",a.error].join(""))},c.submit=function(){c[c.newDataSet.action]()},c.preview=function(){var a=[];angular.forEach(c.newDataSet.files,function(b,c){a.push({name:c,file:b.id})}),h.preview(c.newDataSet.map,a).$promise.then(function(a){c.dataSetPreview=a,i.openModal("dataSetPreview")})},c.save=function(){var e=[];angular.forEach(c.newDataSet.files,function(a,b){e.push({name:b,file:a.id})}),h.create({name:c.newDataSet.map.name+" - "+a("date")(Date.now(),"short"),map:c.newDataSet.map.id,files:e}).$promise.then(function(a){b.url("projects/"+d.id)},function(a){alert(angular.toJson(a.data,!0))})}}]),angular.module("openeis-ui").controller("ProjectCtrl",["$scope","project","dataFiles","DataFiles","dataSets","DataSets","dataMaps","$upload","$timeout","$q","$http","Modals","analyses","Analyses","sharedAnalyses","SharedAnalyses",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){a.project=b,a.dataFiles=c,a.dataSets=e,a.dataMaps=g,a.Modals=l,a.analyses=m,a.sharedAnalyses=o;var q;a.statusCheck=function(){angular.forEach(a.dataSets,function(b){if(!b.status||"complete"!==b.status.status.slice(-8)){var c=[];c.push(f.getStatus(b).then(function(a){b.status=a.data,"processing"===b.status.status&&(b.status.status+=" - "+Math.floor(parseFloat(b.status.percent))+"%")})),c.push(f.getErrors(b).then(function(a){b.errors=a.data})),j.all(c).then(function(){"complete"!==b.status.status.slice(-8)&&(i.cancel(q),q=i(a.statusCheck,1e3))})}}),angular.forEach(a.analyses,function(b){"complete"!==b.status.slice(-8)&&n.get(b.id).$promise.then(function(c){angular.extend(b,c),"complete"!==b.status.slice(-8)&&(i.cancel(q),q=i(a.statusCheck,1e3))})})},a.statusCheck(),a.configureTimestamp=function(b){var c={timeZones:k.get(settings.TIMEZONES_URL)};a.dataFiles[b].head||(c.head=d.head(a.dataFiles[b].id)),j.all(c).then(function(c){c.head&&(c.head.has_header&&(c.head.header=c.head.rows.shift()),a.dataFiles[b].head=c.head,a.dataFiles[b].cols=[],angular.forEach(a.dataFiles[b].head.rows[0],function(c,d){a.dataFiles[b].cols.push(d)})),a.timestampFile=a.dataFiles[b],a.timeZones=c.timeZones.data,l.openModal("configureTimestamp")})},a.upload=function(c){var e=[];return a.uploading=!0,angular.forEach(c,function(c){e.push(h.upload({url:settings.API_URL+"projects/"+b.id+"/add_file",file:c}).then(function(b){d.get(b.data.id).then(function(b){a.dataFiles.push(b),a.configureTimestamp(a.dataFiles.length-1)})}))}),j.all(e)["catch"](function(a){var b;b=a.data.file?a.data.file.join("\n"):a.data,alert(b)})["finally"](function(){delete a.uploading,l.closeModal("uploadFile")})},a.errorsModal={},a.showErrors=function(b){a.errorsModal.files={},angular.forEach(b.files,function(b){angular.forEach(a.dataFiles,function(c){c.id===b.file&&(a.errorsModal.files[b.name]=c.name)}),a.errorsModal.files[b.name]||(a.errorsModal.files[b.name]='File "'+b.name+'"')}),a.errorsModal.errors=b.errors,l.openModal("dataSetErrors")},a.rename=function(b,c){function d(e){if(!a[b])throw"Collection not found: "+b;var f,g=a[b][c].name;e=e||"",e.length&&(e+="\n\n"),e+="Rename '"+g+"' to:",f=prompt(e),null!==f&&(f.length?(a[b][c].name=f,a[b][c].$save(function(){"dataSets"===b&&a.statusCheck()},function(e){a[b][c].name=g,d(e.data.__all__.join("\n"))})):d("Name cannot be empty."))}d()},a["delete"]=function(c,d){if(!a[c])throw"Collection not found: "+c;confirm("Delete '"+a[c][d].name+"'?")&&a[c][d].$delete(function(){a[c].splice(d,1),"sharedAnalyses"===c&&(a.sharedAnalyses=p.query(b.id))})},a.viewAnalysis=function(b){a.viewingAnalysis=b,delete a.viewingAnalysisData,l.openModal("viewAnalysis"),n.getData(b.id).then(function(b){a.viewingAnalysisData=b})},a.getAnalysisOutputUrl=function(a){return settings.API_URL+"analyses/"+a+"/download"},a.shareAnalysis=function(b){p.create(b.id).$promise.then(function(c){a.sharedAnalyses.push(c),a.viewLink(b.id)})},a.viewLink=function(b){angular.forEach(a.sharedAnalyses,function(c){c.analysis===b&&(a.viewingLink={url:window.location.protocol+"//"+window.location.host+"/shared-analyses/"+b+"/"+c.key,sharedAnalysis:c},l.openModal("viewLink"))})},a.revokeLink=function(b){confirm("Revoke sharing?")&&(angular.forEach(a.sharedAnalyses,function(c){c.analysis===b&&c.$delete(function(){a.sharedAnalyses.splice(a.sharedAnalyses.indexOf(c),1)})}),l.closeModal("viewLink"))}}]),angular.module("openeis-ui").controller("ProjectsCtrl",["$scope","projects","Projects",function(a,b,c){a.projects=b,a.newProject={name:"",create:function(){c.create({name:a.newProject.name}).then(function(b){a.newProject.name="",a.projects.push(b)})}},a.renameProject=function(b){var c=prompt("New project name:");c&&c.length&&(a.projects[b].name=c,a.projects[b].$save(function(c){a.projects[b]=c}))},a.deleteProject=function(b){a.projects[b].$delete(function(){a.projects.splice(b,1)})},a.cloneProject=function(b){var d=prompt("Cloned project name:");d&&d.length&&c.clone(a.projects[b].id,d).then(function(b){a.projects.push(b)})}}]),angular.module("openeis-ui").controller("RecoveryCtrl",["$scope","Auth","$routeParams",function(a,b,c){a.form={stage:1},c.username&&c.code?(a.form.stage=2,a.recovery={username:c.username,code:c.code}):a.recovery={},a.submit=function(){switch(a.form.stage){case 1:return void b.accountRecover1(a.recovery.id).then(function(){a.form.success="Email with temporary password reset link sent.",a.form.stage=!1,a.clearError()},function(b){404===b.status&&(b.data="Account with specified username or email address not found."),a.form.error=b});case 2:return a.recovery.password!==a.recovery.passwordConfirm?void(a.form.error={status:400,data:"Passwords do not match."}):void b.accountRecover2(a.recovery).then(function(){a.form.success="Password updated.",a.form.stage=!1,a.clearError()},function(b){404===b.status&&(b.data="Invalid password reset link."),a.form.error=b})}},a.clearError=function(){a.form.error=!1}}]),angular.module("openeis-ui").controller("SharedAnalysesCtrl",["$scope","SharedAnalyses","$routeParams","$location",function(a,b,c,d){a.valid=!0,b.get(c.analysisId,c.key).$promise.then(function(d){a.sharedAnalysis=d,b.getData(d.analysis,c.key).then(function(b){a.data=b})},function(){a.valid=!1})}]),angular.module("openeis-ui").controller("SignUpCtrl",["$scope","$location","Auth",function(a,b,c){a.form={},a.submit=function(){return a.account.password!==a.account.passwordConfirm?void(a.form.passwordConfirm="Passwords do not match."):void c.accountCreate(a.account).then(function(b){c.logIn({username:a.account.username,password:a.account.password})["catch"](function(b){a.form.error=b.status})},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.form.error=b})},a.clearError=function(){a.form.error=null}}]),angular.module("openeis-ui.directives.analysis-report",[]).directive("analysisReport",["$compile",function(a){function b(a,b,c){var d={top:20,right:20,bottom:30,left:50},e=920-d.left-d.right,f=300-d.top-d.bottom,g=d3.scale.linear().range([0,e]),h=d3.scale.linear().range([f,0]),i=d3.svg.axis().scale(g).orient("bottom"),j=d3.svg.axis().scale(h).orient("left"),k=d3.svg.line().x(function(a){return g(a.x)}).y(function(a){return h(a.y)}).interpolate("basis"),l=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),m=l.append("g").attr("transform","translate("+d.left+","+d.top+")");return g.domain(d3.extent(a,function(a){return a.x})),h.domain(d3.extent(a,function(a){return a.y})),m.append("g").attr("class","line-plot__axis line-plot__axis--x").attr("transform","translate(0,"+f+")").call(i),m.append("g").attr("class","line-plot__axis line-plot__axis--y").call(j).append("text").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),m.append("path").datum(a).attr("class","line-plot__line").attr("d",k),l[0]}function c(a,b,c){var d={top:20,right:20,bottom:30,left:50},e=920-d.left-d.right,f=300-d.top-d.bottom,g=d3.scale.ordinal().rangeRoundBands([0,e],.1),h=d3.scale.linear().range([f,0]),i=d3.svg.axis().scale(g).orient("bottom"),j=d3.svg.axis().scale(h).orient("left"),k=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),l=k.append("g").attr("transform","translate("+d.left+","+d.top+")");return g.domain(a.map(function(a){return a.x})),h.domain([0,d3.max(a,function(a){return a.y})]),l.append("g").attr("class","bar-chart__axis bar-chart__axis--x").attr("transform","translate(0,"+f+")").call(i).text(b),l.append("g").attr("class","bar-chart__axis bar-chart__axis--y").call(j).append("text").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),l.selectAll("bar-chart__bar").data(a).enter().append("rect").attr("class","bar-chart__bar").attr("x",function(a){return g(a.x)}).attr("width",g.rangeBand()).attr("y",function(a){return h(a.y)}).attr("height",function(a){return f-h(a.y)}),k[0]}function e(a,b,c){var d={top:20,right:20,bottom:30,left:40},e=920-d.left-d.right,f=300-d.top-d.bottom,g=function(a){return a.x},h=d3.scale.linear().range([0,e]),i=function(a){return h(g(a))},j=d3.svg.axis().scale(h).orient("bottom"),k=function(a){return a.y},l=d3.scale.linear().range([f,0]),m=function(a){return l(k(a))},n=d3.svg.axis().scale(l).orient("left"),o=function(a){return 0},p=d3.scale.category10(),q=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),r=q.append("g").attr("transform","translate("+d.left+","+d.top+")");d3.select("body").append("div").attr("class","tooltip").style("opacity",0);return h.domain([d3.min(a,g)-1,d3.max(a,g)+1]),l.domain([d3.min(a,k)-1,d3.max(a,k)+1]),r.append("g").attr("class","x axis").attr("transform","translate(0,"+f+")").call(j).append("text").attr("class","label").attr("x",e).attr("y",-6).style("text-anchor","end").text(b),r.append("g").attr("class","y axis").call(n).append("text").attr("class","label").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),r.selectAll(".dot").data(a).enter().append("circle").attr("class","dot").attr("r",3.5).attr("cx",i).attr("cy",m).style("fill",function(a){return p(o(a))}).append("svg:title").text(function(a){return b+": "+a.x+"\n"+c+": "+a.y}),q[0]}function f(a,b,c){var d={top:20,right:20,bottom:180,left:40},e=920-d.left-d.right,f=450-d.top-d.bottom,g=function(a){return Date.parse(a.x)},h=d3.time.scale().range([0,e]),i=function(a){return h(g(a))},j=d3.svg.axis().scale(h).orient("bottom").ticks(30),k=function(a){return a.y},l=d3.scale.linear().range([f,0]),m=function(a){return l(k(a))},n=d3.svg.axis().scale(l).orient("left"),o=function(a){return 0},p=d3.scale.category10(),q=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),r=q.append("g").attr("transform","translate("+d.left+","+d.top+")");d3.select("body").append("div").attr("class","tooltip").style("opacity",0);h.domain([d3.min(a,g)-1,d3.max(a,g)+1]),l.domain([d3.min(a,k)-1,d3.max(a,k)+1]);var s=[["%Y-%m",function(a){return a.getMonth()}],["%Y-%m-%d",function(a){return a.getDate()}],["%Y-%m-%d %H:%M",function(a){return a.getHours()}],["%Y-%m-%d %H:%M:%S",function(a){return a.getSeconds()}]];return j.tickFormat(d3.time.format("%Y")),h.ticks.apply(h,j.ticks()).forEach(function(a){for(;s.length&&s[0][1](a);)j.tickFormat(d3.time.format(s[0][0])),s.shift()}),r.append("g").attr("class","x axis").attr("transform","translate(0,"+f+")").call(j).append("text").attr("class","label").attr("x",e).attr("y",-6).style("text-anchor","end").text(b),r.selectAll(".x.axis > .tick > text").style("text-anchor","end").attr("transform","rotate(-90)").attr("dx","-.5em").attr("dy","-.5em"),r.append("g").attr("class","y axis").call(n).append("text").attr("class","label").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),r.selectAll(".dot").data(a).enter().append("circle").attr("class","dot").attr("r",3.5).attr("cx",i).attr("cy",m).style("fill",function(a){return p(o(a))}).append("svg:title").text(function(a){return b+": "+a.x+"\n"+c+": "+a.y}),q[0]}function g(a,b,c){var d={top:50,right:0,bottom:100,left:100},e=960-d.left-d.right,f=Math.floor(e/24),g=d3.set(a.map(function(a){return a.y})).values();height=(g.length+1)*f,legendElementWidth=2*f,buckets=9,colors=["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"];var h=d3.scale.quantile().domain(d3.extent(a,function(a){return a.z})).range(colors),i=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",height+d.top+d.bottom),j=i.append("g").attr("transform","translate("+d.left+","+d.top+")"),k=(j.selectAll(".yLabel").data(g).enter().append("text").text(function(a){return a}).attr("x",0).attr("y",function(a,b){return b*f}).style("text-anchor","end").attr("transform","translate(-6,"+f/1.5+")").attr("class","yLabel"),j.selectAll(".xLabel").data(d3.range(24)).enter().append("text").text(function(a){return a}).attr("x",function(a,b){return b*f}).attr("y",0).style("text-anchor","middle").attr("transform","translate("+f/2+", -6)").attr("class","xLabel"),j.selectAll(".value").data(a).enter().append("rect").attr("x",function(a){return a.x*f}).attr("y",function(a){return g.indexOf(a.y)*f}).attr("rx",4).attr("ry",4).attr("class","value bordered").attr("width",f).attr("height",f).style("fill",colors[0]));k.transition().duration(1e3).style("fill",function(a){return h(a.z)}),k.append("title").text(function(a){return a.z});var l=j.selectAll(".legend").data([0].concat(h.quantiles()),function(a){return a}).enter().append("g").attr("class","legend");return l.append("rect").attr("x",function(a,b){return legendElementWidth*b}).attr("y",height).attr("width",legendElementWidth).attr("height",f/2).style("fill",function(a,b){return colors[b]}),l.append("text").attr("class","mono").text(function(a){return"≥ "+Math.round(a)}).attr("x",function(a,b){return legendElementWidth*b}).attr("y",height+f),i[0]}function h(a){var b=a.getDate();10>b&&(b="0"+b);var c=a.getMonth()+1;10>c&&(c="0"+c);var d=a.getFullYear();return d+"-"+c+"-"+b}function j(a){var b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=b[a.getDay()];return c+" "+h(a)}function k(a,b){for(var c=[];b>=a;)c.push(a++);return c}function l(a){var b=a-Math.floor(a);return a-=b,("0"+a).slice(-2)+b.toString().substr(1)}function m(a,b,c){var d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],e=[],f=0;for(i=1;i=b[d[f][c][g].color_code].state_value&&(d[f][c][g]=a):d[f][c][g]=a:(d[f][c]={},d[f][c][g]=a):(d[f]={},d[f][c]={},d[f][c][g]=a)}});var e=[],f=[];for(var g in d)if(d.hasOwnProperty(g)){var i=g.split("-"),j=new Date(i[0],i[1]-1,i[2],0,0,0,0);f.push(j)}for(var k=d3.extent(f),l=k[1],m=k[0],n=Math.round(Math.abs((l-m)/864e5)),o=0;n>=o;o++){var p=new Date(m.getTime());p.setDate(p.getDate()+o);var q=h(p);if(d.hasOwnProperty(q))for(var r=0;rv;v++){var x=v.toString();d[q][c[r]].hasOwnProperty(x)&&(null!=d[q][c[r]][x].energy_impact&&(s=d[q][c[r]][x].energy_impact),b[d[q][c[r]][x].color_code].state_value>=b[u.state].state_value&&(u={state:d[q][c[r]][x].color_code,diagnostic:d[q][c[r]][x].diagnostic_name,diagnostic_message:d[q][c[r]][x].diagnostic_message,energy_impact:s}))}var y=u.state;u.state==b.RED.string&&(y=b.GREEN.string),s="NA";for(var v=0;24>v;v++){var x=v.toString();d[q][c[r]].hasOwnProperty(x)?(null!=d[q][c[r]][x].energy_impact&&(s=d[q][c[r]][x].energy_impact),t.push({date:p,y:v,state:d[q][c[r]][x].color_code,diagnostic:d[q][c[r]][x].diagnostic_name,diagnostic_message:d[q][c[r]][x].diagnostic_message,energy_impact:s})):t.push({date:p,y:v,state:y,diagnostic:"",diagnostic_message:b[y].value,energy_impact:"NA"})}e.push({date:p,y:r,state:u.state,diagnostic:u.diagnostic,diagnostic_message:u.diagnostic_message,energy_impact:u.energy_impact,hourly_result:t})}else{for(var t=[],v=0;24>v;v++)t.push({date:p,y:v,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA"});e.push({date:p,y:r,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA",hourly_result:t})}}else for(var r=0;rv;v++)t.push({date:p,y:v,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA"});e.push({date:p,y:r,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA",hourly_result:t})}}return e}function o(a,b){function c(){L.select("g.x.axis").call(I),L.select("g.y.axis").call(J),$.selectAll("circle").attr("cx",function(a){var b=G(a.date);return 0>b&&(b=-1e4),b})}function d(a,b){var c=d.canvas||(d.canvas=document.createElement("canvas")),e=c.getContext("2d");e.font=b;var f=e.measureText(a);return f.width}var e=["Temperature Sensor Dx","Economizing When Unit Should Dx","Economizing When Unit Should Not Dx","Excess Outdoor-air Intake Dx","Insufficient Outdoor-air Intake Dx"],f=["HW Differential Pressure Control Loop Dx","HW Supply Temperature Control Loop Dx","HW loop High Differential Pressure Dx","HW loop Differential Pressure Reset Dx","HW loop High Supply Temperature Dx","HW loop Supply Temperature Reset Dx","HW loop Low Delta-T Dx"],g=["Duct Static Pressure Control Loop Dx","Low Duct Static Pressure Dx","High Duct Static Pressure Dx","No Static Pressure Reset Dx","Supply-air Temperature Control Loop Dx","Low Supply-air Temperature Dx","High Supply-air Temperature Dx","No Supply-air Temperature Reset Dx","Operational Schedule Dx"]; -1==b&&(g=["Duct Static Pressure Control Loop Dx","Low Duct Static Pressure Dx","High Duct Static Pressure Dx","No Static Pressure Reset Dx"]),2==b&&(g=["Supply-air Temperature Control Loop Dx","Low Supply-air Temperature Dx","High Supply-air Temperature Dx","No Supply-air Temperature Reset Dx"]),3==b&&(g=["Operational Schedule Dx"]);for(var h=null,i=!1,l=0;l-1&&(h=e,i=!0),f.indexOf(a[l].diagnostic_name)>-1&&(h=f,i=!0),g.indexOf(a[l].diagnostic_name)>-1&&(h=g,i=!0);if(i){var m=1024,o=100*h.length,p={top:40,right:0,bottom:150,left:360},q={top:30,right:30,bottom:50,left:30},r=m-p.left-p.right,s=o-p.top-p.bottom;0>s&&(o=250,s=80);var t=8,u="#ccc",v=d3.time.format("%b %d"),w=h,x={GREY:{value:"No Diagnosis",color:"#B3B3B3",state_value:0,string:"GREY"},GREEN:{value:"Normal",color:"#509E7A",state_value:1,string:"GREEN"},RED:{value:"Fault",color:"#E22400",state_value:2,string:"RED"}},y=w,z=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",m).attr("height",o),A=n(a,x,h),B=d3.extent(A,function(a){return a.date}),C=w.length,D=6,E=Math.floor((r-q.left-q.right)/D),F=E*(A.length/C),G=d3.time.scale().domain(B).range([q.left,q.left+F]),H=d3.scale.ordinal().domain(y).rangePoints([s-q.top,q.bottom]),I=d3.svg.axis().scale(G).orient("bottom").ticks(d3.time.day).tickFormat(v),J=d3.svg.axis().scale(H).orient("left"),K=d3.behavior.zoom().scaleExtent([1,1]).on("zoom",c);K.x(G);var L=z.append("g").attr("transform","translate("+p.left+","+p.top+")");L.append("rect").attr("class","pane").attr("width",r).attr("height",s).call(K);var M=d3.tip().attr("class","d3-tip").offset([-10,0]).html(function(a){return"Date: "+j(a.date)+"
Diagnostic Message: "+a.diagnostic_message+"
Energy Impact: "+a.energy_impact+"
(Click to see hourly result)
"}),N=d3.tip().attr("class","d3-tip").offset([-10,0]).html(function(a){return"Date: "+j(a.date)+"
Hour: "+(a.y+1)+"
Diagnostic Message: "+a.diagnostic_message+"
Energy Impact: "+a.energy_impact+"
"});L.call(M),L.call(N);var O=z.append("g").attr("transform","translate("+m/3+","+p.top/3+")"),P=324,Q=34,R=15;O.append("rect").attr("width",P).attr("height",Q).attr("x",0).attr("y",0).attr("rx",5).attr("ry",5).style("stroke","#909090").style("stroke-width",1).style("fill","none");var S=R,T=[];for(var U in x)x.hasOwnProperty(U)&&T.push(x[U]);var V=O.selectAll("g").data(T).enter().append("g").attr("transform",function(a,b){if(b>0){var c=2*t,e=d(T[b-1].value,"17pt sans-serif");S+=c+e}return"translate("+S+","+Q/2+")"});V.append("circle").attr("cx",0).attr("cy",0).attr("r",t).attr("fill",function(a){return a.color}).attr("opacity",1).on("mouseover",null).on("mouseout",null),V.append("text").attr("x",2*t+1).attr("y",0).attr("dy",".35em").text(function(a){return a.value}).style("font-size","1em").style("font-family","sans-serif");var W=L.append("g").attr("id","xAxisEle_AFDD").attr("class","x axis");W.attr("clip-path","url(#clip_AFDD)").attr("transform","translate(0,"+(s-5)+")"),L.append("g").attr("class","y axis"),L.selectAll("line.y").data(y).enter().append("line").attr("class","yAxis").attr("x1",0).attr("x2",F).attr("y1",H).attr("y2",H).style("stroke",u),L.append("clipPath").attr("id","clip_AFDD").append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s);var X=2*Math.PI,Y=20,Z=d3.scale.linear().domain([0,Y-1]).range([0,X]),$=(d3.svg.line.radial().interpolate("basis").tension(0).radius(t).angle(function(a,b){return Z(b)}),L.append("g").attr("clip-path","url(#clip_AFDD)"));return $.selectAll("circle").data(A).enter().append("circle").attr("cx",function(a){return G(a.date)}).attr("cy",function(a){return H(y[a.y])}).attr("r",t).attr("fill",function(a){return x[a.state].color}).attr("opacity",1).on("mouseover",M.show).on("mouseout",M.hide).on("mousedown",function(a){if(d3.select("#hrData").remove(),"No Supply-air Temperature Reset Dx"!==a.diagnostic&&"No Static Pressure Reset Dx"!==a.diagnostic&&("Operational Schedule Dx"!==a.diagnostic||"Supply fan is operating excessively during unoccupied times."!==a.diagnostic_message)&&""!==a.diagnostic){var b=24,c=k(1,24),d=d3.scale.ordinal().domain(c).rangeRoundBands([0,24*b]),e=d3.svg.axis().scale(d).orient("bottom"),f=p.left+40,g=z.append("g").attr("id","hrData").attr("width",24*b).attr("height",b).attr("transform","translate(0,"+(s+100)+")");g.append("g").attr("class","x axis").attr("transform","translate("+f+","+b+")").call(e);var i=g.append("g").attr("class","axis");i.append("text").attr("x",80).attr("y",b-7).text(h[a.y]),i.append("text").attr("x",80).attr("y",b+20).text("("+j(a.date)+")"),g.selectAll("rect").data(a.hourly_result).enter().append("rect").attr("x",function(a){return a.y*b+f}).attr("y",0).attr("width",b).attr("height",b).attr("fill",function(a){return x[a.state].color}).attr("opacity",1).style({"stroke-width":1,stroke:"black"}).on("mouseover",N.show).on("mouseout",N.hide)}}),c(),z[0]}}function p(a,b){return b.hasOwnProperty(a)?!0:!1}function q(a,b){return a.substring(0,b.length+3)===b+"___"?!0:!1}function r(a,b){for(var c in b)if(b.hasOwnProperty(c)&&q(c,a))return!0;return!1}function s(a){a="undefined"!=typeof a?a:"Temperature";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"18.5em",offsetY:"30em"};return b}function t(a){a="undefined"!=typeof a?a:"Temperature";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"0.8em",offsetY:"-8.5em"};return b}function u(a){a="undefined"!=typeof a?a:"Command/Status";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"3em",offsetY:"-8em"};return b}function v(a,b,c){for(var d in b)b.hasOwnProperty(d)&&(null==a[b[d]]?delete a[b[d]]:(a[b[d]]=parseFloat(a[b[d]]),c[d]+=1))}function w(a){var b=a.split(/[^0-9]/);return new Date(b[0],b[1]-1,b[2],b[3],b[4],b[5])}function x(a){var b=["Blue","BlueViolet","Brown","BurlyWood","CadetBlue","DarkGray","DarkGrey","DarkGreen","DarkKhaki","Magenta","Green","Red","Chocolate","HotPink","LightPink","Gainsboro","AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Chartreuse","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkMagenta","DarkOliveGreen","Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","GhostWhite","Gold","GoldenRod","Gray","Grey","GreenYellow","HoneyDew","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"];return b[a]}function y(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OATemp",c)||!p("MATemp",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,300]),q={};p("OATemp",c)&&(q.OATemp={name:"Outdoor Air Temperature",color:d.OATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OATemp]}}),scale:n}),p("MATemp",c)&&(q.MATemp={name:"Mixed Air Temperature",color:d.MATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.MATemp]}}),scale:n}),p("RATemp",c)&&(q.RATemp={name:"Return Air Temperature",color:d.RATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.RATemp]}}),scale:n}),p("OAF",c)&&(q.OAF={name:"Outdoor Air Fraction",color:d.OAF,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OAF]}}),scale:o}),p("DATemp",c)&&(q.DATemp={name:"Discharge Air Temperature",color:d.DATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATemp]}}),scale:n}),p("OADamper",c)&&(q.OADamper={name:"Outdoor Damper Signal",color:d.OADamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OADamper]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OATemp",c)||!p("DATemp",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,300]),q={};p("OATemp",c)&&(q.OATemp={name:"Outdoor Air Temperature",color:d.OATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OATemp]}}),scale:n}),p("DATemp",c)&&(q.DATemp={name:"Discharge Air Temperature",color:d.DATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATemp]}}),scale:n}),p("DATempSetPoint",c)&&(q.DATempSetPoint={name:"Discharge Air Temperature Set Point",color:d.DATempSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATempSetPoint]}}),scale:n}),p("OADamper",c)&&(q.OADamper={name:"Outdoor Damper Signal",color:d.OADamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OADamper]}}),scale:o}),p("CCValve",c)&&(q.CCValve={name:"Cooling Coil Valve Position",color:d.CCValve,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.CCValve]}}),scale:o}),p("HCValve",c)&&(q.HCValve={name:"Heating Coil Valve Position",color:d.HCValve,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HCValve]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("MATemp",c)||!p("OATemp",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,c){return a[b.OATemp]c[b.OATemp]?1:0});var k={MAOAT:{name:b.MATemp,xName:b.OATemp,color:d.MATemp,data:a.map(function(a){return{x:a[c.OATemp],y:a[c.MATemp]}})}},l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.MAOAT]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Mixed-Air Temperature")});o.render()}var e="datetime",f={OAF:"OutdoorAirFraction",OATemp:"OutdoorAirTemperature",MATemp:"MixedAirTemperature",RATemp:"ReturnAirTemperature",DATemp:"DischargeAirTemperature",DATempSetPoint:"DischargeAirTemperatureSetPoint",OADamper:"OutdoorDamper",CCValve:"CCV",HCValve:"HCV"};counts={},points={};for(var g in f)counts[g]=0,points[g]=f[g];var h={OATemp:"blue",MATemp:"pink",RATemp:"red",DATemp:"green",OADamper:"brown",OAF:"blueviolet",CCValve:"darkorange",HCValve:"darkorchid",DATempSetPoint:"darkred"},i="FTimestamp";a=D(a,e,i,points,counts);for(var g in counts)0==counts[g]&&delete points[g];var j=m(a[0][i],a[a.length-1][i],[a[0][i],a[1][i],a[2][i]]),k={Timestamp:i,Title:"AHU Economizer Performance Evaluation",Container:"#temps-chart-box",TimeUnit:j};b(a,f,points,h,k);var l={Timestamp:i,Title:"AHU Discharge Cooling and Economizer Performance Analysis",Container:"#hcv-box",TimeUnit:j};c(a,f,points,h,l);var n={Timestamp:i,Title:"Seasonal AHU Mixed Air Temperature Response Analysis",Container:"#mat-oat-box"};d(a,f,points,h,n),$(".rs-chart-container.hidden").removeClass("hidden")}function z(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OutdoorAirTemperature",c)&&!p("OutdoorDamper",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("OutdoorAirTemperature",c)&&(q.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:n}),p("OutdoorAirFraction",c)&&(q.OutdoorAirFraction={name:c.OutdoorAirFraction,color:d.OutdoorAirFraction,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirFraction]}}),scale:o}),p("OutdoorDamper",c)&&(q.OutdoorDamper={name:"Outdoor Damper Signal",color:d.OutdoorDamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorDamper]}}),scale:o}),p("OccupancyMode",c)&&(q.OccupancyMode={name:"Occupancy Mode",color:d.OccupancyMode,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OccupancyMode]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("DuctStaticPressure",c)&&!p("DuctStaticPressureSetPoint",c)&&!p("SupplyFanSpeed",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,200]),q={};p("DuctStaticPressure",c)&&(q.DuctStaticPressure={name:"Duct Static Pressure",color:d.DuctStaticPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressure]}}),scale:n}),p("DuctStaticPressureSetPoint",c)&&(q.DuctStaticPressureSetPoint={name:"Duct Static Pressure Set Point",color:d.DuctStaticPressureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressureSetPoint]}}),scale:o}),p("SupplyFanSpeed",c)&&(q.SupplyFanSpeed={name:"Supply Fan Speed",color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanSpeed]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("CCV",c)&&!p("HCV",c)&&!p("OutdoorAirTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("OutdoorAirTemperature",c)&&(q.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:n}),p("CCV",c)&&(q.CCV={name:"Cooling Coil Valve Position",color:d.CCV,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.CCV]}}),scale:o}),p("HCV",c)&&(q.HCV={name:"Heating Coil Valve Position",color:d.HCV,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HCV]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function e(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title",l=g+" .rs-slider";if(document.querySelector(k).innerHTML=e.Title,!p("DischargeAirTemperature",c)&&!p("DischargeAirTemperatureSetPoint",c)&&!p("OutdoorAirTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var m=d3.scale.linear().domain([0,200]),n=d3.scale.linear().domain([0,100]),o={};p("OutdoorAirTemperature",c)&&(o.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:m}),p("DischargeAirTemperature",c)&&(o.DischargeAirTemperature={name:"Discharge Air Temperature",color:d.DischargeAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DischargeAirTemperature]}}),scale:n}),p("DischargeAirTemperatureSetPoint",c)&&(o.DischargeAirTemperatureSetPoint={name:"Discharge Air Temperature Set Point",color:d.DischargeAirTemperatureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DischargeAirTemperatureSetPoint]}}),scale:n});var q=[];angular.forEach(o,function(a,b){q.push(a)});var r=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:q,interpolation:"linear"});r.render();var s=new Rickshaw.Graph.Legend({graph:r,element:document.querySelector(j)}),u=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:r,legend:s}),new Rickshaw.Graph.Axis.ExtendedTime({graph:r,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));u.render();var v=new Rickshaw.Graph.Axis.Y.Scaled({graph:r,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:m,label:t()});v.render();new Rickshaw.Graph.RangeSlider.Preview({graph:r,element:document.querySelector(l)})}function f(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!(p("SupplyFanSpeed",c)||p("SupplyFanStatus",c)||p("DuctStaticPressure",c)||p("ReturnFanSpeed",c)))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("DuctStaticPressure",c)&&(q.DuctStaticPressure={name:"Duct Static Pressure",color:d.DuctStaticPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressure]}}),scale:n}),p("SupplyFanSpeed",c)&&(q.SupplyFanSpeed={name:"Supply Fan Speed",color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanSpeed]}}),scale:o}),p("SupplyFanStatus",c)&&(q.SupplyFanStatus={name:"Supply Fan Status",color:d.SupplyFanStatus,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanStatus]}}),scale:o}),p("ReturnFanSpeed",c)&&(q.ReturnFanSpeed={name:"Return Fan Speed",color:d.ReturnFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ReturnFanSpeed]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function g(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("OutdoorAirTemperature",c)||!p("OutdoorDamper",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.OutdoorAirTemperature]b[c.OutdoorAirTemperature]?1:0});var k={};p("OutdoorDamper",c)&&(k.OutdoorDamper={name:"Outdoor Damper Signal",xName:c.OutdoorAirTemperature,color:d.OutdoorDamper,data:a.map(function(a){return{x:a[c.OutdoorAirTemperature],y:a[c.OutdoorDamper]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.OutdoorDamper]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Outdoor Damper Position")});o.render()}function h(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("SupplyFanSpeed",c)||!p("ReturnFanSpeed",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.ReturnFanSpeed]b[c.ReturnFanSpeed]?1:0});var k={};p("SupplyFanSpeed",c)&&(k.SupplyFanSpeed={name:"Supply Fan Speed",xName:c.ReturnFanSpeed,color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[c.ReturnFanSpeed],y:a[c.SupplyFanSpeed]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.SupplyFanSpeed]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Return Fan Speed")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Supply Fan Speed")});o.render()}function i(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("HCV",c)||!p("CCV",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.CCV]b[c.CCV]?1:0});var k={};p("HCV",c)&&(k.HCV={name:"Heating Coil Valve Position",xName:c.CCV,color:d.HCV,data:a.map(function(a){return{x:a[c.CCV],y:a[c.HCV]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.HCV]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Cooling Coil Valve")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Heating Coil Valve")});o.render()}function j(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("DischargeAirTemperatureSetPoint",c)||!p("DischargeAirTemperature",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.DischargeAirTemperatureSetPoint]b[c.DischargeAirTemperatureSetPoint]?1:0});var k={};p("DischargeAirTemperature",c)&&(k.DischargeAirTemperature={name:"Discharge Air Temperature",xName:c.DischargeAirTemperatureSetPoint,color:d.DischargeAirTemperature,data:a.map(function(a){return{x:a[c.DischargeAirTemperatureSetPoint],y:a[c.DischargeAirTemperature]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.DischargeAirTemperature]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Discharge Temperature SetPoint")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Discharge Temperature")});o.render()}var k="datetime",l={OutdoorAirTemperature:"OutdoorAirTemperature",MixedAirTemperature:"MixedAirTemperature",ReturnAirTemperature:"ReturnAirTemperature",DischargeAirTemperature:"DischargeAirTemperature",DischargeAirTemperatureSetPoint:"DischargeAirTemperatureSetPoint",SupplyFanStatus:"SupplyFanStatus",SupplyFanSpeed:"SupplyFanSpeed",OutdoorDamper:"OutdoorDamper",CCV:"CCV",HCV:"HCV",OutdoorAirFraction:"OutdoorAirFraction",ReturnFanSpeed:"ReturnFanSpeed",OccupancyMode:"OccupancyMode",DuctStaticPressure:"DuctStaticPressure",DuctStaticPressureSetPoint:"DuctStaticPressureSetPoint"};counts={},points={};for(var n in l)counts[n]=0,points[n]=l[n];var o={OutdoorAirTemperature:"blue",MixedAirTemperature:"LightPink",ReturnAirTemperature:"HotPink",DischargeAirTemperature:"Gainsboro",DischargeAirTemperatureSetPoint:"DarkKhaki",SupplyFanStatus:"BurlyWood",SupplyFanSpeed:"Chocolate",OutdoorDamper:"blueviolet",CCV:"Green",HCV:"Red",OutdoorAirFraction:"DarkBlue",ReturnFanSpeed:"CadetBlue",OccupancyMode:"Brown",DuctStaticPressure:"Magenta",DuctStaticPressureSetPoint:"DarkMagenta"},q="FTimestamp";a=D(a,k,q,points,counts);for(var n in counts)0==counts[n]&&delete points[n];var r=m(a[0][q],a[a.length-1][q],[a[0][q],a[1][q],a[2][q]]),v={Timestamp:q,Title:"AHU Economizer Response Analysis",Container:"#oa-chart-box1",TimeUnit:r};b(a,l,points,o,v);var w={Timestamp:q,Title:"AHU Discharge Static Pressure Control Performance Analysis",Container:"#sp-chart-box1"};c(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Simultaneous Heating and Cooling Performance Analysis",Container:"#coil-chart-box1"};d(a,l,points,o,w);var w={Timestamp:q,Title:"Discharge Air Temperature Set Point Performance Analysis",Container:"#discharge-chart-box1"};e(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Operational Day, Night and Weekend Operations Analysis",Container:"#fan-chart-box1"};f(a,l,points,o,w);var w={Timestamp:q,Title:"Seasonal AHU Economizer Damper Command Response Analysis",Container:"#oa-chart-box2"};g(a,l,points,o,w);var w={Timestamp:q,Title:"AHU VFD-Driven Fan Tracking (Supply and Return) Performance Analysis",Container:"#sp-chart-box2"};h(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Heating and Cooling Coil Performance Analysis",Container:"#coil-chart-box2"};i(a,l,points,o,w);var w={Timestamp:q,Title:"Discharge Air Temperature Control Performance Analysis",Container:"#discharge-chart-box2"};j(a,l,points,o,w),$(".rs-chart-container.hidden").removeClass("hidden")}function A(a){function b(a,b,c,d,f){var g=f.TimeUnit,h=f.Container,i=h+" .rs-chart",j=h+" .rs-y-axis",k=h+" .rs-y-axis2",l=h+" .rs-legend",m=h+" .title",n=h+" .rs-slider";if(document.querySelector(m).innerHTML=f.Title,!r(e.ZoneTemp,c))return $(h).find(".rs-chart-area").toggle(),!1;var o=d3.scale.linear().domain([0,200]),p=d3.scale.linear().domain([0,100]),s={};for(var v in c)(q(v,e.ZoneTemp)||q(v,e.ZoneSetPoint))&&(s[v]={name:v.replace(/^Zone/,"").replace(/^TerminalBox/,""),color:d[v],data:a.map(function(a){return{x:a[f.Timestamp],y:a[v]}}),scale:o}),(q(v,e.ZoneRhtVlvSignal)||q(v,e.ZoneDamperPos)||q(v,e.ZoneOcc)||q(v,e.ZoneFanStatus)||q(v,e.ZoneCFM))&&(s[v]={name:v.replace(/^Zone/,"").replace(/^TerminalBox/,""),color:d[v],data:a.map(function(a){return{x:a[f.Timestamp],y:a[v]}}),scale:p});var w=[];angular.forEach(s,function(a,b){w.push(a)});var x=new Rickshaw.Graph({element:document.querySelector(i),renderer:"line",series:w,interpolation:"linear"});x.render();var y=new Rickshaw.Graph.Legend({graph:x,element:document.querySelector(l)}),z=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:x, -legend:y}),new Rickshaw.Graph.Axis.ExtendedTime({graph:x,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:g}));z.render();var A=new Rickshaw.Graph.Axis.Y.Scaled({graph:x,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,label:t("Temperature")});A.render();var B=new Rickshaw.Graph.Axis.Y.Scaled({graph:x,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(k),scale:p,ticks:5,label:u("Command Signal")});B.render();new Rickshaw.Graph.RangeSlider.Preview({graph:x,element:document.querySelector(n)})}var c="datetime",e={ZoneTemp:"ZoneTemperature",ZoneRhtVlvSignal:"TerminalBoxReheatValvePosition",ZoneDamperPos:"TerminalBoxDamperCommand",ZoneOcc:"ZoneOccupancyMode",ZoneFanStatus:"ZoneFanStatus",ZoneSetPoint:"ZoneTemperatureSetPoint",ZoneCFM:"TerminalBoxFanAirflow"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&q(g,e[h])&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var p=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),s={Timestamp:o,Title:"Zone Terminal Box Performance Analysis",Container:"#temps-chart-box",TimeUnit:p};b(a,f,j,l,s),$(".rs-chart-container.hidden").removeClass("hidden")}function B(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title",l=g+" .rs-slider";if(document.querySelector(k).innerHTML=e.Title,!p("HotWaterSupplyTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var m=d3.scale.linear().domain([0,200]),n=(d3.scale.linear().domain([0,100]),{});p("HotWaterSupplyTemperature",c)&&(n.HotWaterSupplyTemperature={name:"Hot Water Supply Temperature",color:d.HotWaterSupplyTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterSupplyTemperature]}}),scale:m}),p("HotWaterReturnTemperature",c)&&(n.HotWaterReturnTemperature={name:c.HotWaterReturnTemperature,color:d.HotWaterReturnTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterReturnTemperature]}}),scale:m},n.HotWaterDeltaT={name:"HotWaterDeltaT",color:d.HotWaterDeltaT,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterSupplyTemperature]-a[c.HotWaterReturnTemperature]}}),scale:m}),p("HotWaterTemperatureSetPoint",c)&&(n.HotWaterTemperatureSetPoint={name:"Hot Water Temperature Set Point",color:d.HotWaterTemperatureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterTemperatureSetPoint]}}),scale:m}),p("OutdoorAirTemperature",c)&&(n.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:m}),p("ZoneSetPoint",c)&&(n.ZoneSetPoint={name:"Zone Temperature Set Point",color:d.ZoneSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneSetPoint]}}),scale:m});var o=[];angular.forEach(n,function(a,b){o.push(a)});var q=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:o,interpolation:"linear"});q.render();var r=new Rickshaw.Graph.Legend({graph:q,element:document.querySelector(j)}),s=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:q,legend:r}),new Rickshaw.Graph.Axis.ExtendedTime({graph:q,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));s.render();var u=new Rickshaw.Graph.Axis.Y.Scaled({graph:q,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:m,label:t("Temperature")});u.render();new Rickshaw.Graph.RangeSlider.Preview({graph:q,element:document.querySelector(l)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("LoopDifferentialPressure",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("LoopDifferentialPressure",c)&&(q.LoopDifferentialPressure={name:"Loop Differential Pressure",color:d.LoopDifferentialPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.LoopDifferentialPressure]}}),scale:n}),p("LoopDifferentialPressureSetPoint",c)&&(q.LoopDifferentialPressureSetPoint={name:"Loop Differential Pressure SetPoint",color:d.LoopDifferentialPressureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.LoopDifferentialPressureSetPoint]}}),scale:n}),p("HotWaterPumpVfd",c)&&(q.HotWaterPumpVfd={name:"Hot Water Pump Vfd",color:d.HotWaterPumpVfd,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterPumpVfd]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u("Command Signal")});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("HotWaterSupplyTemperature",c)||!p("OutdoorAirTemperature",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.OutdoorAirTemperature]b[c.OutdoorAirTemperature]?1:0});var k={};p("HotWaterSupplyTemperature",c)&&(k.HotWaterSupplyTemperature={name:"Hot Water Supply Temperature",xName:c.OutdoorAirTemperature,color:d.HotWaterSupplyTemperature,data:a.map(function(a){return{x:a[c.OutdoorAirTemperature],y:a[c.HotWaterSupplyTemperature]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.HotWaterSupplyTemperature]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Air Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Hot Water Supply Temperature")});o.render()}var e="datetime",f={OutdoorAirTemperature:"OutdoorAirTemperature",LoopDifferentialPressure:"LoopDifferentialPressure",LoopDifferentialPressureSetPoint:"LoopDifferentialPressureSetPoint",PumpStatus:"PumpStatus",BoilerStatus:"BoilerStatus",HotWaterPumpVfd:"HotWaterPumpVfd",HotWaterSupplyTemperature:"HotWaterSupplyTemperature",HotWaterTemperatureSetPoint:"HotWaterTemperatureSetPoint",HotWaterReturnTemperature:"HotWaterReturnTemperature"};counts={},points={};for(var g in f)counts[g]=0,points[g]=f[g];var h={OutdoorAirTemperature:"blue",HotWaterTemperatureSetPoint:"HotPink",HotWaterReturnTemperature:"LightPink",HotWaterSupplyTemperature:"Red",LoopDifferentialPressure:"DarkMagenta",LoopDifferentialPressureSetPoint:"Magenta",PumpStatus:"Chocolate",BoilerStatus:"blueviolet",HotWaterPumpVfd:"Green",HotWaterDeltaT:"Brown"},i="FTimestamp";a=D(a,e,i,points,counts);for(var g in counts)0==counts[g]&&delete points[g];var j=m(a[0][i],a[a.length-1][i],[a[0][i],a[1][i],a[2][i]]),k={Timestamp:i,Title:"Hot Water Plant Set Point Performance Analysis",Container:"#temp-box",TimeUnit:j};b(a,f,points,h,k);var l={Timestamp:i,Title:"Hot Water Plant Loop Differential Pressure Set Point Performance Analysis",Container:"#pressure-box",TimeUnit:j};c(a,f,points,h,l);var l={Timestamp:i,Title:"Seasonal Hot Water Temperature Response Analysis",Container:"#hws-oat-box"};d(a,f,points,h,l),$(".rs-chart-container.hidden").removeClass("hidden")}function C(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var o=d3.scale.linear().domain([60,80]),q=d3.scale.linear().domain([0,5]),r={},s=a.filter(function(a){return"data"==a.type?!0:!1});p("ZoneTemperature",c)&&(r.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",interpolation:"linear",data:s.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneTemperature]}}),scale:o}),p("FanStatus",c)&&(r.FanStatus={name:"Fan Status",color:d.FanStatus,renderer:"bar",data:s.map(function(a){return{x:a[e.Timestamp],y:a[c.FanStatus]}}),scale:q}),p("ZoneTemperatureSetPoint",c)&&(setpoints=a.filter(function(a){return"setpoint"==a.type?!0:!1}),numSetpoints=setpoints.length,numSetpoints>0&&(setpoints.sort(function(a,b){return a[e.Timestamp]-b[e.Timestamp]}),setpoints_viz=s.map(function(a){for(n=0;n=numSetpoints&&(n=numSetpoints-1),{x:a[e.Timestamp],y:setpoints[n][c.ZoneTemperatureSetPoint]}}),r.ZoneTemperatureSetPoint={name:"Zone Temperature Set Point",color:d.ZoneTemperatureSetPoint,renderer:"line",interpolation:"step-after",data:setpoints_viz,scale:o}));var v=[];angular.forEach(r,function(a,b){v.push(a)});var w=new Rickshaw.Graph({element:document.querySelector(h),series:v,renderer:"multi"});w.render();var x=new Rickshaw.Graph.Legend({graph:w,element:document.querySelector(k)}),y=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:w,legend:x}),new Rickshaw.Graph.Axis.ExtendedTime({graph:w,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));y.render();var z=new Rickshaw.Graph.Axis.Y.Scaled({graph:w,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:o,label:t()});z.render();var A=new Rickshaw.Graph.Axis.Y.Scaled({graph:w,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:q,ticks:5,label:u()});A.render();new Rickshaw.Graph.RangeSlider.Preview({graph:w,element:document.querySelector(m)})}var c="datetime",e={ZoneTemperature:"ZoneTemperature",ZoneTemperatureSetPoint:"ZoneTemperatureSetPoint",FanStatus:"FanStatus"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&g==e[h]&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var q=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),r={Timestamp:o,Title:"Temperature Set Point Detection",Container:"#temps-chart-box",TimeUnit:q};b(a,f,j,l,r),$(".rs-chart-container.hidden").removeClass("hidden")}function D(a,b,c,d,e){return a.forEach(function(a){var f=a[b].split("+")[0];f=f.replace(" ","T"),f=Date.parse(f)/1e3,a[c]=f,v(a,d,e)}),a.sort(function(a,b){return a[c]-b[c]}),a}function E(a,b,c){var d=a.filter(function(a){return a[c]>-9999?!0:!1}).map(function(a){return{x:a[b],y:a[c]}});return d}function F(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c)&&!p("FanStatus",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([60,80]),o=d3.scale.linear().domain([0,15]),q={};if(p("ZoneTemperature",c)){var r=E(a,e.Timestamp,c.ZoneTemperature);r.length>0&&(q.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",interpolation:"linear",data:r,scale:n})}if(p("FanStatus",c)){var r=E(a,e.Timestamp,c.FanStatus);r.length>0&&(q.FanStatus={name:"Fan Status",color:d.FanStatus,renderer:"line",interpolation:"step-after",data:r,scale:o})}if(p("ZoneTemperatureSetPoint",c)){var r=E(a,e.Timestamp,c.ZoneTemperatureSetPoint);r.length>0&&(q.ZoneTemperatureSetPoint={name:"Zone Temperature SetPoint",color:d.ZoneTemperatureSetPoint,renderer:"line",interpolation:"linear",data:r,scale:n})}if(p("ComprStatus",c)){var r=E(a,e.Timestamp,c.ComprStatus);r.length>0&&(q.ComprStatus={name:"Compressor Status",color:d.ComprStatus,renderer:"bar",data:r,scale:o})}var s=[];angular.forEach(q,function(a,b){s.push(a)});var v=new Rickshaw.Graph({element:document.querySelector(h),series:s,renderer:"multi"});v.render();var w=new Rickshaw.Graph.Legend({graph:v,element:document.querySelector(k)}),x=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:v,legend:w}),new Rickshaw.Graph.Axis.ExtendedTime({graph:v,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:v,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});y.render();var z=new Rickshaw.Graph.Axis.Y.Scaled({graph:v,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});z.render();new Rickshaw.Graph.RangeSlider.Preview({graph:v,element:document.querySelector(m)})}function c(a,b,c){var d=[];if(p("cycling",b)){var e=E(a,c.Timestamp,b.cycling),f=e.filter(function(a){return a.y>0?!0:!1}).map(function(a){return{x:new Date(1e3*a.x),y:a.y}});if(f.length>0){f.sort(function(a,b){return a.x-b.x});var g=null,i=null,j=0;f.forEach(function(a){i=h(a.x),(null==g||i==g)&&(j+=a.y,g=i),i!=g&&(d.push({x:g,y:j}),j=a.y,g=i)}),d.push({x:g,y:j})}}var k="
    ";d.length>0&&d.forEach(function(a){k+="
  • "+a.x+": "+a.y+" cycles detected
  • "}),k+="
",document.querySelector(c.Container).innerHTML=k}var e="datetime",f={ZoneTemperature:"ZoneTemperature",ZoneTemperatureSetPoint:"ZoneTemperatureSetPoint",FanStatus:"FanStatus",ComprStatus:"ComprStatus",cycling:"cycling"},g={};if(a.length>0){d=a[0];for(var i in d)if(d.hasOwnProperty(i))for(var j in f)f.hasOwnProperty(j)&&i==f[j]&&(g[i]=i)}var k={},l={};for(var n in g)k[n]=0,l[n]=g[n];var o={},q=0;for(var j in l)o[j]=x(q++);var r="FTimestamp";a=D(a,e,r,l,k);for(var n in k)0==k[n]&&delete l[n];var s=m(a[0][r],a[a.length-1][r],[a[0][r],a[1][r],a[2][r]]),v={Timestamp:r,Title:"Compressor Cycling Diagnostics",Container:"#temps-chart-box",TimeUnit:s};b(a,g,l,o,v),v={Timestamp:r,Title:"Compressor Cycling Diagnostics",Container:"#cycling-result"},c(a,l,v),$(".rs-chart-container.hidden").removeClass("hidden")}function G(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([60,80]),o=d3.scale.linear().domain([0,5]),q={};p("ZoneTemperature",c)&&(q.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneTemperature]}}),scale:n}),p("schedule",c)&&(q.schedule={name:"Schedule Status",color:d.schedule,renderer:"stack",data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.schedule]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),series:r,renderer:"multi",interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}var c="datetime",e={ZoneTemperature:"ZoneTemperature",schedule:"schedule"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&g==e[h]&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var q=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),r={Timestamp:o,Title:"Temperature Set Point Detection",Container:"#temps-chart-box",TimeUnit:q};b(a,f,j,l,r),$(".rs-chart-container.hidden").removeClass("hidden")}function H(a){function b(a,b,c,d,e,f,g,h,i){var j=d.Container,k=j+" .rs-chart",l=j+" .rs-y-axis",m=j+" .rs-legend",n=j+" .title";if(document.querySelector(n).innerHTML=d.Title,!p("Load",b))return $(j).find(".rs-chart-area").toggle(),!1;var o={};o.DailyLoad={name:"Daily Load",xName:"Hour",color:c[0],data:e.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.WeekdayLoad={name:"Weekday Load",xName:"Hour",color:c[1],data:f.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.SaturdayLoad={name:"Saturday Load",xName:"Hour",color:c[2],data:g.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.SundayLoad={name:"Sunday Load",xName:"Hour",color:c[3],data:h.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.HolidayLoad={name:"Holiday Load",xName:"Hour",color:c[4],data:i.map(function(a){return{x:a.Hour,y:a[b.Load]}})};var q=new Rickshaw.Graph({element:document.querySelector(k),renderer:"line",series:[o.DailyLoad,o.WeekdayLoad,o.SaturdayLoad,o.SundayLoad,o.HolidayLoad]});q.renderer.dotSize=2,q.render();var r=new Rickshaw.Graph.Legend({graph:q,element:document.querySelector(m)}),u=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:q,legend:r}),new Rickshaw.Graph.Axis.X({graph:q,label:s("Hour")}));u.render();var v=new Rickshaw.Graph.Axis.Y({graph:q,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(l),label:t("Energy (kWh)")});v.render()}var c="datetime",d={Load:"load"},e={},f={};for(var g in d)e[g]=0,f[g]=d[g];var h={},i=0;for(i=0;5>i;i++)h[i]=x(i);var j="FTimestamp";a=D(a,c,j,f,e);for(var g in e)0==e[g]&&delete f[g];var k={Timestamp:j,Title:"Daily Load Profile - All Days",Container:"#loadprofile-chart-box"},l=J(a,"A"),m=J(a,"W"),n=J(a,"Sat"),o=J(a,"Sun"),q=J(a,"H");b(d,f,h,k,l,m,n,o,q),$(".rs-chart-container.hidden").removeClass("hidden")}function I(a){function b(a,b,c,d,e,f){var g=d.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title";if(document.querySelector(k).innerHTML=d.Title,!p("Load",b))return $(g).find(".rs-chart-area").toggle(),!1;var l={};l.PreLoad={name:"Pre Rx Load",xName:"Hour",color:c[0],data:e.map(function(a){return{x:a.Hour,y:a[b.Load]}})},l.PostLoad={name:"Post Rx Load",xName:"Hour",color:c[1],data:f.map(function(a){return{x:a.Hour,y:a[b.Load]}})};var m=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:[l.PreLoad,l.PostLoad]});m.renderer.dotSize=2,m.render();var n=new Rickshaw.Graph.Legend({graph:m,element:document.querySelector(j)}),o=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:m,legend:n}),new Rickshaw.Graph.Axis.X({graph:m,label:s("Hour")}));o.render();var q=new Rickshaw.Graph.Axis.Y({graph:m,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),label:t("Energy (kWh)")});q.render()}var c="datetime",d={Load:"load"},e={},f={};for(var g in d)e[g]=0,f[g]=d[g];var h={},i=0;for(i=0;5>i;i++)h[i]=x(i);var j="FTimestamp";a=D(a,c,j,f,e);for(var g in e)0==e[g]&&delete f[g];var k={Timestamp:j,Title:"Daily Load Profile - All Days",Container:"#loadprofile-alldays-chart-box"},l={Timestamp:j,Title:"Daily Load Profile - Week Days",Container:"#loadprofile-weekdays-chart-box"},m={Timestamp:j,Title:"Daily Load Profile - Saturday",Container:"#loadprofile-sat-chart-box"},n={Timestamp:j,Title:"Daily Load Profile - Sunday",Container:"#loadprofile-sun-chart-box"},o={Timestamp:j,Title:"Daily Load Profile - Holidays",Container:"#loadprofile-holidays-chart-box"},q=K(a,"A","pre"),r=K(a,"W","pre"),u=K(a,"Sat","pre"),v=K(a,"Sun","pre"),w=K(a,"H","pre"),y=K(a,"A","post"),z=K(a,"W","post"),A=K(a,"Sat","post"),B=K(a,"Sun","post"),C=K(a,"H","post");b(d,f,h,k,q,y),b(d,f,h,l,r,z),b(d,f,h,m,u,A),b(d,f,h,n,v,B),b(d,f,h,o,w,C),$(".rs-chart-container.hidden").removeClass("hidden")}function J(a,b){for(sums=[],counts=[],avgs=[],result=[],i=0;i<24;i++)sums[i]=0,counts[i]=0,avgs[i]=0;for(a.forEach(function(a){if("A"==b||a.daytype==b){var c=w(a.datetime),d=(h(c),c.getHours());sums[d]+=a.load,counts[d]+=1}}),i=0;i<24;i++)counts[i]>0&&(avgs[i]=sums[i]/counts[i]),result.push({Hour:i,load:avgs[i]});return result}function K(a,b,c){for(sums=[],counts=[],avgs=[],result=[],i=0;i<24;i++)sums[i]=0,counts[i]=0,avgs[i]=0;for(a.forEach(function(a){if(("A"==b||a.daytype==b)&&a.rxtype==c){var d=w(a.datetime),e=(h(d),d.getHours());sums[e]+=a.load,counts[e]+=1}}),i=0;i<24;i++)counts[i]>0&&(avgs[i]=sums[i]/counts[i]),result.push({Hour:i,load:avgs[i]});return result}return{restrict:"E",terminal:!0,transclude:!0,scope:{arReport:"=",arData:"="},link:function(d,h,i){d.arReport.description&&h.append("

"+d.arReport.description+"

"),angular.forEach(d.arReport.elements,function(i){switch(i.title&&h.append("

"+i.title+"

"),i.type){case"Table":var j=angular.element("
"),k=j.find("tbody");angular.forEach(i.column_info,function(a){j.find("tr").append(""+a[1]+"")}),angular.forEach(d.arData[i.table_name],function(a){var b=angular.element("");angular.forEach(i.column_info,function(c){b.append(""+a[c[0]]+"")}),k.append(b)}),h.append(j);break;case"TextBlurb":h.append('

'+i.text+"

");break;case"LinePlot":angular.forEach(i.xy_dataset_list,function(a){var c=[];angular.forEach(d.arData[a.table_name],function(b){c.push({x:b[a.x_column],y:b[a.y_column]})}),h.append(angular.element('
').append(b(c,i.x_label,i.y_label)))});break;case"BarChart":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(c(b,i.x_label,i.y_label)))});break;case"ScatterPlot":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(e(b,i.x_label,i.y_label)))});break;case"DatetimeScatterPlot":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(f(b,i.x_label,i.y_label)))});break;case"HeatMap":var l=[];angular.forEach(d.arData[i.table_name],function(a){l.push({x:a[i.x_column],y:a[i.y_column],z:a[i.z_column]})}),h.append(angular.element('
').append(g(l,i.x_label,i.y_label)));break;case"RetroCommissioningAFDD":h.append(angular.element('
').append(o(d.arData[i.table_name],0)));break;case"SetpointDetector":h.append(angular.element('
').html("")),C(d.arData[i.table_name],0);break;case"CyclingDetector":var m=angular.element("
"),n=angular.element(" "),p=angular.element("
"),q=angular.element("
"),r=angular.element("
"),s=angular.element("
");r.append(s),p.append(q),p.append(r),m.append(n),m.append(p),h.append(m),F(d.arData[i.table_name],0),a(h.contents())(d);break;case"ScheduleDetector":h.append(angular.element('
').html("")),G(d.arData[i.table_name],0);break;case"LoadProfile":h.append(angular.element('
').html("")),H(d.arData[i.table_name],0);break;case"LoadProfileRx":h.append(angular.element('
').html(" ")),I(d.arData[i.table_name],0);break;case"RxStaticPressure":h.append(angular.element('
').append(o(d.arData[i.table_name],1)));break;case"RxSupplyTemp":h.append(angular.element('
').append(o(d.arData[i.table_name],2)));break;case"RxOperationSchedule":h.append(angular.element('
').append(o(d.arData[i.table_name],3)));break;case"RetroCommissioningAFDDEcam":var m=angular.element("
"),n=angular.element(" "),p=angular.element("
"),q=angular.element("
"),r=angular.element("
"),s=angular.element("
").append(o(d.arData[i.table_name],0)); +return a.get(b.current.params.projectId)}],dataFiles:["DataFiles","$route",function(a,b){return a.query(b.current.params.projectId)}],newDataMap:["$q","$route","DataFiles","DataMaps",function(a,b,c,d){return a.all({dataMap:d.get(b.current.params.dataMapId).$promise,dataFiles:c.query(b.current.params.projectId)}).then(function(a){return d.ensureFileMetaData(a.dataFiles).then(function(){return d.unFlattenMap(a.dataMap,a.dataFiles)})})}]}}).whenAuth("/projects/:projectId/datasets/:dataSetId",{controller:"DataSetCtrl",templateUrl:"data-set.tpl.html",resolve:{project:["Projects","$route",function(a,b){return a.get(b.current.params.projectId)}],dataSet:["DataSets","$route",function(a,b){return a.get(b.current.params.dataSetId).$promise}],head:["DataSets","$route",function(a,b){return a.head(b.current.params.dataSetId).$promise}]}}).whenAuth("/projects/:projectId/datasets/:dataSetId/manipulate",{controller:"DataSetManipulateCtrl",templateUrl:"data-set-manipulate.tpl.html",resolve:{project:["Projects","$route",function(a,b){return a.get(b.current.params.projectId)}],dataSet:["DataSets","$route",function(a,b){return a.get(b.current.params.dataSetId).$promise}]}}).when("/shared-analyses/:analysisId/:key",{controller:"SharedAnalysesCtrl",templateUrl:"shared-analyses.tpl.html"})}]).controller("AppCtrl",["$http","$scope","Modals","Auth",function(a,b,c,d){b.modalOpen=c.modalOpen,b.$on("accountChange",function(){d.account().then(function(a){b.account=a})}),b.logOut=function(){d.logOut()},a.get(settings.API_URL+"version").success(function(a){b.version=["v",a.version," (",a.revision,"#",a.vcs_version,") ",a.updated].join("")})}]).run(["$rootScope","$rootElement",function(a,b){a.$on("$viewContentLoaded",function(){window.setTimeout(function(){b.find("input").checkAndTriggerAutoFillEvent()},200)})}]),angular.module("openeis-ui.components.modals",[]).directive("modal",["Modals","$document",function(a,b){return{restrict:"E",transclude:!0,template:['"].join(""),scope:{},link:function(c,d,e){var f=b.find("body");c.$watch(function(){return a.modalOpen(e.modalId)},function(a){a?f.addClass("body--modal-open"):f.removeClass("body--modal-open"),c.modalOpen=a})}}}]).service("Modals",function(){var a=this,b={};a.openModal=function(a){b[a]=!0},a.closeModal=function(a){delete b[a]},a.modalOpen=function(a){return"undefined"==typeof a?!angular.equals(b,{}):b.hasOwnProperty(a)}}),angular.module("openeis-ui").controller("AccountCtrl",["$scope","Auth","$timeout",function(a,b,c){var d;b.account().then(function(b){a.account=b,d=angular.copy(b)}),a.$watchCollection("account",function(b){b.first_name!==d.first_name||b.email!=d.email?a.profile.changed=!0:a.profile.changed=!1}),a.profile={clearAlerts:function(){a.profile.success=!1,a.profile.error=!1},update:function(){a.profile.clearAlerts(),b.accountUpdate({first_name:a.account.first_name,email:a.account.email}).then(function(b){a.profile.success=!0,a.profile.changed=!1,d=angular.copy(a.account),c(a.profile.clearAlerts,2e3)},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.profile.error=b})}},a.password={clearAlerts:function(){a.password.mismatch=!1,a.password.success=!1,a.password.error=!1},update:function(){return a.password.clearAlerts(),a.password["new"]!==a.password.newConfirm?void(a.password.mismatch=!0):void b.accountPassword({old_password:a.password.current,new_password:a.password["new"]}).then(function(b){a.password.success=!0,a.password.current="",a.password["new"]="",a.password.newConfirm="",c(a.password.clearAlerts,2e3)},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.password.error=b})}}}]),angular.module("openeis-ui").controller("ConfigureTimestampCtrl",["$scope","DataFiles","$http","Modals",function(a,b,c,d){a.modal={columns:{},timeOffset:a.timestampFile.time_offset||0,timeZone:a.timestampFile.time_zone||jstz.determine().name()},a.timestampFile.timestamp&&a.timestampFile.timestamp.columns&&angular.forEach(a.timestampFile.timestamp.columns,function(b){a.modal.columns[b]=!0}),a.preview=function(){return a.selectedColumns=[],angular.forEach(a.modal.columns,function(b,c){b===!0&&a.selectedColumns.push(parseInt(c))}),a.selectedColumns.length?void b.timestamps(a.timestampFile.id,a.modal.timeOffset,a.modal.timeZone,a.selectedColumns.join(",")).then(function(b){a.modal.confirm=!0,a.modal.timestamps=b},function(a){alert(angular.toJson(a.data))}):void alert("Please select at least one column.")},a.save=function(){var c={columns:a.selectedColumns};b.update({id:a.timestampFile.id,timestamp:c,time_offset:a.modal.timeOffset,time_zone:a.modal.timeZone}).then(function(b){a.timestampFile.timestamp=c,a.timestampFile.time_zone=a.modal.timeZone,d.closeModal("configureTimestamp")},function(a){alert(angular.toJson(a))})}}]),angular.module("openeis-ui").controller("DataMapCtrl",["$scope","dataMap","project",function(a,b,c){a.dataMap=b,a.project=c}]),angular.module("openeis-ui").controller("DataSetCtrl",["$scope","project","dataSet","head",function(a,b,c,d){a.project=b,a.dataSet=c,a.data=d}]),angular.module("openeis-ui").controller("DataSetManipulateCtrl",["$location","$scope","DataMaps","DataSetFilters","DataSets","Modals","project","dataSet",function(a,b,c,d,e,f,g,h){b.Modals=f,b.project=g,b.dataSet=h,b.availableFilters=d.query(),b.topicFilters={},b.globalSettings={performFill:!0,performAggregation:!0,periodSeconds:3600,dropExtra:!0,roundTime:!1},b.$on("$locationChangeStart",function(a){b.filterAdded()&&!confirm("Abandon data set manipulation?")&&a.preventDefault()}),b.filterAdded=function(){var a=!1;return angular.forEach(b.topicFilters,function(b){b.other.length&&(a=!0)}),a},b.initTopicFilters=function(a,d){b.topicFilters[a]={fill:null,aggregation:null,other:[]},c.getDefinition().then(function(c){c.sensors[d.type]&&(b.topicFilters[a].fill=c.sensors[d.type].default_fill,b.topicFilters[a].aggregation=c.sensors[d.type].default_aggregation)})},b.addFilterTo=function(a){b.newFilter={topic:a},f.openModal("newFilter")},b.saveNewFilter=function(){var a={};angular.forEach(b.newFilter.filter.parameters,function(c,d){a[d]=b.newFilter.parameters[d]}),b.topicFilters[b.newFilter.topic].other.push([b.newFilter.topic,b.newFilter.filter.id,a]),f.closeModal("newFilter")},b.raiseFilter=function(a){var c=b.topicFilters[a[0]].other,d=c.indexOf(a);0!==d&&(c.splice(d,1),c.splice(d-1,0,a))},b.lowerFilter=function(a){var c=b.topicFilters[a[0]].other,d=c.indexOf(a);d!==c.length-1&&(c.splice(d,1),c.splice(d+1,0,a))},b.deleteFilter=function(a){var c=b.topicFilters[a[0]].other;c.splice(c.indexOf(a),1)},b.apply=function(){var c=[];b.applying=!0,angular.forEach(b.topicFilters,function(a,d){b.globalSettings.performFill&&a.fill&&c.push([d,a.fill,{period_seconds:b.globalSettings.periodSeconds,drop_extra:b.globalSettings.dropExtra}]),b.globalSettings.performAggregation&&c.push([d,a.aggregation,{period_seconds:b.globalSettings.periodSeconds,round_time:b.globalSettings.roundTime}]),a.other.length&&(c=c.concat(a.other))}),e.manipulate(h,c).then(function(){b.topicFilters={},a.url("projects/"+g.id)},function(a){var b=a.data;angular.isArray(b)?alert(b.join("\n")):alert(b)})["finally"](function(){delete b.applying})}}]),angular.module("openeis-ui").controller("LoginCtrl",["$scope","Auth",function(a,b){a.logIn=function(){b.logIn({username:a.form.username,password:a.form.password})["catch"](function(b){a.form.error=b.status})},a.clearError=function(){a.form.error=null}}]),angular.module("openeis-ui").controller("NewAnalysisCtrl",["$scope","Applications","DataMaps","$q","Modals","Analyses",function(a,b,c,d,e,f){a.newAnalysis={debug:!1},a.$watch("newAnalysis.dataSet",function(){a.availableApps=[],a.newAnalysis.dataSet&&b.query().$promise.then(function(b){a.availableSensors={},allSensors=["TerminalBoxDamperCommand","TerminalBoxFanAirflow","TerminalBoxReheatValvePosition","OccupancyMode","ZoneTemperature","ZoneTemperatureSetPoint"],angular.forEach(a.newAnalysis.dataSet.datamap.sensors,function(b,c){b.type&&(a.availableSensors.hasOwnProperty(b.type)||(a.availableSensors[b.type]=[],allSensors.indexOf(b.type)>-1&&a.availableSensors[b.type].push({display:"All",value:c+"/All"})),a.availableSensors[b.type].push({display:c,value:c}))}),angular.forEach(b,function(b){var c={},d=[];return b.name=b.name||b.id,angular.forEach(b.inputs,function(a){c.hasOwnProperty(a.sensor_type)||(c[a.sensor_type]=0),c[a.sensor_type]+=a.count_min}),angular.forEach(c,function(b,c){var e=0;a.availableSensors[c]&&(e=a.availableSensors[c].length),b>e&&d.push("At least "+b+" "+c+" required, "+e+" available in data set")}),d.length?void a.availableApps.push({name:b.name,description:b.description,note:b.note,missingInputs:d}):void a.availableApps.push(b)})})});var g;a.$watch("newAnalysis.application",function(b,c){b&&b!==g&&(a.newAnalysis.configuration={parameters:{},inputs:{}},angular.forEach(b.inputs,function(b,c){a.newAnalysis.configuration.inputs[c]=[];for(var d=0;d++=a.availableSensors[c].length?!1:d.inputs[b].count_max&&e.inputs[b].length>=d.inputs[b].count_max?!1:!0:!1},a.addInputSensor=function(b){a.newAnalysis.configuration.inputs[b].push({})},a.deleteInputSensor=function(b,c){a.newAnalysis.configuration.inputs[b].splice(c,1)},a.run=function(){f.create({name:a.newAnalysis.dataSet.name+" - "+a.newAnalysis.application.name,dataset:a.newAnalysis.dataSet.id,application:a.newAnalysis.application.id,configuration:a.newAnalysis.configuration,debug:a.newAnalysis.debug}).$promise.then(function(b){a.analyses.push(b),a.statusCheck(),e.closeModal("newAnalysis")},function(a){alert(angular.toJson(a.data,!0))})}}]),angular.module("openeis-ui").controller("NewDataMapCtrl",["$location","$scope","project","dataFiles","DataMaps","DataSets","Modals","newDataMap",function(a,b,c,d,e,f,g,h){b.project=c,b.dataFiles=d,b.Modals=g,b.isObject=angular.isObject,e.ensureFileMetaData(b.dataFiles),b.newDataMap=h,b.$on("$locationChangeStart",function(a){b.newDataMap.map.children.length&&!confirm("Abandon unsaved data map?")&&a.preventDefault()}),b.$watch("newDataMap.map",function(){e.validateMap(b.newDataMap.map).then(function(a){b.newDataMap.valid=a.valid})},!0),b.addChild=function(a){var c,d="Name:",e=function(a){return a.name===c};do{if(c=prompt(d),!c)return;c=c.replace("/","-"),d='Error: "'+c+'" already exists. Name:'}while(b.newDataMap.map.children.some(e));b.newDataMap.map.children.unshift({level:a,name:c})},b.preview=function(){function a(b){angular.forEach(b,function(b){b.deleted!==!0&&(b.file&&(d[b.file.id]||(d[b.file.id]={key:h++ +"",name:b.file.name})),b.sensors&&a(b.sensors),b.children&&a(b.children))})}var c=[],d={},h=0;a(b.newDataMap.map.children),b.dataMapPreviewFiles={},angular.forEach(d,function(a,d){c.push({name:a.key,file:d}),b.dataMapPreviewFiles[a.key]=a.name}),f.preview(e.flattenMap(b.newDataMap.map),c).$promise.then(function(a){b.dataMapPreview=a,g.openModal("dataMapPreview")})},b.showError=function(a){alert([b.dataMapPreviewFiles[a.file],": row ",a.row,", column ",a.column,"\n",a.error].join(""))},b.save=function(){e.create(b.newDataMap).$promise.then(function(){b.newDataMap.map.children=[],a.url("projects/"+c.id)},function(a){alert(a.data.__all__.join("\n"))})}}]),angular.module("openeis-ui").controller("NewDataSetCtrl",["$filter","$location","$scope","project","dataFiles","dataMaps","DataMaps","DataSets","Modals",function(a,b,c,d,e,f,g,h,i){c.project=d,c.dataFiles=e,c.dataMaps=f,c.Modals=i,c.isObject=angular.isObject,g.ensureFileMetaData(c.dataFiles),c.newDataSet={files:{}},c.showError=function(a){alert([c.newDataSet.files[a.file].name,": row ",a.row,", column ",a.column,"\n",a.error].join(""))},c.submit=function(){c[c.newDataSet.action]()},c.preview=function(){var a=[];angular.forEach(c.newDataSet.files,function(b,c){a.push({name:c,file:b.id})}),h.preview(c.newDataSet.map,a).$promise.then(function(a){c.dataSetPreview=a,i.openModal("dataSetPreview")})},c.save=function(){var e=[];angular.forEach(c.newDataSet.files,function(a,b){e.push({name:b,file:a.id})}),h.create({name:c.newDataSet.map.name+" - "+a("date")(Date.now(),"short"),map:c.newDataSet.map.id,files:e}).$promise.then(function(a){b.url("projects/"+d.id)},function(a){alert(angular.toJson(a.data,!0))})}}]),angular.module("openeis-ui").controller("ProjectCtrl",["$scope","project","dataFiles","DataFiles","dataSets","DataSets","dataMaps","$upload","$timeout","$q","$http","Modals","analyses","Analyses","sharedAnalyses","SharedAnalyses",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){a.project=b,a.dataFiles=c,a.dataSets=e,a.dataMaps=g,a.Modals=l,a.analyses=m,a.sharedAnalyses=o;var q;a.statusCheck=function(){angular.forEach(a.dataSets,function(b){if(!b.status||"complete"!==b.status.status.slice(-8)){var c=[];c.push(f.getStatus(b).then(function(a){b.status=a.data,"processing"===b.status.status&&(b.status.status+=" - "+Math.floor(parseFloat(b.status.percent))+"%")})),c.push(f.getErrors(b).then(function(a){b.errors=a.data})),j.all(c).then(function(){"complete"!==b.status.status.slice(-8)&&(i.cancel(q),q=i(a.statusCheck,1e3))})}}),angular.forEach(a.analyses,function(b){"complete"!==b.status.slice(-8)&&n.get(b.id).$promise.then(function(c){angular.extend(b,c),"complete"!==b.status.slice(-8)&&(i.cancel(q),q=i(a.statusCheck,1e3))})})},a.statusCheck(),a.configureTimestamp=function(b){var c={timeZones:k.get(settings.TIMEZONES_URL)};a.dataFiles[b].head||(c.head=d.head(a.dataFiles[b].id)),j.all(c).then(function(c){c.head&&(c.head.has_header&&(c.head.header=c.head.rows.shift()),a.dataFiles[b].head=c.head,a.dataFiles[b].cols=[],angular.forEach(a.dataFiles[b].head.rows[0],function(c,d){a.dataFiles[b].cols.push(d)})),a.timestampFile=a.dataFiles[b],a.timeZones=c.timeZones.data,l.openModal("configureTimestamp")})},a.upload=function(c){var e=[];return a.uploading=!0,angular.forEach(c,function(c){e.push(h.upload({url:settings.API_URL+"projects/"+b.id+"/add_file",file:c}).then(function(b){d.get(b.data.id).then(function(b){a.dataFiles.push(b),a.configureTimestamp(a.dataFiles.length-1)})}))}),j.all(e)["catch"](function(a){var b;b=a.data.file?a.data.file.join("\n"):a.data,alert(b)})["finally"](function(){delete a.uploading,l.closeModal("uploadFile")})},a.errorsModal={},a.showErrors=function(b){a.errorsModal.files={},angular.forEach(b.files,function(b){angular.forEach(a.dataFiles,function(c){c.id===b.file&&(a.errorsModal.files[b.name]=c.name)}),a.errorsModal.files[b.name]||(a.errorsModal.files[b.name]='File "'+b.name+'"')}),a.errorsModal.errors=b.errors,l.openModal("dataSetErrors")},a.rename=function(b,c){function d(e){if(!a[b])throw"Collection not found: "+b;var f,g=a[b][c].name;e=e||"",e.length&&(e+="\n\n"),e+="Rename '"+g+"' to:",f=prompt(e),null!==f&&(f.length?(a[b][c].name=f,a[b][c].$save(function(){"dataSets"===b&&a.statusCheck()},function(e){a[b][c].name=g,d(e.data.__all__.join("\n"))})):d("Name cannot be empty."))}d()},a["delete"]=function(c,d){if(!a[c])throw"Collection not found: "+c;confirm("Delete '"+a[c][d].name+"'?")&&a[c][d].$delete(function(){a[c].splice(d,1),"sharedAnalyses"===c&&(a.sharedAnalyses=p.query(b.id))})},a.viewAnalysis=function(b){a.viewingAnalysis=b,delete a.viewingAnalysisData,l.openModal("viewAnalysis"),n.getData(b.id).then(function(b){a.viewingAnalysisData=b})},a.getAnalysisOutputUrl=function(a){return settings.API_URL+"analyses/"+a+"/download"},a.shareAnalysis=function(b){p.create(b.id).$promise.then(function(c){a.sharedAnalyses.push(c),a.viewLink(b.id)})},a.viewLink=function(b){angular.forEach(a.sharedAnalyses,function(c){c.analysis===b&&(a.viewingLink={url:window.location.protocol+"//"+window.location.host+"/shared-analyses/"+b+"/"+c.key,sharedAnalysis:c},l.openModal("viewLink"))})},a.revokeLink=function(b){confirm("Revoke sharing?")&&(angular.forEach(a.sharedAnalyses,function(c){c.analysis===b&&c.$delete(function(){a.sharedAnalyses.splice(a.sharedAnalyses.indexOf(c),1)})}),l.closeModal("viewLink"))}}]),angular.module("openeis-ui").controller("ProjectsCtrl",["$scope","projects","Projects",function(a,b,c){a.projects=b,a.newProject={name:"",create:function(){c.create({name:a.newProject.name}).then(function(b){a.newProject.name="",a.projects.push(b)})}},a.renameProject=function(b){var c=prompt("New project name:");c&&c.length&&(a.projects[b].name=c,a.projects[b].$save(function(c){a.projects[b]=c}))},a.deleteProject=function(b){a.projects[b].$delete(function(){a.projects.splice(b,1)})},a.cloneProject=function(b){var d=prompt("Cloned project name:");d&&d.length&&c.clone(a.projects[b].id,d).then(function(b){a.projects.push(b)})}}]),angular.module("openeis-ui").controller("RecoveryCtrl",["$scope","Auth","$routeParams",function(a,b,c){a.form={stage:1},c.username&&c.code?(a.form.stage=2,a.recovery={username:c.username,code:c.code}):a.recovery={},a.submit=function(){switch(a.form.stage){case 1:return void b.accountRecover1(a.recovery.id).then(function(){a.form.success="Email with temporary password reset link sent.",a.form.stage=!1,a.clearError()},function(b){404===b.status&&(b.data="Account with specified username or email address not found."),a.form.error=b});case 2:return a.recovery.password!==a.recovery.passwordConfirm?void(a.form.error={status:400,data:"Passwords do not match."}):void b.accountRecover2(a.recovery).then(function(){a.form.success="Password updated.",a.form.stage=!1,a.clearError()},function(b){404===b.status&&(b.data="Invalid password reset link."),a.form.error=b})}},a.clearError=function(){a.form.error=!1}}]),angular.module("openeis-ui").controller("SharedAnalysesCtrl",["$scope","SharedAnalyses","$routeParams","$location",function(a,b,c,d){a.valid=!0,b.get(c.analysisId,c.key).$promise.then(function(d){a.sharedAnalysis=d,b.getData(d.analysis,c.key).then(function(b){a.data=b})},function(){a.valid=!1})}]),angular.module("openeis-ui").controller("SignUpCtrl",["$scope","$location","Auth",function(a,b,c){a.form={},a.submit=function(){return a.account.password!==a.account.passwordConfirm?void(a.form.passwordConfirm="Passwords do not match."):void c.accountCreate(a.account).then(function(b){c.logIn({username:a.account.username,password:a.account.password})["catch"](function(b){a.form.error=b.status})},function(b){400===b.status&&angular.forEach(b.data,function(a,c){angular.isArray(a)&&(b.data[c]=a.join("
"))}),a.form.error=b})},a.clearError=function(){a.form.error=null}}]),angular.module("openeis-ui.directives.analysis-report",[]).directive("analysisReport",["$compile",function(a){function b(a,b,c){var d={top:20,right:20,bottom:30,left:50},e=920-d.left-d.right,f=300-d.top-d.bottom,g=d3.scale.linear().range([0,e]),h=d3.scale.linear().range([f,0]),i=d3.svg.axis().scale(g).orient("bottom"),j=d3.svg.axis().scale(h).orient("left"),k=d3.svg.line().x(function(a){return g(a.x)}).y(function(a){return h(a.y)}).interpolate("basis"),l=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),m=l.append("g").attr("transform","translate("+d.left+","+d.top+")");return g.domain(d3.extent(a,function(a){return a.x})),h.domain(d3.extent(a,function(a){return a.y})),m.append("g").attr("class","line-plot__axis line-plot__axis--x").attr("transform","translate(0,"+f+")").call(i),m.append("g").attr("class","line-plot__axis line-plot__axis--y").call(j).append("text").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),m.append("path").datum(a).attr("class","line-plot__line").attr("d",k),l[0]}function c(a,b,c){var d={top:20,right:20,bottom:30,left:50},e=920-d.left-d.right,f=300-d.top-d.bottom,g=d3.scale.ordinal().rangeRoundBands([0,e],.1),h=d3.scale.linear().range([f,0]),i=d3.svg.axis().scale(g).orient("bottom"),j=d3.svg.axis().scale(h).orient("left"),k=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),l=k.append("g").attr("transform","translate("+d.left+","+d.top+")");return g.domain(a.map(function(a){return a.x})),h.domain([0,d3.max(a,function(a){return a.y})]),l.append("g").attr("class","bar-chart__axis bar-chart__axis--x").attr("transform","translate(0,"+f+")").call(i).text(b),l.append("g").attr("class","bar-chart__axis bar-chart__axis--y").call(j).append("text").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),l.selectAll("bar-chart__bar").data(a).enter().append("rect").attr("class","bar-chart__bar").attr("x",function(a){return g(a.x)}).attr("width",g.rangeBand()).attr("y",function(a){return h(a.y)}).attr("height",function(a){return f-h(a.y)}),k[0]}function e(a,b,c){var d={top:20,right:20,bottom:30,left:40},e=920-d.left-d.right,f=300-d.top-d.bottom,g=function(a){return a.x},h=d3.scale.linear().range([0,e]),i=function(a){return h(g(a))},j=d3.svg.axis().scale(h).orient("bottom"),k=function(a){return a.y},l=d3.scale.linear().range([f,0]),m=function(a){return l(k(a))},n=d3.svg.axis().scale(l).orient("left"),o=function(a){return 0},p=d3.scale.category10(),q=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),r=q.append("g").attr("transform","translate("+d.left+","+d.top+")");d3.select("body").append("div").attr("class","tooltip").style("opacity",0);return h.domain([d3.min(a,g)-1,d3.max(a,g)+1]),l.domain([d3.min(a,k)-1,d3.max(a,k)+1]),r.append("g").attr("class","x axis").attr("transform","translate(0,"+f+")").call(j).append("text").attr("class","label").attr("x",e).attr("y",-6).style("text-anchor","end").text(b),r.append("g").attr("class","y axis").call(n).append("text").attr("class","label").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),r.selectAll(".dot").data(a).enter().append("circle").attr("class","dot").attr("r",3.5).attr("cx",i).attr("cy",m).style("fill",function(a){return p(o(a))}).append("svg:title").text(function(a){return b+": "+a.x+"\n"+c+": "+a.y}),q[0]}function f(a,b,c){var d={top:20,right:20,bottom:180,left:40},e=920-d.left-d.right,f=450-d.top-d.bottom,g=function(a){return Date.parse(a.x)},h=d3.time.scale().range([0,e]),i=function(a){return h(g(a))},j=d3.svg.axis().scale(h).orient("bottom").ticks(30),k=function(a){return a.y},l=d3.scale.linear().range([f,0]),m=function(a){return l(k(a))},n=d3.svg.axis().scale(l).orient("left"),o=function(a){return 0},p=d3.scale.category10(),q=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",f+d.top+d.bottom),r=q.append("g").attr("transform","translate("+d.left+","+d.top+")");d3.select("body").append("div").attr("class","tooltip").style("opacity",0);h.domain([d3.min(a,g)-1,d3.max(a,g)+1]),l.domain([d3.min(a,k)-1,d3.max(a,k)+1]);var s=[["%Y-%m",function(a){return a.getMonth()}],["%Y-%m-%d",function(a){return a.getDate()}],["%Y-%m-%d %H:%M",function(a){return a.getHours()}],["%Y-%m-%d %H:%M:%S",function(a){return a.getSeconds()}]];return j.tickFormat(d3.time.format("%Y")),h.ticks.apply(h,j.ticks()).forEach(function(a){for(;s.length&&s[0][1](a);)j.tickFormat(d3.time.format(s[0][0])),s.shift()}),r.append("g").attr("class","x axis").attr("transform","translate(0,"+f+")").call(j).append("text").attr("class","label").attr("x",e).attr("y",-6).style("text-anchor","end").text(b),r.selectAll(".x.axis > .tick > text").style("text-anchor","end").attr("transform","rotate(-90)").attr("dx","-.5em").attr("dy","-.5em"),r.append("g").attr("class","y axis").call(n).append("text").attr("class","label").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").text(c),r.selectAll(".dot").data(a).enter().append("circle").attr("class","dot").attr("r",3.5).attr("cx",i).attr("cy",m).style("fill",function(a){return p(o(a))}).append("svg:title").text(function(a){return b+": "+a.x+"\n"+c+": "+a.y}),q[0]}function g(a,b,c){var d={top:50,right:0,bottom:100,left:100},e=960-d.left-d.right,f=Math.floor(e/24),g=d3.set(a.map(function(a){return a.y})).values();height=(g.length+1)*f,legendElementWidth=2*f,buckets=9,colors=["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"];var h=d3.scale.quantile().domain(d3.extent(a,function(a){return a.z})).range(colors),i=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",e+d.left+d.right).attr("height",height+d.top+d.bottom),j=i.append("g").attr("transform","translate("+d.left+","+d.top+")"),k=(j.selectAll(".yLabel").data(g).enter().append("text").text(function(a){return a}).attr("x",0).attr("y",function(a,b){return b*f}).style("text-anchor","end").attr("transform","translate(-6,"+f/1.5+")").attr("class","yLabel"),j.selectAll(".xLabel").data(d3.range(24)).enter().append("text").text(function(a){return a}).attr("x",function(a,b){return b*f}).attr("y",0).style("text-anchor","middle").attr("transform","translate("+f/2+", -6)").attr("class","xLabel"),j.selectAll(".value").data(a).enter().append("rect").attr("x",function(a){return a.x*f}).attr("y",function(a){return g.indexOf(a.y)*f}).attr("rx",4).attr("ry",4).attr("class","value bordered").attr("width",f).attr("height",f).style("fill",colors[0]));k.transition().duration(1e3).style("fill",function(a){return h(a.z)}),k.append("title").text(function(a){return a.z});var l=j.selectAll(".legend").data([0].concat(h.quantiles()),function(a){return a}).enter().append("g").attr("class","legend");return l.append("rect").attr("x",function(a,b){return legendElementWidth*b}).attr("y",height).attr("width",legendElementWidth).attr("height",f/2).style("fill",function(a,b){return colors[b]}),l.append("text").attr("class","mono").text(function(a){return"≥ "+Math.round(a)}).attr("x",function(a,b){return legendElementWidth*b}).attr("y",height+f),i[0]}function h(a){var b=a.getDate();10>b&&(b="0"+b);var c=a.getMonth()+1;10>c&&(c="0"+c);var d=a.getFullYear();return d+"-"+c+"-"+b}function j(a){var b=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=b[a.getDay()];return c+" "+h(a)}function k(a,b){for(var c=[];b>=a;)c.push(a++);return c}function l(a){var b=a-Math.floor(a);return a-=b,("0"+a).slice(-2)+b.toString().substr(1)}function m(a,b,c){var d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],e=[],f=0;for(i=1;i=b[d[f][c][g].color_code].state_value&&(d[f][c][g]=a):d[f][c][g]=a:(d[f][c]={},d[f][c][g]=a):(d[f]={},d[f][c]={},d[f][c][g]=a)}});var e=[],f=[];for(var g in d)if(d.hasOwnProperty(g)){var i=g.split("-"),j=new Date(i[0],i[1]-1,i[2],0,0,0,0);f.push(j)}for(var k=d3.extent(f),l=k[1],m=k[0],n=Math.round(Math.abs((l-m)/864e5)),o=0;n>=o;o++){var p=new Date(m.getTime());p.setDate(p.getDate()+o);var q=h(p);if(d.hasOwnProperty(q))for(var r=0;rv;v++){var x=v.toString();d[q][c[r]].hasOwnProperty(x)&&(null!=d[q][c[r]][x].energy_impact&&(s=d[q][c[r]][x].energy_impact),b[d[q][c[r]][x].color_code].state_value>=b[u.state].state_value&&(u={state:d[q][c[r]][x].color_code,diagnostic:d[q][c[r]][x].diagnostic_name,diagnostic_message:d[q][c[r]][x].diagnostic_message,energy_impact:s}))}var y=u.state;u.state==b.RED.string&&(y=b.GREEN.string),s="NA";for(var v=0;24>v;v++){var x=v.toString();d[q][c[r]].hasOwnProperty(x)?(null!=d[q][c[r]][x].energy_impact&&(s=d[q][c[r]][x].energy_impact),t.push({date:p,y:v,state:d[q][c[r]][x].color_code,diagnostic:d[q][c[r]][x].diagnostic_name,diagnostic_message:d[q][c[r]][x].diagnostic_message,energy_impact:s})):t.push({date:p,y:v,state:y,diagnostic:"",diagnostic_message:b[y].value,energy_impact:"NA"})}e.push({date:p,y:r,state:u.state,diagnostic:u.diagnostic,diagnostic_message:u.diagnostic_message,energy_impact:u.energy_impact,hourly_result:t})}else{for(var t=[],v=0;24>v;v++)t.push({date:p,y:v,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA"});e.push({date:p,y:r,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA",hourly_result:t})}}else for(var r=0;rv;v++)t.push({date:p,y:v,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA"});e.push({date:p,y:r,state:b.GREEN.string,diagnostic:"",diagnostic_message:b.GREEN.value,energy_impact:"NA",hourly_result:t})}}return e}function o(a,b){function c(){L.select("g.x.axis").call(I),L.select("g.y.axis").call(J),$.selectAll("circle").attr("cx",function(a){var b=G(a.date);return 0>b&&(b=-1e4),b})}function d(a,b){var c=d.canvas||(d.canvas=document.createElement("canvas")),e=c.getContext("2d");e.font=b;var f=e.measureText(a);return f.width}var e=["Temperature Sensor Dx","Not Economizing When Unit Should Dx","Economizing When Unit Should Not Dx","Excess Outdoor-air Intake Dx","Insufficient Outdoor-air Intake Dx"],f=["HW Differential Pressure Control Loop Dx","HW Supply Temperature Control Loop Dx","HW loop High Differential Pressure Dx","HW loop Differential Pressure Reset Dx","HW loop High Supply Temperature Dx","HW loop Supply Temperature Reset Dx","HW loop Low Delta-T Dx"],g=["Duct Static Pressure Set Point Control Loop Dx","Low Duct Static Pressure Dx","High Duct Static Pressure Dx","No Static Pressure Reset Dx","Supply-air Temperature Set Point Control Dx","Low Supply-air Temperature Dx","High Supply-air Temperature Dx","No Supply-air Temperature Reset Dx","Operational Schedule Dx"]; +1==b&&(g=["Duct Static Pressure Set Point Control Loop Dx","Low Duct Static Pressure Dx","High Duct Static Pressure Dx","No Static Pressure Reset Dx"]),2==b&&(g=["Supply-air Temperature Set Point Control Dx","Low Supply-air Temperature Dx","High Supply-air Temperature Dx","No Supply-air Temperature Reset Dx"]),3==b&&(g=["Operational Schedule Dx"]);for(var h=null,i=!1,l=0;l-1&&(h=e,i=!0),f.indexOf(a[l].diagnostic_name)>-1&&(h=f,i=!0),g.indexOf(a[l].diagnostic_name)>-1&&(h=g,i=!0);if(i){var m=1024,o=100*h.length,p={top:40,right:0,bottom:150,left:360},q={top:30,right:30,bottom:50,left:30},r=m-p.left-p.right,s=o-p.top-p.bottom;0>s&&(o=250,s=80);var t=8,u="#ccc",v=d3.time.format("%b %d"),w=h,x={GREY:{value:"No Diagnosis",color:"#B3B3B3",state_value:0,string:"GREY"},GREEN:{value:"Normal",color:"#509E7A",state_value:1,string:"GREEN"},RED:{value:"Fault",color:"#E22400",state_value:2,string:"RED"}},y=w,z=d3.select(document.createElementNS("http://www.w3.org/2000/svg","svg")).attr("width",m).attr("height",o),A=n(a,x,h),B=d3.extent(A,function(a){return a.date}),C=w.length,D=6,E=Math.floor((r-q.left-q.right)/D),F=E*(A.length/C),G=d3.time.scale().domain(B).range([q.left,q.left+F]),H=d3.scale.ordinal().domain(y).rangePoints([s-q.top,q.bottom]),I=d3.svg.axis().scale(G).orient("bottom").ticks(d3.time.day).tickFormat(v),J=d3.svg.axis().scale(H).orient("left"),K=d3.behavior.zoom().scaleExtent([1,1]).on("zoom",c);K.x(G);var L=z.append("g").attr("transform","translate("+p.left+","+p.top+")");L.append("rect").attr("class","pane").attr("width",r).attr("height",s).call(K);var M=d3.tip().attr("class","d3-tip").offset([-10,0]).html(function(a){return"Date: "+j(a.date)+"
Diagnostic Message: "+a.diagnostic_message+"
Energy Impact: "+a.energy_impact+"
(Click to see hourly result)
"}),N=d3.tip().attr("class","d3-tip").offset([-10,0]).html(function(a){return"Date: "+j(a.date)+"
Hour: "+(a.y+1)+"
Diagnostic Message: "+a.diagnostic_message+"
Energy Impact: "+a.energy_impact+"
"});L.call(M),L.call(N);var O=z.append("g").attr("transform","translate("+m/3+","+p.top/3+")"),P=324,Q=34,R=15;O.append("rect").attr("width",P).attr("height",Q).attr("x",0).attr("y",0).attr("rx",5).attr("ry",5).style("stroke","#909090").style("stroke-width",1).style("fill","none");var S=R,T=[];for(var U in x)x.hasOwnProperty(U)&&T.push(x[U]);var V=O.selectAll("g").data(T).enter().append("g").attr("transform",function(a,b){if(b>0){var c=2*t,e=d(T[b-1].value,"17pt sans-serif");S+=c+e}return"translate("+S+","+Q/2+")"});V.append("circle").attr("cx",0).attr("cy",0).attr("r",t).attr("fill",function(a){return a.color}).attr("opacity",1).on("mouseover",null).on("mouseout",null),V.append("text").attr("x",2*t+1).attr("y",0).attr("dy",".35em").text(function(a){return a.value}).style("font-size","1em").style("font-family","sans-serif");var W=L.append("g").attr("id","xAxisEle_AFDD").attr("class","x axis");W.attr("clip-path","url(#clip_AFDD)").attr("transform","translate(0,"+(s-5)+")"),L.append("g").attr("class","y axis"),L.selectAll("line.y").data(y).enter().append("line").attr("class","yAxis").attr("x1",0).attr("x2",F).attr("y1",H).attr("y2",H).style("stroke",u),L.append("clipPath").attr("id","clip_AFDD").append("rect").attr("x",0).attr("y",0).attr("width",r).attr("height",s);var X=2*Math.PI,Y=20,Z=d3.scale.linear().domain([0,Y-1]).range([0,X]),$=(d3.svg.line.radial().interpolate("basis").tension(0).radius(t).angle(function(a,b){return Z(b)}),L.append("g").attr("clip-path","url(#clip_AFDD)"));return $.selectAll("circle").data(A).enter().append("circle").attr("cx",function(a){return G(a.date)}).attr("cy",function(a){return H(y[a.y])}).attr("r",t).attr("fill",function(a){return x[a.state].color}).attr("opacity",1).on("mouseover",M.show).on("mouseout",M.hide).on("mousedown",function(a){if(d3.select("#hrData").remove(),"No Supply-air Temperature Reset Dx"!==a.diagnostic&&"No Static Pressure Reset Dx"!==a.diagnostic&&("Operational Schedule Dx"!==a.diagnostic||"Supply fan is operating excessively during unoccupied times."!==a.diagnostic_message)&&""!==a.diagnostic){var b=24,c=k(1,24),d=d3.scale.ordinal().domain(c).rangeRoundBands([0,24*b]),e=d3.svg.axis().scale(d).orient("bottom"),f=p.left+40,g=z.append("g").attr("id","hrData").attr("width",24*b).attr("height",b).attr("transform","translate(0,"+(s+100)+")");g.append("g").attr("class","x axis").attr("transform","translate("+f+","+b+")").call(e);var i=g.append("g").attr("class","axis");i.append("text").attr("x",80).attr("y",b-7).text(h[a.y]),i.append("text").attr("x",80).attr("y",b+20).text("("+j(a.date)+")"),g.selectAll("rect").data(a.hourly_result).enter().append("rect").attr("x",function(a){return a.y*b+f}).attr("y",0).attr("width",b).attr("height",b).attr("fill",function(a){return x[a.state].color}).attr("opacity",1).style({"stroke-width":1,stroke:"black"}).on("mouseover",N.show).on("mouseout",N.hide)}}),c(),z[0]}}function p(a,b){return b.hasOwnProperty(a)?!0:!1}function q(a,b){return a.substring(0,b.length+3)===b+"___"?!0:!1}function r(a,b){for(var c in b)if(b.hasOwnProperty(c)&&q(c,a))return!0;return!1}function s(a){a="undefined"!=typeof a?a:"Temperature";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"18.5em",offsetY:"30em"};return b}function t(a){a="undefined"!=typeof a?a:"Temperature";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"0.8em",offsetY:"-8.5em"};return b}function u(a){a="undefined"!=typeof a?a:"Command/Status";var b={text:a,color:"black",opacity:.5,fontSize:"12px",offsetX:"3em",offsetY:"-8em"};return b}function v(a,b,c){for(var d in b)b.hasOwnProperty(d)&&(null==a[b[d]]?delete a[b[d]]:(a[b[d]]=parseFloat(a[b[d]]),c[d]+=1))}function w(a){var b=a.split(/[^0-9]/);return new Date(b[0],b[1]-1,b[2],b[3],b[4],b[5])}function x(a){var b=["Blue","BlueViolet","Brown","BurlyWood","CadetBlue","DarkGray","DarkGrey","DarkGreen","DarkKhaki","Magenta","Green","Red","Chocolate","HotPink","LightPink","Gainsboro","AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Chartreuse","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkMagenta","DarkOliveGreen","Darkorange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkSlateGrey","DarkTurquoise","DarkViolet","DeepPink","DeepSkyBlue","DimGray","DimGrey","DodgerBlue","FireBrick","FloralWhite","ForestGreen","Fuchsia","GhostWhite","Gold","GoldenRod","Gray","Grey","GreenYellow","HoneyDew","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGray","LightGrey","LightGreen","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateGray","LightSlateGrey","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","SlateGrey","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","Wheat","White","WhiteSmoke","Yellow","YellowGreen"];return b[a]}function y(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OATemp",c)||!p("MATemp",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,300]),q={};p("OATemp",c)&&(q.OATemp={name:"Outdoor Air Temperature",color:d.OATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OATemp]}}),scale:n}),p("MATemp",c)&&(q.MATemp={name:"Mixed Air Temperature",color:d.MATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.MATemp]}}),scale:n}),p("RATemp",c)&&(q.RATemp={name:"Return Air Temperature",color:d.RATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.RATemp]}}),scale:n}),p("OAF",c)&&(q.OAF={name:"Outdoor Air Fraction",color:d.OAF,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OAF]}}),scale:o}),p("DATemp",c)&&(q.DATemp={name:"Discharge Air Temperature",color:d.DATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATemp]}}),scale:n}),p("OADamper",c)&&(q.OADamper={name:"Outdoor Damper Signal",color:d.OADamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OADamper]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OATemp",c)||!p("DATemp",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,300]),q={};p("OATemp",c)&&(q.OATemp={name:"Outdoor Air Temperature",color:d.OATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OATemp]}}),scale:n}),p("DATemp",c)&&(q.DATemp={name:"Discharge Air Temperature",color:d.DATemp,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATemp]}}),scale:n}),p("DATempSetPoint",c)&&(q.DATempSetPoint={name:"Discharge Air Temperature Set Point",color:d.DATempSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DATempSetPoint]}}),scale:n}),p("OADamper",c)&&(q.OADamper={name:"Outdoor Damper Signal",color:d.OADamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OADamper]}}),scale:o}),p("CCValve",c)&&(q.CCValve={name:"Cooling Coil Valve Position",color:d.CCValve,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.CCValve]}}),scale:o}),p("HCValve",c)&&(q.HCValve={name:"Heating Coil Valve Position",color:d.HCValve,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HCValve]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("MATemp",c)||!p("OATemp",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,c){return a[b.OATemp]c[b.OATemp]?1:0});var k={MAOAT:{name:b.MATemp,xName:b.OATemp,color:d.MATemp,data:a.map(function(a){return{x:a[c.OATemp],y:a[c.MATemp]}})}},l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.MAOAT]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Mixed-Air Temperature")});o.render()}var e="datetime",f={OAF:"OutdoorAirFraction",OATemp:"OutdoorAirTemperature",MATemp:"MixedAirTemperature",RATemp:"ReturnAirTemperature",DATemp:"DischargeAirTemperature",DATempSetPoint:"DischargeAirTemperatureSetPoint",OADamper:"OutdoorDamper",CCValve:"CCV",HCValve:"HCV"};counts={},points={};for(var g in f)counts[g]=0,points[g]=f[g];var h={OATemp:"blue",MATemp:"pink",RATemp:"red",DATemp:"green",OADamper:"brown",OAF:"blueviolet",CCValve:"darkorange",HCValve:"darkorchid",DATempSetPoint:"darkred"},i="FTimestamp";a=D(a,e,i,points,counts);for(var g in counts)0==counts[g]&&delete points[g];var j=m(a[0][i],a[a.length-1][i],[a[0][i],a[1][i],a[2][i]]),k={Timestamp:i,Title:"AHU Economizer Performance Evaluation",Container:"#temps-chart-box",TimeUnit:j};b(a,f,points,h,k);var l={Timestamp:i,Title:"AHU Discharge Cooling and Economizer Performance Analysis",Container:"#hcv-box",TimeUnit:j};c(a,f,points,h,l);var n={Timestamp:i,Title:"Seasonal AHU Mixed Air Temperature Response Analysis",Container:"#mat-oat-box"};d(a,f,points,h,n),$(".rs-chart-container.hidden").removeClass("hidden")}function z(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("OutdoorAirTemperature",c)&&!p("OutdoorDamper",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("OutdoorAirTemperature",c)&&(q.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:n}),p("OutdoorAirFraction",c)&&(q.OutdoorAirFraction={name:c.OutdoorAirFraction,color:d.OutdoorAirFraction,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirFraction]}}),scale:o}),p("OutdoorDamper",c)&&(q.OutdoorDamper={name:"Outdoor Damper Signal",color:d.OutdoorDamper,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorDamper]}}),scale:o}),p("OccupancyMode",c)&&(q.OccupancyMode={name:"Occupancy Mode",color:d.OccupancyMode,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OccupancyMode]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("DuctStaticPressure",c)&&!p("DuctStaticPressureSetPoint",c)&&!p("SupplyFanSpeed",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,100]),o=d3.scale.linear().domain([0,200]),q={};p("DuctStaticPressure",c)&&(q.DuctStaticPressure={name:"Duct Static Pressure",color:d.DuctStaticPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressure]}}),scale:n}),p("DuctStaticPressureSetPoint",c)&&(q.DuctStaticPressureSetPoint={name:"Duct Static Pressure Set Point",color:d.DuctStaticPressureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressureSetPoint]}}),scale:o}),p("SupplyFanSpeed",c)&&(q.SupplyFanSpeed={name:"Supply Fan Speed",color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanSpeed]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("CCV",c)&&!p("HCV",c)&&!p("OutdoorAirTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("OutdoorAirTemperature",c)&&(q.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:n}),p("CCV",c)&&(q.CCV={name:"Cooling Coil Valve Position",color:d.CCV,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.CCV]}}),scale:o}),p("HCV",c)&&(q.HCV={name:"Heating Coil Valve Position",color:d.HCV,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HCV]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function e(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title",l=g+" .rs-slider";if(document.querySelector(k).innerHTML=e.Title,!p("DischargeAirTemperature",c)&&!p("DischargeAirTemperatureSetPoint",c)&&!p("OutdoorAirTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var m=d3.scale.linear().domain([0,200]),n=d3.scale.linear().domain([0,100]),o={};p("OutdoorAirTemperature",c)&&(o.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:m}),p("DischargeAirTemperature",c)&&(o.DischargeAirTemperature={name:"Discharge Air Temperature",color:d.DischargeAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DischargeAirTemperature]}}),scale:n}),p("DischargeAirTemperatureSetPoint",c)&&(o.DischargeAirTemperatureSetPoint={name:"Discharge Air Temperature Set Point",color:d.DischargeAirTemperatureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DischargeAirTemperatureSetPoint]}}),scale:n});var q=[];angular.forEach(o,function(a,b){q.push(a)});var r=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:q,interpolation:"linear"});r.render();var s=new Rickshaw.Graph.Legend({graph:r,element:document.querySelector(j)}),u=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:r,legend:s}),new Rickshaw.Graph.Axis.ExtendedTime({graph:r,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));u.render();var v=new Rickshaw.Graph.Axis.Y.Scaled({graph:r,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:m,label:t()});v.render();new Rickshaw.Graph.RangeSlider.Preview({graph:r,element:document.querySelector(l)})}function f(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!(p("SupplyFanSpeed",c)||p("SupplyFanStatus",c)||p("DuctStaticPressure",c)||p("ReturnFanSpeed",c)))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("DuctStaticPressure",c)&&(q.DuctStaticPressure={name:"Duct Static Pressure",color:d.DuctStaticPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.DuctStaticPressure]}}),scale:n}),p("SupplyFanSpeed",c)&&(q.SupplyFanSpeed={name:"Supply Fan Speed",color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanSpeed]}}),scale:o}),p("SupplyFanStatus",c)&&(q.SupplyFanStatus={name:"Supply Fan Status",color:d.SupplyFanStatus,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.SupplyFanStatus]}}),scale:o}),p("ReturnFanSpeed",c)&&(q.ReturnFanSpeed={name:"Return Fan Speed",color:d.ReturnFanSpeed,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ReturnFanSpeed]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function g(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("OutdoorAirTemperature",c)||!p("OutdoorDamper",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.OutdoorAirTemperature]b[c.OutdoorAirTemperature]?1:0});var k={};p("OutdoorDamper",c)&&(k.OutdoorDamper={name:"Outdoor Damper Signal",xName:c.OutdoorAirTemperature,color:d.OutdoorDamper,data:a.map(function(a){return{x:a[c.OutdoorAirTemperature],y:a[c.OutdoorDamper]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.OutdoorDamper]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Outdoor Damper Position")});o.render()}function h(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("SupplyFanSpeed",c)||!p("ReturnFanSpeed",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.ReturnFanSpeed]b[c.ReturnFanSpeed]?1:0});var k={};p("SupplyFanSpeed",c)&&(k.SupplyFanSpeed={name:"Supply Fan Speed",xName:c.ReturnFanSpeed,color:d.SupplyFanSpeed,data:a.map(function(a){return{x:a[c.ReturnFanSpeed],y:a[c.SupplyFanSpeed]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.SupplyFanSpeed]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Return Fan Speed")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Supply Fan Speed")});o.render()}function i(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("HCV",c)||!p("CCV",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.CCV]b[c.CCV]?1:0});var k={};p("HCV",c)&&(k.HCV={name:"Heating Coil Valve Position",xName:c.CCV,color:d.HCV,data:a.map(function(a){return{x:a[c.CCV],y:a[c.HCV]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.HCV]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Cooling Coil Valve")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Heating Coil Valve")});o.render()}function j(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("DischargeAirTemperatureSetPoint",c)||!p("DischargeAirTemperature",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.DischargeAirTemperatureSetPoint]b[c.DischargeAirTemperatureSetPoint]?1:0});var k={};p("DischargeAirTemperature",c)&&(k.DischargeAirTemperature={name:"Discharge Air Temperature",xName:c.DischargeAirTemperatureSetPoint,color:d.DischargeAirTemperature,data:a.map(function(a){return{x:a[c.DischargeAirTemperatureSetPoint],y:a[c.DischargeAirTemperature]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.DischargeAirTemperature]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Discharge Temperature SetPoint")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Discharge Temperature")});o.render()}var k="datetime",l={OutdoorAirTemperature:"OutdoorAirTemperature",MixedAirTemperature:"MixedAirTemperature",ReturnAirTemperature:"ReturnAirTemperature",DischargeAirTemperature:"DischargeAirTemperature",DischargeAirTemperatureSetPoint:"DischargeAirTemperatureSetPoint",SupplyFanStatus:"SupplyFanStatus",SupplyFanSpeed:"SupplyFanSpeed",OutdoorDamper:"OutdoorDamper",CCV:"CCV",HCV:"HCV",OutdoorAirFraction:"OutdoorAirFraction",ReturnFanSpeed:"ReturnFanSpeed",OccupancyMode:"OccupancyMode",DuctStaticPressure:"DuctStaticPressure",DuctStaticPressureSetPoint:"DuctStaticPressureSetPoint"};counts={},points={};for(var n in l)counts[n]=0,points[n]=l[n];var o={OutdoorAirTemperature:"blue",MixedAirTemperature:"LightPink",ReturnAirTemperature:"HotPink",DischargeAirTemperature:"Gainsboro",DischargeAirTemperatureSetPoint:"DarkKhaki",SupplyFanStatus:"BurlyWood",SupplyFanSpeed:"Chocolate",OutdoorDamper:"blueviolet",CCV:"Green",HCV:"Red",OutdoorAirFraction:"DarkBlue",ReturnFanSpeed:"CadetBlue",OccupancyMode:"Brown",DuctStaticPressure:"Magenta",DuctStaticPressureSetPoint:"DarkMagenta"},q="FTimestamp";a=D(a,k,q,points,counts);for(var n in counts)0==counts[n]&&delete points[n];var r=m(a[0][q],a[a.length-1][q],[a[0][q],a[1][q],a[2][q]]),v={Timestamp:q,Title:"AHU Economizer Response Analysis",Container:"#oa-chart-box1",TimeUnit:r};b(a,l,points,o,v);var w={Timestamp:q,Title:"AHU Discharge Static Pressure Control Performance Analysis",Container:"#sp-chart-box1"};c(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Simultaneous Heating and Cooling Performance Analysis",Container:"#coil-chart-box1"};d(a,l,points,o,w);var w={Timestamp:q,Title:"Discharge Air Temperature Set Point Performance Analysis",Container:"#discharge-chart-box1"};e(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Operational Day, Night and Weekend Operations Analysis",Container:"#fan-chart-box1"};f(a,l,points,o,w);var w={Timestamp:q,Title:"Seasonal AHU Economizer Damper Command Response Analysis",Container:"#oa-chart-box2"};g(a,l,points,o,w);var w={Timestamp:q,Title:"AHU VFD-Driven Fan Tracking (Supply and Return) Performance Analysis",Container:"#sp-chart-box2"};h(a,l,points,o,w);var w={Timestamp:q,Title:"AHU Heating and Cooling Coil Performance Analysis",Container:"#coil-chart-box2"};i(a,l,points,o,w);var w={Timestamp:q,Title:"Discharge Air Temperature Control Performance Analysis",Container:"#discharge-chart-box2"};j(a,l,points,o,w),$(".rs-chart-container.hidden").removeClass("hidden")}function A(a){function b(a,b,c,d,f){var g=f.TimeUnit,h=f.Container,i=h+" .rs-chart",j=h+" .rs-y-axis",k=h+" .rs-y-axis2",l=h+" .rs-legend",m=h+" .title",n=h+" .rs-slider";if(document.querySelector(m).innerHTML=f.Title,!r(e.ZoneTemp,c))return $(h).find(".rs-chart-area").toggle(),!1;var o=d3.scale.linear().domain([0,200]),p=d3.scale.linear().domain([0,100]),s={};for(var v in c)(q(v,e.ZoneTemp)||q(v,e.ZoneSetPoint))&&(s[v]={name:v.replace(/^Zone/,"").replace(/^TerminalBox/,""),color:d[v],data:a.map(function(a){return{x:a[f.Timestamp],y:a[v]}}),scale:o}),(q(v,e.ZoneRhtVlvSignal)||q(v,e.ZoneDamperPos)||q(v,e.ZoneOcc)||q(v,e.ZoneFanStatus)||q(v,e.ZoneCFM))&&(s[v]={name:v.replace(/^Zone/,"").replace(/^TerminalBox/,""),color:d[v],data:a.map(function(a){return{x:a[f.Timestamp],y:a[v]}}),scale:p});var w=[];angular.forEach(s,function(a,b){w.push(a)});var x=new Rickshaw.Graph({element:document.querySelector(i),renderer:"line",series:w,interpolation:"linear"});x.render();var y=new Rickshaw.Graph.Legend({graph:x,element:document.querySelector(l)}),z=(new Rickshaw.Graph.Behavior.Series.Toggle({ +graph:x,legend:y}),new Rickshaw.Graph.Axis.ExtendedTime({graph:x,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:g}));z.render();var A=new Rickshaw.Graph.Axis.Y.Scaled({graph:x,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,label:t("Temperature")});A.render();var B=new Rickshaw.Graph.Axis.Y.Scaled({graph:x,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(k),scale:p,ticks:5,label:u("Command Signal")});B.render();new Rickshaw.Graph.RangeSlider.Preview({graph:x,element:document.querySelector(n)})}var c="datetime",e={ZoneTemp:"ZoneTemperature",ZoneRhtVlvSignal:"TerminalBoxReheatValvePosition",ZoneDamperPos:"TerminalBoxDamperCommand",ZoneOcc:"ZoneOccupancyMode",ZoneFanStatus:"ZoneFanStatus",ZoneSetPoint:"ZoneTemperatureSetPoint",ZoneCFM:"TerminalBoxFanAirflow"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&q(g,e[h])&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var p=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),s={Timestamp:o,Title:"Zone Terminal Box Performance Analysis",Container:"#temps-chart-box",TimeUnit:p};b(a,f,j,l,s),$(".rs-chart-container.hidden").removeClass("hidden")}function B(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title",l=g+" .rs-slider";if(document.querySelector(k).innerHTML=e.Title,!p("HotWaterSupplyTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var m=d3.scale.linear().domain([0,200]),n=(d3.scale.linear().domain([0,100]),{});p("HotWaterSupplyTemperature",c)&&(n.HotWaterSupplyTemperature={name:"Hot Water Supply Temperature",color:d.HotWaterSupplyTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterSupplyTemperature]}}),scale:m}),p("HotWaterReturnTemperature",c)&&(n.HotWaterReturnTemperature={name:c.HotWaterReturnTemperature,color:d.HotWaterReturnTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterReturnTemperature]}}),scale:m},n.HotWaterDeltaT={name:"HotWaterDeltaT",color:d.HotWaterDeltaT,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterSupplyTemperature]-a[c.HotWaterReturnTemperature]}}),scale:m}),p("HotWaterTemperatureSetPoint",c)&&(n.HotWaterTemperatureSetPoint={name:"Hot Water Temperature Set Point",color:d.HotWaterTemperatureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterTemperatureSetPoint]}}),scale:m}),p("OutdoorAirTemperature",c)&&(n.OutdoorAirTemperature={name:"Outdoor Air Temperature",color:d.OutdoorAirTemperature,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.OutdoorAirTemperature]}}),scale:m}),p("ZoneSetPoint",c)&&(n.ZoneSetPoint={name:"Zone Temperature Set Point",color:d.ZoneSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneSetPoint]}}),scale:m});var o=[];angular.forEach(n,function(a,b){o.push(a)});var q=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:o,interpolation:"linear"});q.render();var r=new Rickshaw.Graph.Legend({graph:q,element:document.querySelector(j)}),s=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:q,legend:r}),new Rickshaw.Graph.Axis.ExtendedTime({graph:q,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));s.render();var u=new Rickshaw.Graph.Axis.Y.Scaled({graph:q,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:m,label:t("Temperature")});u.render();new Rickshaw.Graph.RangeSlider.Preview({graph:q,element:document.querySelector(l)})}function c(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("LoopDifferentialPressure",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([0,200]),o=d3.scale.linear().domain([0,100]),q={};p("LoopDifferentialPressure",c)&&(q.LoopDifferentialPressure={name:"Loop Differential Pressure",color:d.LoopDifferentialPressure,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.LoopDifferentialPressure]}}),scale:n}),p("LoopDifferentialPressureSetPoint",c)&&(q.LoopDifferentialPressureSetPoint={name:"Loop Differential Pressure SetPoint",color:d.LoopDifferentialPressureSetPoint,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.LoopDifferentialPressureSetPoint]}}),scale:n}),p("HotWaterPumpVfd",c)&&(q.HotWaterPumpVfd={name:"Hot Water Pump Vfd",color:d.HotWaterPumpVfd,data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.HotWaterPumpVfd]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:r,interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t("Pressure")});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u("Command Signal")});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}function d(a,b,c,d,e){var f=e.Container,g=f+" .rs-chart",h=f+" .rs-y-axis",i=f+" .rs-legend",j=f+" .title";if(document.querySelector(j).innerHTML=e.Title,!p("HotWaterSupplyTemperature",c)||!p("OutdoorAirTemperature",c))return $(f).find(".rs-chart-area").toggle(),!1;a.sort(function(a,b){return a[c.OutdoorAirTemperature]b[c.OutdoorAirTemperature]?1:0});var k={};p("HotWaterSupplyTemperature",c)&&(k.HotWaterSupplyTemperature={name:"Hot Water Supply Temperature",xName:c.OutdoorAirTemperature,color:d.HotWaterSupplyTemperature,data:a.map(function(a){return{x:a[c.OutdoorAirTemperature],y:a[c.HotWaterSupplyTemperature]}})});var l=new Rickshaw.Graph({element:document.querySelector(g),renderer:"scatterplot",series:[k.HotWaterSupplyTemperature]});l.renderer.dotSize=2,l.render();var m=new Rickshaw.Graph.Legend({graph:l,element:document.querySelector(i)}),n=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:l,legend:m}),new Rickshaw.Graph.Axis.X({graph:l,label:s("Outdoor Air Temperature")}));n.render();var o=new Rickshaw.Graph.Axis.Y({graph:l,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(h),label:t("Hot Water Supply Temperature")});o.render()}var e="datetime",f={OutdoorAirTemperature:"OutdoorAirTemperature",LoopDifferentialPressure:"LoopDifferentialPressure",LoopDifferentialPressureSetPoint:"LoopDifferentialPressureSetPoint",PumpStatus:"PumpStatus",BoilerStatus:"BoilerStatus",HotWaterPumpVfd:"HotWaterPumpVfd",HotWaterSupplyTemperature:"HotWaterSupplyTemperature",HotWaterTemperatureSetPoint:"HotWaterTemperatureSetPoint",HotWaterReturnTemperature:"HotWaterReturnTemperature"};counts={},points={};for(var g in f)counts[g]=0,points[g]=f[g];var h={OutdoorAirTemperature:"blue",HotWaterTemperatureSetPoint:"HotPink",HotWaterReturnTemperature:"LightPink",HotWaterSupplyTemperature:"Red",LoopDifferentialPressure:"DarkMagenta",LoopDifferentialPressureSetPoint:"Magenta",PumpStatus:"Chocolate",BoilerStatus:"blueviolet",HotWaterPumpVfd:"Green",HotWaterDeltaT:"Brown"},i="FTimestamp";a=D(a,e,i,points,counts);for(var g in counts)0==counts[g]&&delete points[g];var j=m(a[0][i],a[a.length-1][i],[a[0][i],a[1][i],a[2][i]]),k={Timestamp:i,Title:"Hot Water Plant Set Point Performance Analysis",Container:"#temp-box",TimeUnit:j};b(a,f,points,h,k);var l={Timestamp:i,Title:"Hot Water Plant Loop Differential Pressure Set Point Performance Analysis",Container:"#pressure-box",TimeUnit:j};c(a,f,points,h,l);var l={Timestamp:i,Title:"Seasonal Hot Water Temperature Response Analysis",Container:"#hws-oat-box"};d(a,f,points,h,l),$(".rs-chart-container.hidden").removeClass("hidden")}function C(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var o=d3.scale.linear().domain([60,80]),q=d3.scale.linear().domain([0,5]),r={},s=a.filter(function(a){return"data"==a.type?!0:!1});p("ZoneTemperature",c)&&(r.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",interpolation:"linear",data:s.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneTemperature]}}),scale:o}),p("FanStatus",c)&&(r.FanStatus={name:"Fan Status",color:d.FanStatus,renderer:"bar",data:s.map(function(a){return{x:a[e.Timestamp],y:a[c.FanStatus]}}),scale:q}),p("ZoneTemperatureSetPoint",c)&&(setpoints=a.filter(function(a){return"setpoint"==a.type?!0:!1}),numSetpoints=setpoints.length,numSetpoints>0&&(setpoints.sort(function(a,b){return a[e.Timestamp]-b[e.Timestamp]}),setpoints_viz=s.map(function(a){for(n=0;n=numSetpoints&&(n=numSetpoints-1),{x:a[e.Timestamp],y:setpoints[n][c.ZoneTemperatureSetPoint]}}),r.ZoneTemperatureSetPoint={name:"Zone Temperature Set Point",color:d.ZoneTemperatureSetPoint,renderer:"line",interpolation:"step-after",data:setpoints_viz,scale:o}));var v=[];angular.forEach(r,function(a,b){v.push(a)});var w=new Rickshaw.Graph({element:document.querySelector(h),series:v,renderer:"multi"});w.render();var x=new Rickshaw.Graph.Legend({graph:w,element:document.querySelector(k)}),y=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:w,legend:x}),new Rickshaw.Graph.Axis.ExtendedTime({graph:w,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));y.render();var z=new Rickshaw.Graph.Axis.Y.Scaled({graph:w,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:o,label:t()});z.render();var A=new Rickshaw.Graph.Axis.Y.Scaled({graph:w,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:q,ticks:5,label:u()});A.render();new Rickshaw.Graph.RangeSlider.Preview({graph:w,element:document.querySelector(m)})}var c="datetime",e={ZoneTemperature:"ZoneTemperature",ZoneTemperatureSetPoint:"ZoneTemperatureSetPoint",FanStatus:"FanStatus"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&g==e[h]&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var q=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),r={Timestamp:o,Title:"Temperature Set Point Detection",Container:"#temps-chart-box",TimeUnit:q};b(a,f,j,l,r),$(".rs-chart-container.hidden").removeClass("hidden")}function D(a,b,c,d,e){return a.forEach(function(a){var f=a[b].split("+")[0];f=f.replace(" ","T"),f=Date.parse(f)/1e3,a[c]=f,v(a,d,e)}),a.sort(function(a,b){return a[c]-b[c]}),a}function E(a,b,c){var d=a.filter(function(a){return a[c]>-9999?!0:!1}).map(function(a){return{x:a[b],y:a[c]}});return d}function F(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c)&&!p("FanStatus",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([60,80]),o=d3.scale.linear().domain([0,15]),q={};if(p("ZoneTemperature",c)){var r=E(a,e.Timestamp,c.ZoneTemperature);r.length>0&&(q.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",interpolation:"linear",data:r,scale:n})}if(p("FanStatus",c)){var r=E(a,e.Timestamp,c.FanStatus);r.length>0&&(q.FanStatus={name:"Fan Status",color:d.FanStatus,renderer:"line",interpolation:"step-after",data:r,scale:o})}if(p("ZoneTemperatureSetPoint",c)){var r=E(a,e.Timestamp,c.ZoneTemperatureSetPoint);r.length>0&&(q.ZoneTemperatureSetPoint={name:"Zone Temperature SetPoint",color:d.ZoneTemperatureSetPoint,renderer:"line",interpolation:"linear",data:r,scale:n})}if(p("ComprStatus",c)){var r=E(a,e.Timestamp,c.ComprStatus);r.length>0&&(q.ComprStatus={name:"Compressor Status",color:d.ComprStatus,renderer:"bar",data:r,scale:o})}var s=[];angular.forEach(q,function(a,b){s.push(a)});var v=new Rickshaw.Graph({element:document.querySelector(h),series:s,renderer:"multi"});v.render();var w=new Rickshaw.Graph.Legend({graph:v,element:document.querySelector(k)}),x=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:v,legend:w}),new Rickshaw.Graph.Axis.ExtendedTime({graph:v,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:v,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});y.render();var z=new Rickshaw.Graph.Axis.Y.Scaled({graph:v,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});z.render();new Rickshaw.Graph.RangeSlider.Preview({graph:v,element:document.querySelector(m)})}function c(a,b,c){var d=[];if(p("cycling",b)){var e=E(a,c.Timestamp,b.cycling),f=e.filter(function(a){return a.y>0?!0:!1}).map(function(a){return{x:new Date(1e3*a.x),y:a.y}});if(f.length>0){f.sort(function(a,b){return a.x-b.x});var g=null,i=null,j=0;f.forEach(function(a){i=h(a.x),(null==g||i==g)&&(j+=a.y,g=i),i!=g&&(d.push({x:g,y:j}),j=a.y,g=i)}),d.push({x:g,y:j})}}var k="
    ";d.length>0&&d.forEach(function(a){k+="
  • "+a.x+": "+a.y+" cycles detected
  • "}),k+="
",document.querySelector(c.Container).innerHTML=k}var e="datetime",f={ZoneTemperature:"ZoneTemperature",ZoneTemperatureSetPoint:"ZoneTemperatureSetPoint",FanStatus:"FanStatus",ComprStatus:"ComprStatus",cycling:"cycling"},g={};if(a.length>0){d=a[0];for(var i in d)if(d.hasOwnProperty(i))for(var j in f)f.hasOwnProperty(j)&&i==f[j]&&(g[i]=i)}var k={},l={};for(var n in g)k[n]=0,l[n]=g[n];var o={},q=0;for(var j in l)o[j]=x(q++);var r="FTimestamp";a=D(a,e,r,l,k);for(var n in k)0==k[n]&&delete l[n];var s=m(a[0][r],a[a.length-1][r],[a[0][r],a[1][r],a[2][r]]),v={Timestamp:r,Title:"Compressor Cycling Diagnostics",Container:"#temps-chart-box",TimeUnit:s};b(a,g,l,o,v),v={Timestamp:r,Title:"Compressor Cycling Diagnostics",Container:"#cycling-result"},c(a,l,v),$(".rs-chart-container.hidden").removeClass("hidden")}function G(a){function b(a,b,c,d,e){var f=e.TimeUnit,g=e.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-y-axis2",k=g+" .rs-legend",l=g+" .title",m=g+" .rs-slider";if(document.querySelector(l).innerHTML=e.Title,!p("ZoneTemperature",c))return $(g).find(".rs-chart-area").toggle(),!1;var n=d3.scale.linear().domain([60,80]),o=d3.scale.linear().domain([0,5]),q={};p("ZoneTemperature",c)&&(q.ZoneTemperature={name:"Zone Temperature",color:d.ZoneTemperature,renderer:"line",data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.ZoneTemperature]}}),scale:n}),p("schedule",c)&&(q.schedule={name:"Schedule Status",color:d.schedule,renderer:"stack",data:a.map(function(a){return{x:a[e.Timestamp],y:a[c.schedule]}}),scale:o});var r=[];angular.forEach(q,function(a,b){r.push(a)});var s=new Rickshaw.Graph({element:document.querySelector(h),series:r,renderer:"multi",interpolation:"linear"});s.render();var v=new Rickshaw.Graph.Legend({graph:s,element:document.querySelector(k)}),w=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:s,legend:v}),new Rickshaw.Graph.Axis.ExtendedTime({graph:s,orientation:"bottom",pixelsPerTick:50,tickSpacing:21600,timeUnit:f}));w.render();var x=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),scale:n,label:t()});x.render();var y=new Rickshaw.Graph.Axis.Y.Scaled({graph:s,berthRate:0,orientation:"right",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(j),scale:o,ticks:5,label:u()});y.render();new Rickshaw.Graph.RangeSlider.Preview({graph:s,element:document.querySelector(m)})}var c="datetime",e={ZoneTemperature:"ZoneTemperature",schedule:"schedule"},f={};if(a.length>0){d=a[0];for(var g in d)if(d.hasOwnProperty(g))for(var h in e)e.hasOwnProperty(h)&&g==e[h]&&(f[g]=g)}var i={},j={};for(var k in f)i[k]=0,j[k]=f[k];var l={},n=0;for(var h in j)l[h]=x(n++);var o="FTimestamp";a=D(a,c,o,j,i);for(var k in i)0==i[k]&&delete j[k];var q=m(a[0][o],a[a.length-1][o],[a[0][o],a[1][o],a[2][o]]),r={Timestamp:o,Title:"Temperature Set Point Detection",Container:"#temps-chart-box",TimeUnit:q};b(a,f,j,l,r),$(".rs-chart-container.hidden").removeClass("hidden")}function H(a){function b(a,b,c,d,e,f,g,h,i){var j=d.Container,k=j+" .rs-chart",l=j+" .rs-y-axis",m=j+" .rs-legend",n=j+" .title";if(document.querySelector(n).innerHTML=d.Title,!p("Load",b))return $(j).find(".rs-chart-area").toggle(),!1;var o={};o.DailyLoad={name:"Daily Load",xName:"Hour",color:c[0],data:e.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.WeekdayLoad={name:"Weekday Load",xName:"Hour",color:c[1],data:f.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.SaturdayLoad={name:"Saturday Load",xName:"Hour",color:c[2],data:g.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.SundayLoad={name:"Sunday Load",xName:"Hour",color:c[3],data:h.map(function(a){return{x:a.Hour,y:a[b.Load]}})},o.HolidayLoad={name:"Holiday Load",xName:"Hour",color:c[4],data:i.map(function(a){return{x:a.Hour,y:a[b.Load]}})};var q=new Rickshaw.Graph({element:document.querySelector(k),renderer:"line",series:[o.DailyLoad,o.WeekdayLoad,o.SaturdayLoad,o.SundayLoad,o.HolidayLoad]});q.renderer.dotSize=2,q.render();var r=new Rickshaw.Graph.Legend({graph:q,element:document.querySelector(m)}),u=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:q,legend:r}),new Rickshaw.Graph.Axis.X({graph:q,label:s("Hour")}));u.render();var v=new Rickshaw.Graph.Axis.Y({graph:q,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(l),label:t("Energy (kWh)")});v.render()}var c="datetime",d={Load:"load"},e={},f={};for(var g in d)e[g]=0,f[g]=d[g];var h={},i=0;for(i=0;5>i;i++)h[i]=x(i);var j="FTimestamp";a=D(a,c,j,f,e);for(var g in e)0==e[g]&&delete f[g];var k={Timestamp:j,Title:"Daily Load Profile - All Days",Container:"#loadprofile-chart-box"},l=J(a,"A"),m=J(a,"W"),n=J(a,"Sat"),o=J(a,"Sun"),q=J(a,"H");b(d,f,h,k,l,m,n,o,q),$(".rs-chart-container.hidden").removeClass("hidden")}function I(a){function b(a,b,c,d,e,f){var g=d.Container,h=g+" .rs-chart",i=g+" .rs-y-axis",j=g+" .rs-legend",k=g+" .title";if(document.querySelector(k).innerHTML=d.Title,!p("Load",b))return $(g).find(".rs-chart-area").toggle(),!1;var l={};l.PreLoad={name:"Pre Rx Load",xName:"Hour",color:c[0],data:e.map(function(a){return{x:a.Hour,y:a[b.Load]}})},l.PostLoad={name:"Post Rx Load",xName:"Hour",color:c[1],data:f.map(function(a){return{x:a.Hour,y:a[b.Load]}})};var m=new Rickshaw.Graph({element:document.querySelector(h),renderer:"line",series:[l.PreLoad,l.PostLoad]});m.renderer.dotSize=2,m.render();var n=new Rickshaw.Graph.Legend({graph:m,element:document.querySelector(j)}),o=(new Rickshaw.Graph.Behavior.Series.Toggle({graph:m,legend:n}),new Rickshaw.Graph.Axis.X({graph:m,label:s("Hour")}));o.render();var q=new Rickshaw.Graph.Axis.Y({graph:m,berthRate:0,orientation:"left",tickFormat:Rickshaw.Fixtures.Number.formatKMBT,element:document.querySelector(i),label:t("Energy (kWh)")});q.render()}var c="datetime",d={Load:"load"},e={},f={};for(var g in d)e[g]=0,f[g]=d[g];var h={},i=0;for(i=0;5>i;i++)h[i]=x(i);var j="FTimestamp";a=D(a,c,j,f,e);for(var g in e)0==e[g]&&delete f[g];var k={Timestamp:j,Title:"Daily Load Profile - All Days",Container:"#loadprofile-alldays-chart-box"},l={Timestamp:j,Title:"Daily Load Profile - Week Days",Container:"#loadprofile-weekdays-chart-box"},m={Timestamp:j,Title:"Daily Load Profile - Saturday",Container:"#loadprofile-sat-chart-box"},n={Timestamp:j,Title:"Daily Load Profile - Sunday",Container:"#loadprofile-sun-chart-box"},o={Timestamp:j,Title:"Daily Load Profile - Holidays",Container:"#loadprofile-holidays-chart-box"},q=K(a,"A","pre"),r=K(a,"W","pre"),u=K(a,"Sat","pre"),v=K(a,"Sun","pre"),w=K(a,"H","pre"),y=K(a,"A","post"),z=K(a,"W","post"),A=K(a,"Sat","post"),B=K(a,"Sun","post"),C=K(a,"H","post");b(d,f,h,k,q,y),b(d,f,h,l,r,z),b(d,f,h,m,u,A),b(d,f,h,n,v,B),b(d,f,h,o,w,C),$(".rs-chart-container.hidden").removeClass("hidden")}function J(a,b){for(sums=[],counts=[],avgs=[],result=[],i=0;i<24;i++)sums[i]=0,counts[i]=0,avgs[i]=0;for(a.forEach(function(a){if("A"==b||a.daytype==b){var c=w(a.datetime),d=(h(c),c.getHours());sums[d]+=a.load,counts[d]+=1}}),i=0;i<24;i++)counts[i]>0&&(avgs[i]=sums[i]/counts[i]),result.push({Hour:i,load:avgs[i]});return result}function K(a,b,c){for(sums=[],counts=[],avgs=[],result=[],i=0;i<24;i++)sums[i]=0,counts[i]=0,avgs[i]=0;for(a.forEach(function(a){if(("A"==b||a.daytype==b)&&a.rxtype==c){var d=w(a.datetime),e=(h(d),d.getHours());sums[e]+=a.load,counts[e]+=1}}),i=0;i<24;i++)counts[i]>0&&(avgs[i]=sums[i]/counts[i]),result.push({Hour:i,load:avgs[i]});return result}return{restrict:"E",terminal:!0,transclude:!0,scope:{arReport:"=",arData:"="},link:function(d,h,i){d.arReport.description&&h.append("

"+d.arReport.description+"

"),angular.forEach(d.arReport.elements,function(i){switch(i.title&&h.append("

"+i.title+"

"),i.type){case"Table":var j=angular.element("
"),k=j.find("tbody");angular.forEach(i.column_info,function(a){j.find("tr").append(""+a[1]+"")}),angular.forEach(d.arData[i.table_name],function(a){var b=angular.element("");angular.forEach(i.column_info,function(c){b.append(""+a[c[0]]+"")}),k.append(b)}),h.append(j);break;case"TextBlurb":h.append('

'+i.text+"

");break;case"LinePlot":angular.forEach(i.xy_dataset_list,function(a){var c=[];angular.forEach(d.arData[a.table_name],function(b){c.push({x:b[a.x_column],y:b[a.y_column]})}),h.append(angular.element('
').append(b(c,i.x_label,i.y_label)))});break;case"BarChart":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(c(b,i.x_label,i.y_label)))});break;case"ScatterPlot":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(e(b,i.x_label,i.y_label)))});break;case"DatetimeScatterPlot":angular.forEach(i.xy_dataset_list,function(a){var b=[];angular.forEach(d.arData[a.table_name],function(c){b.push({x:c[a.x_column],y:c[a.y_column]})}),h.append(angular.element('
').append(f(b,i.x_label,i.y_label)))});break;case"HeatMap":var l=[];angular.forEach(d.arData[i.table_name],function(a){l.push({x:a[i.x_column],y:a[i.y_column],z:a[i.z_column]})}),h.append(angular.element('
').append(g(l,i.x_label,i.y_label)));break;case"RetroCommissioningAFDD":h.append(angular.element('
').append(o(d.arData[i.table_name],0)));break;case"SetpointDetector":h.append(angular.element('
').html("")),C(d.arData[i.table_name],0);break;case"CyclingDetector":var m=angular.element("
"),n=angular.element(" "),p=angular.element("
"),q=angular.element("
"),r=angular.element("
"),s=angular.element("
");r.append(s),p.append(q),p.append(r),m.append(n),m.append(p),h.append(m),F(d.arData[i.table_name],0),a(h.contents())(d);break;case"ScheduleDetector":h.append(angular.element('
').html("")),G(d.arData[i.table_name],0);break;case"LoadProfile":h.append(angular.element('
').html("")),H(d.arData[i.table_name],0);break;case"LoadProfileRx":h.append(angular.element('
').html(" ")),I(d.arData[i.table_name],0);break;case"RxStaticPressure":h.append(angular.element('
').append(o(d.arData[i.table_name],1)));break;case"RxSupplyTemp":h.append(angular.element('
').append(o(d.arData[i.table_name],2)));break;case"RxOperationSchedule":h.append(angular.element('
').append(o(d.arData[i.table_name],3)));break;case"RetroCommissioningAFDDEcam":var m=angular.element("
"),n=angular.element(" "),p=angular.element("
"),q=angular.element("
"),r=angular.element("
"),s=angular.element("
").append(o(d.arData[i.table_name],0)); r.append(s),p.append(q),p.append(r),m.append(n),m.append(p),h.append(m),y(d.arData[i.table_name]),a(h.contents())(d);break;case"AhuEcam":h.append(angular.element('
').html(" ")),z(d.arData[i.table_name]);break;case"ZoneEcam":h.append(angular.element('
').html("")),A(d.arData[i.table_name]);break;case"HWPlantViz":h.append(angular.element('
').html(" ")),B(d.arData[i.table_name])}}),$(".rs-chart-container .title").click(function(){var a=$(this).parent().find(".rs-chart-area");a.toggle()}),$("#data").click(function(){$("#data").removeClass("active").addClass("active"),$("#data-content").removeClass("active").addClass("active"),$("#analysis").removeClass("active"),$("#analysis-content").removeClass("active")}),$("#analysis").click(function(){$("#analysis").removeClass("active").addClass("active"),$("#analysis-content").removeClass("active").addClass("active"),$("#data").removeClass("active"),$("#data-content").removeClass("active")})}}}]),angular.module("openeis-ui.directives.file-upload",[]).directive("fileUpload",["$parse",function(a){return{restrict:"E",template:'',compile:function(b,c){return clickFn=a(c.fileUploadClick),function(a,b,c){var d=b.find("input"),e=b.find("button");d.on("change",function(){d[0].files.length?e.prop("disabled",!1):e.prop("disabled",!0)}),e.on("click",function(b){e.prop("disabled",!0),a.$apply(function(){clickFn(a,{$event:b,files:d[0].files})["finally"](function(){d.val("").triggerHandler("change")})})})}}}}]),angular.module("openeis-ui.directives.sensor-container",["RecursionHelper","openeis-ui.components.modals","openeis-ui.filters","openeis-ui.services.data-maps"]).directive("sensorContainer",["RecursionHelper",function(a){return{restrict:"E",scope:{container:"=",files:"=",parent:"="},templateUrl:"sensor-container-directive.tpl.html",controller:["$scope","DataMaps","Modals",function(a,b,c){b.getDefinition().then(function(b){a.definition=b,a.objectDefinition=b[a.container.level],a.objectDefinition.sensor_list&&("*"===a.objectDefinition.sensor_list&&(a.objectDefinition.sensor_list=[],angular.forEach(b.sensors,function(b,c){a.objectDefinition.sensor_list.push(c)})),a.objectDefinition.sensor_list.sort()),a.objectDefinition.attribute_list&&("*"===a.objectDefinition.attribute_list&&(a.objectDefinition.attribute_list=[],angular.forEach(b.attributes,function(b,c){a.objectDefinition.attribute_list.push(c)})),!a.parent.hasOwnProperty("version")&&a.objectDefinition.attribute_list.indexOf("timezone")>-1&&a.objectDefinition.attribute_list.splice(a.objectDefinition.attribute_list.indexOf("timezone"),1),a.objectDefinition.attribute_list.sort())}),b.getUnits().then(function(b){a.units=b}),a.rename=function(){var b,c="Name:",d=function(a){return a.name===b};do{if(b=prompt(c),!b||b===a.container.name)return;b=b.replace("/","-"),c='Error: "'+b+'" already exists. Name:'}while(a.parent.children.some(d));a.container.name=b},a.prompt=function(b){c.openModal(b+"-"+a.container.$$hashKey)},a.cancel=function(b){a[b]={},c.closeModal(b+"-"+a.container.$$hashKey)},a.newAttribute={},a.showAttribute=function(b){return!(a.container.attributes&&a.container.attributes[b])},a.addAttribute=function(){a.container.attributes=a.container.attributes||{},a.container.attributes[a.newAttribute.name]=a.newAttribute.value,a.cancel("newAttribute")},a.deleteAttribute=function(b){delete a.container.attributes[b],Object.keys(a.container.attributes).length||delete a.container.attributes},a.newSensor={},a.$watchCollection("newSensor",function(){a.newSensor.file&&a.newSensor.file.columns[a.newSensor.column]||(a.newSensor.column=""),a.newSensor.name&&a.units[a.definition.sensors[a.newSensor.name].unit_type]&&a.units[a.definition.sensors[a.newSensor.name].unit_type][a.newSensor.unit]||delete a.newSensor.unit}),a.showSensor=function(b){var c=!1;return angular.forEach(a.container.sensors,function(a){c||a.type!==b||(c=!0)}),!c},a.addSensor=function(){a.newSensor.type=a.newSensor.name,a.container.sensors=a.container.sensors||[],a.container.sensors.unshift(angular.copy(a.newSensor)),a.cancel("newSensor")},a.deleteSensor=function(b){a.container.sensors.splice(b,1)},a.addChild=function(b){var c,d="Name:",e=function(a){return a.name===c};a.container.children=a.container.children||[];do{if(c=prompt(d),!c)return;c=c.replace("/","-"),d="Error: "+a.container.name+'already has child "'+c+'". Name:'}while(a.container.children.some(e));a.container.children.unshift({level:b,name:c})}}],compile:function(b){return a.compile(b)}}}]),angular.module("openeis-ui.filters",[]).filter("bytes",function(){return function(a,b){if(isNaN(parseFloat(a))||!isFinite(a))return"--";"undefined"==typeof b&&(b=0);var c=["B","KB","MB","GB","TB","PB"],d=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(d))).toFixed(b)+" "+c[d]}}).filter("capitalize",function(){return function(a,b){return a?a.substring(0,1).toUpperCase()+a.substring(1):""}}).filter("hasSignature",function(){return function(a,b){var c=[];return angular.forEach(a,function(a){angular.equals(b,a.signature)&&c.push(a)}),c}}).filter("hasTimestamp",function(){return function(a){var b=[];return angular.forEach(a,function(a){a.timestamp&&b.push(a)}),b}}).filter("nl2br",function(){return function(a){return angular.isString(a)?a.replace(/\n/g,"
"):a}}),angular.module("openeis-ui.services.analyses",["ngResource"]).service("Analyses",["$resource","$q",function(a,b){var c=this,d=a(settings.API_URL+"analyses/:analysisId",{analysisId:"@id"},{create:{method:"POST"},save:{method:"PUT"}}),e=a(settings.API_URL+"analyses/:analysisId/data");c.get=function(a){return d.get({analysisId:a})},c.query=function(a){return d.query({project:a})},c.create=function(a){return d.create(a)},c.getData=function(a){return e.get({analysisId:a}).$promise.then(function(c){return outputData={},dataPromises=[],angular.forEach(c,function(b,c){"$promise"!==c&&"$resolved"!==c&&dataPromises.push(e.query({analysisId:a,output:c}).$promise.then(function(a){outputData[c]=a}))}),b.all(dataPromises).then(function(){return outputData})})}}]),angular.module("openeis-ui.services.applications",["ngResource"]).service("Applications",["$resource",function(a){var b=this,c=a(settings.API_URL+"applications");b.query=function(){return c.query()}}]),angular.module("openeis-ui.services.auth",["ngResource","ngRoute"]).provider("authRoute",["$routeProvider",function(a){this.whenAnon=function(b,c){return c.resolve=c.resolve||{},angular.extend(c.resolve,{anon:["authRoute",function(a){return a.requireAnon()}]}),a.when(b,c),this},this.whenAuth=function(b,c){return c.resolve=c.resolve||{},angular.extend(c.resolve,{auth:["authRoute",function(a){return a.requireAuth()}]}),a.when(b,c),this},this.when=function(b,c){return a.when(b,c),this},this.$get=["Auth","$q","$location",function(a,b,c){return{requireAnon:function(){var d=b.defer();return a.account().then(function(a){a?(c.url(settings.AUTH_HOME),d.reject()):d.resolve()}),d.promise},requireAuth:function(){var d=b.defer();return a.account().then(function(b){b?d.resolve():(a.loginRedirect(c.url()),c.url(settings.LOGIN_PAGE),d.reject())}),d.promise}}}]}]).service("Auth",["$resource","$q","$location","$rootScope",function(a,b,c,d){function e(){var a=b.defer();return h.get().$promise.then(function(a){g=a},function(){g=!1})["finally"](function(){d.$broadcast("accountChange"),a.resolve(g)}),a.promise}var f=this,g=null,h=a(settings.API_URL+"account",null,{create:{method:"POST"},update:{method:"PATCH"}}),i=a(settings.API_URL+"account/login"),j=a(settings.API_URL+"account/change_password"),k=a(settings.API_URL+"account/password_reset",null,{put:{method:"PUT"}}),l=null;f.account=function(){if(null===g)return e();var a=b.defer();return a.resolve(g),a.promise},f.accountCreate=function(a){return h.create(a).$promise},f.accountUpdate=function(a){return h.update(a).$promise},f.accountPassword=function(a){return j.save(a).$promise},f.accountRecover1=function(a){return k.save({username_or_email:a}).$promise},f.accountRecover2=function(a){return k.put(a).$promise},f.logIn=function(a){var d=b.defer();return i.save(a,function(){e().then(function(){null!==l?(c.url(l),l=null):c.url(settings.AUTH_HOME),d.resolve()})},function(a){d.reject(a)}),d.promise},f.loginRedirect=function(a){l=a},f.logOut=function(){var a=b.defer();return i["delete"](function(){g=!1,d.$broadcast("accountChange"),c.url(settings.LOGIN_PAGE),a.resolve()},function(b){a.reject(b)}),a.promise}}]),angular.module("openeis-ui.services.data-files",["ngResource"]).service("DataFiles",["$resource","$http",function(a,b){var c=this,d=a(settings.API_URL+"files/:fileId",{fileId:"@id"},{head:{method:"GET",url:settings.API_URL+"files/:fileId/head"},save:{method:"PUT"},update:{method:"PATCH"}});c.get=function(a){return d.get({fileId:a}).$promise},c.query=function(a){return d.query({project:a}).$promise},c.update=function(a){return d.update(a).$promise},c.head=function(a){return d.head({fileId:a,rows:5}).$promise},c.timestamps=function(a,c,d,e){return b.get(settings.API_URL+"files/"+a+"/timestamps",{transformResponse:angular.fromJson,params:{time_offset:c,time_zone:d,columns:e}}).then(function(a){return a.data})}}]),angular.module("openeis-ui.services.data-maps",["ngResource","openeis-ui.services.data-files"]).service("DataMaps",["$http","$q","$resource","DataFiles",function(a,b,c,d){var e=this,f=c(settings.API_URL+"datamaps/:mapId",{mapId:"@id"},{create:{method:"POST"},save:{method:"PUT"}});e.get=function(a){return f.get({mapId:a})},e.query=function(a){return f.query({project:a})},e.create=function(a){var b=angular.copy(a);return b.map=e.flattenMap(b.map),f.create(b)},e.getDefaultMap=function(a){return{project:a,map:{version:1,children:[{level:"building",name:"New building"}]},valid:!1}},e.getDefinition=function(){return a.get(settings.GENERAL_DEFINITION_URL).then(function(a){return a.data})},e.getUnits=function(){return a.get(settings.UNITS_URL).then(function(a){return a.data})},e.flattenMap=function(a){function b(a,c){var f={};return angular.forEach(a,function(a){if(a.deleted!==!0){delete a.deleted;var g=c+a.name.replace("/","-"),h=a.sensors||{},i=a.children||{};delete a.name,delete a.sensors,delete a.children,a.file&&(a.file.hasHeader?a.column=a.file.columns[parseInt(a.column)]:a.column=parseInt(a.column),d[a.file.name]||(d[a.file.name]={key:e++ +"",signature:a.file.signature,timestamp:a.file.timestamp}),a.file=d[a.file.name].key),f[g]=a,angular.extend(f,b(h,g+settings.DATAMAP_TOPIC_SEPARATOR)),angular.extend(f,b(i,g+settings.DATAMAP_TOPIC_SEPARATOR))}}),f}var c=angular.copy(a),d={},e=0;return c.sensors=b(c.children,""),delete c.children,c.files=c.files||{},angular.forEach(d,function(a,b){c.files[a.key]=a,delete c.files[a.key].key}),c},e.unFlattenMap=function(a,b){var c=Object.getOwnPropertyNames(a.map.sensors).sort();return angular.forEach(a.map.files,function(c,d){angular.forEach(b,function(b){angular.equals(c.signature,b.signature)&&angular.equals(c.timestamp,b.timestamp)&&(a.map.files[d]=b)})}),a.map.children=[],angular.forEach(c,function(b){function c(a){a.name===g&&(f=a)}for(var d=a.map.sensors[b],e=b.split("/"),f=a.map;e.length>1;){var g=e.shift();angular.forEach(f.children,c)}d.name=e[0],d.level?(d.children=[],d.sensors=[],f.children.push(d)):d.type&&(a.map.files[d.file].name?(d.file=a.map.files[d.file],d.file.hasHeader&&(d.column=d.file.columns.indexOf(d.column))):(d.file={name:"MISSING FILE",columns:{}},d.file.columns[d.column]="MISSING COLUMN"),f.sensors.push(d))}),delete a.id,delete a.map.files,delete a.map.sensors,a.name+=" copy",a},e.validateMap=function(b){return a.get(settings.DATAMAP_SCHEMA_URL).then(function(a){return tv4.validateMultiple(e.flattenMap(b),a.data)})},e.ensureFileMetaData=function(a){var c=[];return angular.forEach(a,function(a){a.hasOwnProperty("signature")&&a.hasOwnProperty("columns")&&a.hasOwnProperty("hasHeader")||c.push(d.head(a.id).then(function(b){a.signature={headers:[]},a.columns=[],a.hasHeader=b.has_header,angular.forEach(b.rows[0],function(b,c){a.hasHeader?(a.signature.headers.push(b),a.columns.push(b)):(a.signature.headers.push(null),a.columns.push("Column "+(c+1)))})}))}),b.all(c)}}]),angular.module("openeis-ui.services.data-set-filters",["ngResource"]).service("DataSetFilters",["$resource",function(a){var b=this,c=a(settings.API_URL+"filters");b.query=function(){return c.query()}}]),angular.module("openeis-ui.services.data-sets",["ngResource"]).service("DataSets",["$resource","$http",function(a,b){var c=this,d=a(settings.API_URL+"datasets/:dataSetId",{dataSetId:"@id"},{create:{method:"POST"},save:{method:"PUT"},preview:{method:"POST",url:settings.API_URL+"datasets/preview"},head:{url:settings.API_URL+"datasets/:dataSetId/head"}});c.create=function(a){return d.create(a)},c.get=function(a){return d.get({dataSetId:a})},c.query=function(a){return d.query({project:a})},c.manipulate=function(a,c){return b({method:"POST",url:settings.API_URL+"datasets/"+a.id+"/manipulate",data:{config:c},transformResponse:angular.fromJson})},c.preview=function(a,b){return d.preview({map:a,files:b,rows:10})},c.head=function(a){return d.head({dataSetId:a,rows:10})},c.getStatus=function(a){return b({method:"GET",url:settings.API_URL+"datasets/"+a.id+"/status",transformResponse:angular.fromJson})},c.getErrors=function(a){return b({method:"GET",url:settings.API_URL+"datasets/"+a.id+"/errors",transformResponse:angular.fromJson})}}]),angular.module("openeis-ui.services.projects",["ngResource"]).service("Projects",["$resource",function(a){var b=this,c=a(settings.API_URL+"projects/:projectId",{projectId:"@id"},{create:{method:"POST"},save:{method:"PUT"},clone:{method:"POST",url:settings.API_URL+"projects/:projectId/clone"}});b.get=function(a){return c.get({projectId:a}).$promise},b.query=function(){return c.query().$promise},b.create=function(a){return c.create(a).$promise},b.clone=function(a,b){return c.clone({projectId:a},{name:b}).$promise}}]),angular.module("openeis-ui.services.shared-analyses",["ngResource"]).service("SharedAnalyses",["$resource","$q",function(a,b){var c=this,d=a(settings.API_URL+"shared-analyses/:analysisId",{analysisId:"@analysis"}),e=a(settings.API_URL+"shared-analyses/:analysisId/data");c.get=function(a,b){return d.get({analysisId:a,key:b})},c.query=function(a){return d.query({project:a})},c.create=function(a){return d.save({analysisId:null},{analysis:a})},c.getData=function(a,c){return e.get({analysisId:a,key:c}).$promise.then(function(d){return outputData={},dataPromises=[],angular.forEach(d,function(b,d){"$promise"!==d&&"$resolved"!==d&&dataPromises.push(e.query({analysisId:a,key:c,output:d}).$promise.then(function(a){outputData[d]=a}))}),b.all(dataPromises).then(function(){return outputData})})}}]);var settings={BASE_HREF:"/",API_URL:"/api/",LOGIN_PAGE:"/",AUTH_HOME:"/projects",GENERAL_DEFINITION_URL:"/static/projects/json/general_definition.json",DATAMAP_SCHEMA_URL:"/static/projects/json/sensormap-schema.json",UNITS_URL:"/static/projects/json/units.json",TIMEZONES_URL:"/static/projects/json/time_zones.json",DATAMAP_TOPIC_SEPARATOR:"/"};angular.module("openeis-ui").run(["$templateCache",function(a){"use strict";a.put("404.tpl.html","

404 Page not found

"),a.put("account.tpl.html",'
'),a.put("configure-timestamp.tpl.html",'

Configure timestamp: {{timestampFile.name}}

Select columns that comprise timestamp:
{{col}}
   seconds
 
RawParsed
{{row[0]}}{{row[1]}}

Are the parsed timestamps correct?

'),a.put("data-map.tpl.html",'

Data map: {{dataMap.name}}

{{dataMap.map | json}}
Back
'),a.put("data-set-manipulate.tpl.html",'

Manipulate data set: {{dataSet.name}}

Normalization settings

      
  seconds
   
      

Sensors

{{topic}}

Normalization filters
 
 
Other filters
  1. {{filter | json}} — Delete Up Down

Add filter to {{topic}}…

Cancel
Applying filters…

Add filter

{{newFilter.topic}}
'),a.put("data-set.tpl.html",'

Data set: {{dataSet.name}}

{{column}}
{{value}}
{{value}}
Back
'),a.put("login.tpl.html",'
'), a.put("new-analysis.tpl.html",'

New analysis

 
ApplicationConfigureMissing inputs
{{app.name}}

{{app.description}}

  • {{missingInput}}
Configure run of {{newAnalysis.application.name}} on data set {{newAnalysis.dataSet.name}}
{{newAnalysis.application.note}}
 
Parameters
Inputs
×
+ Add sensor
'),a.put("new-data-map.tpl.html",'

New data map

Add to data map: 
       Cancel Add at least one object and sensor to save
{{column}}
{{value}} Invalid
{{value}} Invalid
'),a.put("new-data-set.tpl.html",'

New data set

Select data map to use
Select files to use
File "{{key}}":
Signature:
{{file.signature.headers}}
Cancel
{{column}}
{{value}} Invalid
{{value}} Invalid
'),a.put("project.tpl.html",'

{{project.name}}

Data files

NameSize
{{file.name}}{{file.format | uppercase}} Needs timestamp configuration{{file.size | bytes}}
  
Uploading file…

Data maps

Data file with timestamp configuration required.

Name
{{dataMap.name}}

Data sets

Data map required.

NameStatusErrors
{{dataSet.name}} {{dataSet.name}}{{dataSet.status.status || \'Checking…\' | capitalize}}None

Errors

MessageLocation
{{error.message}}{{errorsModal.files[error.file]}}: row {{error.row}}, column {{error.column}}

Analyses

NameStatusAddedReport
{{analysis.name}} {{analysis.name}}{{analysis.status | capitalize}}{{analysis.added | date:\'medium\'}}Share Shared (revoke)

{{viewingAnalysis.name}}

Loading analysis…

{{viewingLink.url}}

'),a.put("projects.tpl.html",'

Projects

   
'),a.put("recovery.tpl.html",'

OpenEIS

Recover account


{{form.success}}
{{form.error.data}} {{form.error.data}} Unknown error occurred. ({{form.error}})
'),a.put("sensor-container-directive.tpl.html",'
{{container.level | capitalize}}: {{container.name}} deleted. (undo)

{{container.level | capitalize}}: {{container.name}}

Attributes

{{attribute}} Delete
{{value | json}}
Sensors
{{sensor.name}} Delete
{{sensor.file.name}} → {{sensor.file.columns[sensor.column]}} ({{sensor.unit}})
Add under {{container.name}}: 
'),a.put("shared-analyses.tpl.html",'

{{sharedAnalysis.name}}

Loading analysis…

Invalid shared analysis link.

'),a.put("signup.tpl.html",'
')}]); \ No newline at end of file