|
|
@@ -1,8 +1,15 @@
|
|
|
-var errorTable;
|
|
|
var lastNode;
|
|
|
-var jqxhr = $.getJSON("../assets/errorTable.json", function(json) {
|
|
|
+var errorTable;
|
|
|
+var monitors;
|
|
|
+var jqxhr = $.getJSON("../assets/errorTable.json", function (json) {
|
|
|
errorTable = json;
|
|
|
});
|
|
|
+$.ajaxSettings.async = false;
|
|
|
+var C3Json = $.getJSON("../assets/json/c3-monitorList.json", function (json) {
|
|
|
+ monitors = json;
|
|
|
+});
|
|
|
+$.ajaxSettings.async = true;
|
|
|
+
|
|
|
var errorArray = [];
|
|
|
var switchNumber = 0;
|
|
|
passString('OW');
|
|
|
@@ -34,15 +41,15 @@ function GetWellNameList(wellNameList) {
|
|
|
function displayWellInfo2() {
|
|
|
$.ajax({
|
|
|
url: '/BIM-Monitor/script/php/getWellName.php',
|
|
|
- complete: function(response) {
|
|
|
+ complete: function (response) {
|
|
|
console.log("Get well name: ");
|
|
|
console.log(response);
|
|
|
if (response.responseText != "") {
|
|
|
showWell(response.responseText, false);
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
- error: function() {
|
|
|
+ error: function () {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
@@ -78,13 +85,13 @@ function getCheckValue() {
|
|
|
dataType: "json"
|
|
|
})
|
|
|
|
|
|
- .success(function(response) {
|
|
|
+ .success(function (response) {
|
|
|
dataArray = response['wellTBA'];
|
|
|
for (var i = 0; i < dataArray.length; i++) {
|
|
|
dataArray[i] = dataArray[i].replace('_', '-');
|
|
|
}
|
|
|
var normal_count = response['normal_count'];
|
|
|
- var abnormal_count = response['abnormal_count'];
|
|
|
+ var abnormal_count = response['abnormal_count'];
|
|
|
sparklinePieData = [normal_count, abnormal_count];
|
|
|
var all = normal_count + abnormal_count;
|
|
|
var percent = abnormal_count / all;
|
|
|
@@ -97,10 +104,10 @@ function getCheckValue() {
|
|
|
|
|
|
|
|
|
})
|
|
|
- .error(function() {
|
|
|
+ .error(function () {
|
|
|
//alert("錯誤統計未正常獲取");
|
|
|
})
|
|
|
- .complete(function() {});
|
|
|
+ .complete(function () {});
|
|
|
return dataArray;
|
|
|
}
|
|
|
|
|
|
@@ -116,7 +123,7 @@ function GetCheckAllAJAXValue() {
|
|
|
var warning1 = errorTable[i].warning1;
|
|
|
var warning2 = errorTable[i].warning2;
|
|
|
var warning_Count = errorTable[i].warning_Count;
|
|
|
- $.ajax({
|
|
|
+ $.ajax({
|
|
|
url: "/BIM-Monitor/script/php/checkValue2.php",
|
|
|
data: {
|
|
|
method: method,
|
|
|
@@ -131,57 +138,57 @@ function GetCheckAllAJAXValue() {
|
|
|
dataType: "json"
|
|
|
})
|
|
|
|
|
|
- .success(function(response) {
|
|
|
+ .success(function (response) {
|
|
|
|
|
|
var normal_count = response['normal_count'];
|
|
|
var abnormal_count = response['abnormal_count'];
|
|
|
var all_count = 0 + normal_count + abnormal_count;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
document.getElementById(option).innerHTML = "(<font color='#FF0000'>" + abnormal_count + "</font>/" + all_count + ")";
|
|
|
- errorArray.push(abnormal_count);
|
|
|
+ errorArray.push(abnormal_count);
|
|
|
})
|
|
|
- .error(function() {
|
|
|
+ .error(function () {
|
|
|
alert("錯誤統計未正常獲取");
|
|
|
})
|
|
|
- .complete(function() {});
|
|
|
+ .complete(function () {});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function CheckCompare(){
|
|
|
+function CheckCompare() {
|
|
|
var option = window.localStorage.getItem("option");
|
|
|
var text = "";
|
|
|
- if(option == "ELP" || option == "OW"){
|
|
|
- if(option == "ELP"){
|
|
|
+ if (option == "ELP" || option == "OW") {
|
|
|
+ if (option == "ELP") {
|
|
|
text = "水壓計";
|
|
|
- }else if(option == "OW"){
|
|
|
+ } else if (option == "OW") {
|
|
|
text = "水位觀測井";
|
|
|
}
|
|
|
var checkBox = document.getElementById("compareCheck");
|
|
|
- if (checkBox.checked == true){
|
|
|
- document.getElementById("tableName").innerHTML = option + text + '總表';
|
|
|
+ if (checkBox.checked == true) {
|
|
|
+ document.getElementById("tableName").innerHTML = option + text + '總表';
|
|
|
isCompare = true;
|
|
|
} else {
|
|
|
document.getElementById("tableName").innerHTML = saveCheckCompare;
|
|
|
isCompare = false;
|
|
|
}
|
|
|
- if(option == "ELP")
|
|
|
- displayChart("ELP-1","myChart");
|
|
|
- else if(option == "OW")
|
|
|
- displayChart("OW-1","myChart");
|
|
|
+ if (option == "ELP")
|
|
|
+ displayChart("ELP-1", "myChart");
|
|
|
+ else if (option == "OW")
|
|
|
+ displayChart("OW-1", "myChart");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-function CheckError(){
|
|
|
- var checkBox = document.getElementById("errorCheck");
|
|
|
- if (checkBox.checked == true){
|
|
|
- isAll = false;
|
|
|
- } else {
|
|
|
- isAll = true;
|
|
|
- }
|
|
|
- SetList();
|
|
|
+function CheckError() {
|
|
|
+ var checkBox = document.getElementById("errorCheck");
|
|
|
+ if (checkBox.checked == true) {
|
|
|
+ isAll = false;
|
|
|
+ } else {
|
|
|
+ isAll = true;
|
|
|
+ }
|
|
|
+ SetList();
|
|
|
}
|
|
|
|
|
|
function uploadCSV() {
|
|
|
@@ -201,10 +208,10 @@ function uploadCSV() {
|
|
|
data: formData,
|
|
|
processData: false,
|
|
|
contentType: false,
|
|
|
- beforeSend: function() {
|
|
|
+ beforeSend: function () {
|
|
|
|
|
|
}
|
|
|
- }).done(function(data) {
|
|
|
+ }).done(function (data) {
|
|
|
console.log(data);
|
|
|
var stack_bar_top = {
|
|
|
"dir1": "down",
|
|
|
@@ -233,41 +240,41 @@ function uploadCSV() {
|
|
|
width: "100%"
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- }).error(function() {
|
|
|
+
|
|
|
+ }).error(function () {
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
//get well info from sql server
|
|
|
function showWell(str, changeCamera) {
|
|
|
- var strLocal = "";
|
|
|
+ var strLocal = "";
|
|
|
var executed = false;
|
|
|
var xhttp;
|
|
|
- isCompare = false;
|
|
|
- document.getElementById("compareCheck").checked = false;
|
|
|
+ isCompare = false;
|
|
|
+ document.getElementById("compareCheck").checked = false;
|
|
|
if (str == "") {
|
|
|
document.getElementById("dataTable").innerHTML = "";
|
|
|
return;
|
|
|
}
|
|
|
- strLocal = str;
|
|
|
- /*if(str.includes("ELP")){
|
|
|
- if(str.includes("A")){
|
|
|
- strLocal = str + ',' + str.replace('A','-1A');
|
|
|
- }else{
|
|
|
- strLocal = str + ',' + str + '-1';
|
|
|
- }
|
|
|
- } */
|
|
|
- document.getElementById("monitorSelect2").innerHTML = strLocal;
|
|
|
+ strLocal = str;
|
|
|
+ /*if(str.includes("ELP")){
|
|
|
+ if(str.includes("A")){
|
|
|
+ strLocal = str + ',' + str.replace('A','-1A');
|
|
|
+ }else{
|
|
|
+ strLocal = str + ',' + str + '-1';
|
|
|
+ }
|
|
|
+ } */
|
|
|
+ document.getElementById("monitorSelect2").innerHTML = strLocal;
|
|
|
xhttp = new XMLHttpRequest();
|
|
|
- xhttp.onreadystatechange = function() {
|
|
|
+ xhttp.onreadystatechange = function () {
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
if (str.includes("HM") && !str.includes("HM-"))
|
|
|
str = str.replace("HM", "HM-");
|
|
|
|
|
|
|
|
|
document.getElementById("tableName").innerHTML = strLocal + "資料表";
|
|
|
- saveCheckCompare = strLocal + "資料表";
|
|
|
+ saveCheckCompare = strLocal + "資料表";
|
|
|
displayChart(str, "myChart");
|
|
|
|
|
|
reset();
|
|
|
@@ -301,7 +308,7 @@ function displayChart(str, elementID) {
|
|
|
var xhttp;
|
|
|
xhttp = new XMLHttpRequest();
|
|
|
|
|
|
- xhttp.onreadystatechange = function() {
|
|
|
+ xhttp.onreadystatechange = function () {
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
if (str.includes("ELP") || str.includes("OW") || str.includes("SM") || str.includes("SB") || str.includes("SBM") || str.includes("VG") || str.includes("HM")) {
|
|
|
//Split the response text into well name array, date array and value array
|
|
|
@@ -311,12 +318,12 @@ function displayChart(str, elementID) {
|
|
|
var c_m_value = v_variables[2].split(" ");
|
|
|
//console.log(c_m_value);
|
|
|
//Start to make the chart
|
|
|
- if(isCompare){
|
|
|
+ if (isCompare) {
|
|
|
displayCompareChart();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
init(c_wellName, c_m_date, c_m_value, elementID);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
} else if (str.includes("TI")) {
|
|
|
var v_variables = this.responseText.split("*");
|
|
|
@@ -327,13 +334,13 @@ function displayChart(str, elementID) {
|
|
|
var c2_wellName = v_variables[3];
|
|
|
var c2_m_date = v_variables[4].split(" ");
|
|
|
var c2_m_value = v_variables[5].split(" ");
|
|
|
- if(isCompare){
|
|
|
- displayCompareChart();
|
|
|
- }else{
|
|
|
- init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_value, elementID);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ if (isCompare) {
|
|
|
+ displayCompareChart();
|
|
|
+ } else {
|
|
|
+ init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_value, elementID);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else if (str.includes("SIS") || str.includes("SID")) {
|
|
|
var v_variables = this.responseText.split("*");
|
|
|
var c_m_date = v_variables[0].split(" ");
|
|
|
@@ -388,42 +395,42 @@ function displayChart(str, elementID) {
|
|
|
}
|
|
|
|
|
|
function displayCompareChart() {
|
|
|
- console.log("displayCompareChart");
|
|
|
- var option = window.localStorage.getItem("option");
|
|
|
- var m_date = [];
|
|
|
- var label = [];
|
|
|
- var index = 7;
|
|
|
- if(option == "ELP")
|
|
|
- index = 14;
|
|
|
- var chart_data=new Array();
|
|
|
- for(var i=0;i<index;i++){
|
|
|
- chart_data[i]=new Array();
|
|
|
- for(var j=0;j<m_date.length;j++){
|
|
|
- chart_data[i][j]=0;
|
|
|
- }
|
|
|
- }
|
|
|
- $.ajax({
|
|
|
- url: "/BIM-Monitor/script/php/getCompareChartData.php",
|
|
|
+ console.log("displayCompareChart");
|
|
|
+ var option = window.localStorage.getItem("option");
|
|
|
+ var m_date = [];
|
|
|
+ var label = [];
|
|
|
+ var index = 7;
|
|
|
+ if (option == "ELP")
|
|
|
+ index = 14;
|
|
|
+ var chart_data = new Array();
|
|
|
+ for (var i = 0; i < index; i++) {
|
|
|
+ chart_data[i] = new Array();
|
|
|
+ for (var j = 0; j < m_date.length; j++) {
|
|
|
+ chart_data[i][j] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.ajax({
|
|
|
+ url: "/BIM-Monitor/script/php/getCompareChartData.php",
|
|
|
async: false,
|
|
|
contentType: "application/json",
|
|
|
dataType: "json",
|
|
|
- data: {
|
|
|
- option : option
|
|
|
- }
|
|
|
+ data: {
|
|
|
+ option: option
|
|
|
+ }
|
|
|
})
|
|
|
|
|
|
- .success(function(response) {
|
|
|
+ .success(function (response) {
|
|
|
m_date = response['m_date'];
|
|
|
- chart_data = response['chart_data'];
|
|
|
- label = response['label'];
|
|
|
- initCompare(m_date,chart_data,index,label);
|
|
|
- console.log("getCompareChartData正常獲取");
|
|
|
+ chart_data = response['chart_data'];
|
|
|
+ label = response['label'];
|
|
|
+ initCompare(m_date, chart_data, index, label);
|
|
|
+ console.log("getCompareChartData正常獲取");
|
|
|
})
|
|
|
- .error(function() {
|
|
|
+ .error(function () {
|
|
|
console.log("getCompareChartData未正常獲取");
|
|
|
})
|
|
|
- .complete(function() {});
|
|
|
-
|
|
|
+ .complete(function () {});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//Reset the camera
|
|
|
@@ -431,30 +438,28 @@ function ResetCamera() {
|
|
|
myGameInstance.SendMessage("MainCamera", "ResetCamera");
|
|
|
}
|
|
|
|
|
|
-function switchMonitor(option) {
|
|
|
- isAll = true;
|
|
|
- isCompare = false;
|
|
|
+$(".monitor").on('click', function(){
|
|
|
+ let option = $(this).attr("monitor");
|
|
|
+ isAll = true;
|
|
|
+ isCompare = false;
|
|
|
passString(option);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
document.getElementById("monitorName").innerHTML = option + "監測儀器";
|
|
|
if (lastNode != null) {
|
|
|
lastNode.style = "color:#abb4be;";
|
|
|
}
|
|
|
- document.getElementById("errorCheck").checked = false;
|
|
|
- document.getElementById("compareCheck").checked = false;
|
|
|
-
|
|
|
+ document.getElementById("errorCheck").checked = false;
|
|
|
+ document.getElementById("compareCheck").checked = false;
|
|
|
+
|
|
|
lastNode = document.getElementById(option).parentNode;
|
|
|
lastNode.style = "color:#0088cc;";
|
|
|
|
|
|
LoadPage();
|
|
|
-}
|
|
|
+});
|
|
|
|
|
|
-function SetList(){
|
|
|
- var wellNameListsLocal = "";
|
|
|
- var isError = false;
|
|
|
- var monitorSelect = document.getElementById("monitorSelect");
|
|
|
+function SetList() {
|
|
|
+ var wellNameListsLocal = "";
|
|
|
+ var isError = false;
|
|
|
+ var monitorSelect = document.getElementById("monitorSelect");
|
|
|
var monitorButton = document.getElementById("monitorButton");
|
|
|
while (monitorSelect.hasChildNodes()) {
|
|
|
monitorSelect.removeChild(monitorSelect.firstChild);
|
|
|
@@ -463,19 +468,19 @@ function SetList(){
|
|
|
while (monitorButton.hasChildNodes()) {
|
|
|
monitorButton.removeChild(monitorButton.firstChild);
|
|
|
}
|
|
|
- monitorButton.innerHTML = "綠色為正常|紅色為異常<br>";
|
|
|
+ monitorButton.innerHTML = "綠色為正常|紅色為異常<br>";
|
|
|
GetCheckAllAJAXValue();
|
|
|
for (i = 0; i < wellNameLists.length; i++) {
|
|
|
- wellNameListsLocal = wellNameLists[i];
|
|
|
+ wellNameListsLocal = wellNameLists[i];
|
|
|
var option = document.createElement("li");
|
|
|
var createA = document.createElement("a");
|
|
|
- /*if(wellNameLists[i].includes("ELP")){
|
|
|
- if(wellNameLists[i].includes("A")){
|
|
|
- wellNameListsLocal = wellNameLists[i] + ',' + wellNameLists[i].replace('A','-1A');
|
|
|
- }else{
|
|
|
- wellNameListsLocal = wellNameLists[i] + ',' + wellNameLists[i] + '-1';
|
|
|
- }
|
|
|
- } */
|
|
|
+ /*if(wellNameLists[i].includes("ELP")){
|
|
|
+ if(wellNameLists[i].includes("A")){
|
|
|
+ wellNameListsLocal = wellNameLists[i] + ',' + wellNameLists[i].replace('A','-1A');
|
|
|
+ }else{
|
|
|
+ wellNameListsLocal = wellNameLists[i] + ',' + wellNameLists[i] + '-1';
|
|
|
+ }
|
|
|
+ } */
|
|
|
var createAText = document.createTextNode(wellNameListsLocal);
|
|
|
var createButton = document.createElement("button");
|
|
|
var createButtonText = document.createTextNode(wellNameListsLocal);
|
|
|
@@ -484,51 +489,53 @@ function SetList(){
|
|
|
|
|
|
|
|
|
for (j = 0; j < wellTBA.length; j++) {
|
|
|
-
|
|
|
+
|
|
|
if (wellNameLists[i] == (wellTBA[j])) {
|
|
|
createA.style = "color:red;";
|
|
|
createButton.setAttribute('class', "mb-xs mt-xs mr-xs btn btn-danger modal-dismiss");
|
|
|
- isError = true;
|
|
|
-
|
|
|
- //console.log(" wellNameLists:" + wellNameLists[i]);
|
|
|
- //console.log(" wellTBA:" + wellTBA[j]);
|
|
|
-
|
|
|
- }
|
|
|
+ isError = true;
|
|
|
+
|
|
|
+ //console.log(" wellNameLists:" + wellNameLists[i]);
|
|
|
+ //console.log(" wellTBA:" + wellTBA[j]);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
createA.setAttribute('onclick', "showWell('" + wellNameLists[i] + "',true)");
|
|
|
createButton.setAttribute('onclick', "showWell('" + wellNameLists[i] + "',true)");
|
|
|
createButton.setAttribute('type', "button");
|
|
|
-
|
|
|
- if(isAll || (!isAll && isError)){
|
|
|
- //console.log(isError);
|
|
|
- createA.appendChild(createAText);
|
|
|
- createButton.appendChild(createButtonText);
|
|
|
- option.appendChild(createA);
|
|
|
- monitorSelect.appendChild(option);
|
|
|
- monitorButton.appendChild(createButton);
|
|
|
- }
|
|
|
+
|
|
|
+ if (isAll || (!isAll && isError)) {
|
|
|
+ //console.log(isError);
|
|
|
+ createA.appendChild(createAText);
|
|
|
+ createButton.appendChild(createButtonText);
|
|
|
+ option.appendChild(createA);
|
|
|
+ monitorSelect.appendChild(option);
|
|
|
+ monitorButton.appendChild(createButton);
|
|
|
+ }
|
|
|
isError = false;
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-function UpdateGPS(GPS){
|
|
|
- myGameInstance.SendMessage("PlayerArmature", "UpdateGPS",GPS);
|
|
|
+
|
|
|
+function UpdateGPS(GPS) {
|
|
|
+ myGameInstance.SendMessage("PlayerArmature", "UpdateGPS", GPS);
|
|
|
}
|
|
|
+
|
|
|
function LoadPage() {
|
|
|
var option = window.localStorage.getItem("option");
|
|
|
//Display the selected equipment
|
|
|
|
|
|
$('#' + window.localStorage.getItem("option")).removeClass('hidden').removeAttr('disabled');
|
|
|
//console.log("Choosed option: " + window.localStorage.getItem("option"));
|
|
|
-
|
|
|
- document.getElementById("monitorSelect2").innerHTML = "選擇觀測儀器";
|
|
|
-
|
|
|
- if(option == "ELP" || option == "OW")
|
|
|
- document.getElementById("displayCompareChart").style.display = 'block';
|
|
|
- else
|
|
|
- document.getElementById("displayCompareChart").style.display = 'none';
|
|
|
-
|
|
|
+
|
|
|
+ document.getElementById("monitorSelect2").innerHTML = "選擇觀測儀器";
|
|
|
+
|
|
|
+ if (option == "ELP" || option == "OW")
|
|
|
+ document.getElementById("displayCompareChart").style.display = 'block';
|
|
|
+ else
|
|
|
+ document.getElementById("displayCompareChart").style.display = 'none';
|
|
|
+
|
|
|
if (option == "HM" || option == "SIS" || option == "RS" || option == "VG" || option == "SID") {
|
|
|
myGameInstance.SendMessage("Monitor", "ChangeTransparent");
|
|
|
myGameInstance.SendMessage("Monitor", "RemoveModel", "true");
|
|
|
@@ -537,9 +544,9 @@ function LoadPage() {
|
|
|
myGameInstance.SendMessage("Monitor", "RemoveModel", "false");
|
|
|
}
|
|
|
|
|
|
- if(option != "ELP" && option != "SIS" && option != "SID"){
|
|
|
+ if (option != "ELP" && option != "SIS" && option != "SID") {
|
|
|
document.getElementById("phase").style.display = "none";
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
document.getElementById("phase").style.display = "block";
|
|
|
}
|
|
|
|
|
|
@@ -570,11 +577,11 @@ function LoadPage() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- wellNameLists = wellNameListsLocal;
|
|
|
- wellTBA = wellTBALocal;
|
|
|
+ wellNameLists = wellNameListsLocal;
|
|
|
+ wellTBA = wellTBALocal;
|
|
|
|
|
|
SetList();
|
|
|
-
|
|
|
+
|
|
|
ResetCamera();
|
|
|
showWell(wellNameLists[0], false);
|
|
|
}
|
|
|
@@ -631,13 +638,21 @@ var errorChart = null;
|
|
|
function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
|
|
|
var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
- var phase = document.getElementById("phase").value;
|
|
|
+ var phase = document.getElementById("phase").value;
|
|
|
var ELPwarning = [0, -4.6, -10, -15.3, -23.2, 0];
|
|
|
var ELP_1warning = [0, -7.9, -13.3, 0, 0, 0];
|
|
|
-
|
|
|
+
|
|
|
//Warning value
|
|
|
let warning = [];
|
|
|
- var OWFirstData = {"OW-1": -1.81, "OW-2": -1.59, "OW-3": -6.3, "OW-4": -3.67, "OW-5": -3.16, "OW-6": -1.78, "OW-7": -3.31};
|
|
|
+ var OWFirstData = {
|
|
|
+ "OW-1": -1.81,
|
|
|
+ "OW-2": -1.59,
|
|
|
+ "OW-3": -6.3,
|
|
|
+ "OW-4": -3.67,
|
|
|
+ "OW-5": -3.16,
|
|
|
+ "OW-6": -1.78,
|
|
|
+ "OW-7": -3.31
|
|
|
+ };
|
|
|
var OWwarning1 = 0;
|
|
|
var OWwarning2 = 0;
|
|
|
|
|
|
@@ -645,28 +660,28 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
var xLabel = "";
|
|
|
|
|
|
if (c_wellName.includes("ELP")) {
|
|
|
- if(c_wellName != "ELP-1" && c_wellName.includes("-1")){
|
|
|
- if(ELP_1warning[phase-2] != 0){
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
- warning.push(ELP_1warning[phase-2]);
|
|
|
- }
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(ELPwarning[phase-2] != 0){
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
- warning.push(ELPwarning[phase-2]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ if (c_wellName != "ELP-1" && c_wellName.includes("-1")) {
|
|
|
+ if (ELP_1warning[phase - 2] != 0) {
|
|
|
+ for (i = 0; i < c_m_date.length; i++) {
|
|
|
+ warning.push(ELP_1warning[phase - 2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (ELPwarning[phase - 2] != 0) {
|
|
|
+ for (i = 0; i < c_m_date.length; i++) {
|
|
|
+ warning.push(ELPwarning[phase - 2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
yLabel = "水位高程GL(m)";
|
|
|
xLabel = "日期";
|
|
|
|
|
|
} else if (c_wellName.includes("OW")) {
|
|
|
|
|
|
- for(const [key, value] of Object.entries(OWFirstData)){
|
|
|
- if(c_wellName == key){
|
|
|
+ for (const [key, value] of Object.entries(OWFirstData)) {
|
|
|
+ if (c_wellName == key) {
|
|
|
OWwarning1 = value + 2;
|
|
|
OWwarning2 = value - 2;
|
|
|
}
|
|
|
@@ -751,7 +766,7 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
label: "警戒值",
|
|
|
data: warning,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
@@ -759,20 +774,20 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
spanGaps: true,
|
|
|
maintainAspectRatio: false,
|
|
|
responsive: true,
|
|
|
- scales: {
|
|
|
- y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
+ scales: {
|
|
|
+ y: {
|
|
|
+ title: {
|
|
|
+ display: true,
|
|
|
+ text: yLabel
|
|
|
+ }
|
|
|
+ },
|
|
|
x: {
|
|
|
title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
+ display: true,
|
|
|
+ text: xLabel
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -788,8 +803,8 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
label: "警戒值2",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
-
|
|
|
+ pointRadius: 0
|
|
|
+
|
|
|
});
|
|
|
|
|
|
window.chart.update();
|
|
|
@@ -805,7 +820,7 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
label: "警戒值2",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
});
|
|
|
|
|
|
window.chart.update();
|
|
|
@@ -821,7 +836,7 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
label: "警戒值2",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
});
|
|
|
|
|
|
window.chart.update();
|
|
|
@@ -835,7 +850,7 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
var yLabel = "";
|
|
|
var xLabel = "";
|
|
|
-
|
|
|
+
|
|
|
|
|
|
let warning = [];
|
|
|
if (c_wellName.includes("TI")) {
|
|
|
@@ -859,9 +874,9 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
if (window.chart != undefined) {
|
|
|
window.chart.destroy();
|
|
|
}
|
|
|
- c_m_value.forEach(function(item, index, array) {
|
|
|
- //console.log(item, index);
|
|
|
- });
|
|
|
+ c_m_value.forEach(function (item, index, array) {
|
|
|
+ //console.log(item, index);
|
|
|
+ });
|
|
|
window.chart = new Chart(ctx, {
|
|
|
type: 'line',
|
|
|
data: {
|
|
|
@@ -880,21 +895,21 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
},
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
- maintainAspectRatio: false,
|
|
|
- scales: {
|
|
|
- y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
+ maintainAspectRatio: false,
|
|
|
+ scales: {
|
|
|
+ y: {
|
|
|
+ title: {
|
|
|
+ display: true,
|
|
|
+ text: yLabel
|
|
|
+ }
|
|
|
+ },
|
|
|
x: {
|
|
|
title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
+ display: true,
|
|
|
+ text: xLabel
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -938,7 +953,7 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
label: "警戒值2",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
});
|
|
|
|
|
|
window.chart.update();
|
|
|
@@ -949,42 +964,42 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
|
|
|
//SIS SID's lines are vertical
|
|
|
function initSISSID(c_m_date, c_m_depth, c_m_value, elementID, str) {
|
|
|
-
|
|
|
+
|
|
|
var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
var datasetValue = [];
|
|
|
let warning = [];
|
|
|
var phase = document.getElementById("phase").value;
|
|
|
var SID_data = [];
|
|
|
var SIS_data = [];
|
|
|
- var SIS_array = ['SIS-1','SIS-2-1','SIS-2-2','SIS-3','SIS-4','SIS-6','SIS-7'];
|
|
|
- var SID_array = ['SID-1','SID-2-1','SID-2-2','SID-3-1','SID-3-2','SID-4','SID-5-1','SID-5-2','SID-6','SID-7'];
|
|
|
+ var SIS_array = ['SIS-1', 'SIS-2-1', 'SIS-2-2', 'SIS-3', 'SIS-4', 'SIS-6', 'SIS-7'];
|
|
|
+ var SID_array = ['SID-1', 'SID-2-1', 'SID-2-2', 'SID-3-1', 'SID-3-2', 'SID-4', 'SID-5-1', 'SID-5-2', 'SID-6', 'SID-7'];
|
|
|
var index = 0;
|
|
|
var num = 0;
|
|
|
|
|
|
- if(phase == 2){
|
|
|
+ if (phase == 2) {
|
|
|
SID_data = [1.85, 1.128, 1.128, 1.128, 1.698, 1.698, 1.698, 1.186, 1.186, 1.032];
|
|
|
SIS_data = [1.85, 1.128, 1.128, 1.128, 1.698, 1.186, 1.032];
|
|
|
- }else if(phase == 3){
|
|
|
+ } else if (phase == 3) {
|
|
|
SID_data = [2.39, 1.434, 1.434, 1.434, 2.304, 2.304, 2.304, 1.7, 1.7, 1.569];
|
|
|
SIS_data = [2.39, 1.434, 1.434, 1.434, 2.304, 1.7, 1.569];
|
|
|
- }else if(phase == 4){
|
|
|
+ } else if (phase == 4) {
|
|
|
SID_data = [2.89, 1.856, 1.856, 1.856, 2.968, 2.968, 2.968, 2.267, 2.267, 2.176];
|
|
|
SIS_data = [2.89, 1.856, 1.856, 1.856, 2.968, 2.267, 2.176];
|
|
|
- }else if(phase == 5){
|
|
|
+ } else if (phase == 5) {
|
|
|
SID_data = [3.36, 2.626, 2.626, 2.626, 4.531, 4.531, 4.531, 3.727, 3.727, 3.285];
|
|
|
SIS_data = [3.36, 2.626, 2.626, 2.626, 4.531, 3.727, 3.285];
|
|
|
- }else if(phase == 6){
|
|
|
+ } else if (phase == 6) {
|
|
|
SID_data = [4.015, 3.832, 3.832, 3.832, 7.966, 7.966, 7.966, 5.049, 5.049, 5.208];
|
|
|
SIS_data = [4.015, 3.832, 3.832, 3.832, 7.966, 5.049, 5.208];
|
|
|
- }else if(phase == 7){
|
|
|
+ } else if (phase == 7) {
|
|
|
SID_data = [4.918, 4.458, 4.458, 4.458, 8.909, 8.909, 8.909, 5.797, 5.797, 5.988];
|
|
|
SIS_data = [4.918, 4.458, 4.458, 4.458, 8.909, 5.797, 5.988];
|
|
|
}
|
|
|
|
|
|
- if(str.includes("SIS")){
|
|
|
+ if (str.includes("SIS")) {
|
|
|
index = SIS_array.indexOf(str);
|
|
|
num = SIS_data[index];
|
|
|
- }else if(str.includes("SID")){
|
|
|
+ } else if (str.includes("SID")) {
|
|
|
index = SID_array.indexOf(str);
|
|
|
num = SID_data[index];
|
|
|
}
|
|
|
@@ -1015,7 +1030,7 @@ function initSISSID(c_m_date, c_m_depth, c_m_value, elementID, str) {
|
|
|
label: "警戒值",
|
|
|
data: warning,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
}
|
|
|
} else {
|
|
|
datasetValue[j] = {
|
|
|
@@ -1041,17 +1056,17 @@ function initSISSID(c_m_date, c_m_depth, c_m_value, elementID, str) {
|
|
|
indexAxis: 'y',
|
|
|
scales: {
|
|
|
y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
+ title: {
|
|
|
+ display: true,
|
|
|
+ text: yLabel
|
|
|
+ }
|
|
|
+ },
|
|
|
x: {
|
|
|
beginAtZero: true,
|
|
|
title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
+ display: true,
|
|
|
+ text: xLabel
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1115,27 +1130,27 @@ function init6(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_value, c3_well
|
|
|
label: "警戒值",
|
|
|
data: warning,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
- maintainAspectRatio: false,
|
|
|
- scales: {
|
|
|
- y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
+ maintainAspectRatio: false,
|
|
|
+ scales: {
|
|
|
+ y: {
|
|
|
+ title: {
|
|
|
+ display: true,
|
|
|
+ text: yLabel
|
|
|
+ }
|
|
|
+ },
|
|
|
x: {
|
|
|
title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
+ display: true,
|
|
|
+ text: xLabel
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -1152,30 +1167,30 @@ function init6(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_value, c3_well
|
|
|
label: "警戒值2",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
+ pointRadius: 0
|
|
|
});
|
|
|
|
|
|
window.chart.update();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function initCompare(m_date, chart_data,index,label) {
|
|
|
+function initCompare(m_date, chart_data, index, label) {
|
|
|
var ctx = document.getElementById("myChart").getContext("2d");
|
|
|
- var value = -7.9;
|
|
|
+ var value = -7.9;
|
|
|
let warning = [];
|
|
|
var phase = document.getElementById("phase").value;
|
|
|
|
|
|
|
|
|
yLabel = "水位高程GL(m)";
|
|
|
- xLabel = "日期";
|
|
|
-
|
|
|
- for (i = 0; i < m_date.length; i++) {
|
|
|
+ xLabel = "日期";
|
|
|
+
|
|
|
+ for (i = 0; i < m_date.length; i++) {
|
|
|
warning.push(value);
|
|
|
}
|
|
|
|
|
|
if (window.chart != undefined) {
|
|
|
window.chart.destroy();
|
|
|
- }
|
|
|
+ }
|
|
|
window.chart = new Chart(ctx, {
|
|
|
type: 'line',
|
|
|
data: {
|
|
|
@@ -1183,57 +1198,58 @@ function initCompare(m_date, chart_data,index,label) {
|
|
|
},
|
|
|
options: {
|
|
|
responsive: true,
|
|
|
- maintainAspectRatio: false,
|
|
|
- scales: {
|
|
|
- y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
+ maintainAspectRatio: false,
|
|
|
+ scales: {
|
|
|
+ y: {
|
|
|
+ title: {
|
|
|
+ display: true,
|
|
|
+ text: yLabel
|
|
|
+ }
|
|
|
+ },
|
|
|
x: {
|
|
|
title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
+ display: true,
|
|
|
+ text: xLabel
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- for(i = 1; i < index+1; i++){
|
|
|
- window.chart.data.datasets.push({
|
|
|
- label: label[i].replaceAll("_","-"),
|
|
|
+ for (i = 1; i < index + 1; i++) {
|
|
|
+ window.chart.data.datasets.push({
|
|
|
+ label: label[i].replaceAll("_", "-"),
|
|
|
data: chart_data[i],
|
|
|
borderColor: randomColorBlue()
|
|
|
});
|
|
|
- }
|
|
|
-/*
|
|
|
- if(label[1].includes("ELP") && phase != 2 && phase != 7){
|
|
|
- window.chart.data.datasets.push({
|
|
|
- label: "警戒值",
|
|
|
- data: warning,
|
|
|
- borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
- });
|
|
|
- }
|
|
|
-*/
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ if(label[1].includes("ELP") && phase != 2 && phase != 7){
|
|
|
+ window.chart.data.datasets.push({
|
|
|
+ label: "警戒值",
|
|
|
+ data: warning,
|
|
|
+ borderColor: "#FF0000",
|
|
|
+ pointRadius: 0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ */
|
|
|
window.chart.update();
|
|
|
|
|
|
}
|
|
|
|
|
|
//Chart has multiple lines that need different color
|
|
|
-function randomColor() {
|
|
|
+function randomColor() {
|
|
|
return "#" + ((1 << 24) * Math.random() | 0).toString(16);
|
|
|
}
|
|
|
+
|
|
|
function randomColorBlue() {
|
|
|
- var mid = Math.floor(Math.random() * 255);
|
|
|
- return "#30" +mid.toString(16) + "ff";
|
|
|
+ var mid = Math.floor(Math.random() * 255);
|
|
|
+ return "#30" + mid.toString(16) + "ff";
|
|
|
}
|
|
|
|
|
|
//Need to display multiple epuiment's data table and can't find the function to reset it. So I kill all the nodes.
|
|
|
function reset() {
|
|
|
- const myNode = document.getElementById("testssss");
|
|
|
+ const myNode = document.getElementById("tabData");
|
|
|
while (myNode.firstChild) {
|
|
|
myNode.removeChild(myNode.lastChild);
|
|
|
}
|
|
|
@@ -1242,4 +1258,4 @@ function reset() {
|
|
|
table.className = "display";
|
|
|
//table.style.width = "100%";
|
|
|
myNode.appendChild(table);
|
|
|
-}
|
|
|
+}
|