|
|
@@ -251,7 +251,7 @@ function getTable(monitor) {
|
|
|
|
|
|
//建立pie chart
|
|
|
function getCheckValue() {
|
|
|
- /*
|
|
|
+
|
|
|
var dataArray = [];
|
|
|
|
|
|
var option = window.localStorage.getItem("option");
|
|
|
@@ -266,13 +266,9 @@ function getCheckValue() {
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
- url: "/BIM-Monitor/script/php/checkValue2.php",
|
|
|
+ url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
|
data: {
|
|
|
- method: method,
|
|
|
- table_name: table_name,
|
|
|
- warning1: warning1,
|
|
|
- warning2: warning2,
|
|
|
- warning_Count: warning_Count
|
|
|
+ type:option
|
|
|
},
|
|
|
async: false,
|
|
|
contentType: "application/json",
|
|
|
@@ -282,9 +278,7 @@ function getCheckValue() {
|
|
|
.success(function (response) {
|
|
|
console.log(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'];
|
|
|
sparklinePieData = [normal_count, abnormal_count];
|
|
|
@@ -302,31 +296,22 @@ function getCheckValue() {
|
|
|
})
|
|
|
.complete(function () {});
|
|
|
return dataArray;
|
|
|
- */
|
|
|
+
|
|
|
var dataArray = [];
|
|
|
return dataArray;
|
|
|
}
|
|
|
|
|
|
//建立左側監測儀器(異常數量/總數量)
|
|
|
function GetCheckAllAJAXValue() {
|
|
|
- /*
|
|
|
+
|
|
|
errorArray = [];
|
|
|
- for (i = 0; i < errorTable.length; i++) {
|
|
|
+ for (i = 0; i < sites["r03"].length; i++) {
|
|
|
|
|
|
- var method = errorTable[i].method;
|
|
|
- var option = errorTable[i].table_name;
|
|
|
- var table_name = errorTable[i].table_name + "data";
|
|
|
- var warning1 = errorTable[i].warning1;
|
|
|
- var warning2 = errorTable[i].warning2;
|
|
|
- var warning_Count = errorTable[i].warning_Count;
|
|
|
+ var option = sites["r03"][i].code;
|
|
|
$.ajax({
|
|
|
- url: "/BIM-Monitor/script/php/checkValue2.php",
|
|
|
+ url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
|
data: {
|
|
|
- method: method,
|
|
|
- table_name: table_name,
|
|
|
- warning1: warning1,
|
|
|
- warning2: warning2,
|
|
|
- warning_Count: warning_Count
|
|
|
+ type: option
|
|
|
},
|
|
|
async: false,
|
|
|
contentType: "application/json",
|
|
|
@@ -338,9 +323,9 @@ function GetCheckAllAJAXValue() {
|
|
|
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 + ")";
|
|
|
+ console.log("option: " + option);
|
|
|
+ $(`.${option}`).html("(<font color='#FF0000'>" + abnormal_count + "</font>/" + all_count + ")");
|
|
|
+ //document.getElementByName(option).innerHTML = "(<font color='#FF0000'>" + abnormal_count + "</font>/" + all_count + ")";
|
|
|
errorArray.push(abnormal_count);
|
|
|
})
|
|
|
.error(function () {
|
|
|
@@ -348,7 +333,7 @@ function GetCheckAllAJAXValue() {
|
|
|
})
|
|
|
.complete(function () {});
|
|
|
}
|
|
|
- */
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -458,13 +443,13 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
label: "警戒值+",
|
|
|
data: SIS_data["warning1"],
|
|
|
borderColor: "#FF0000",
|
|
|
- borderDash: [5,5],
|
|
|
+ borderDash: [5, 5],
|
|
|
pointRadius: 0
|
|
|
}, {
|
|
|
label: "警戒值-",
|
|
|
data: SIS_data["warning2"],
|
|
|
borderColor: "#FF0000",
|
|
|
- borderDash: [5,5],
|
|
|
+ borderDash: [5, 5],
|
|
|
pointRadius: 0
|
|
|
}, {
|
|
|
label: "行動值+",
|
|
|
@@ -522,20 +507,32 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
Object.keys(chart).forEach(function (key) {
|
|
|
if (key == "Date") {
|
|
|
date.push(chart[key]);
|
|
|
- } else if (key == "WarningValue") {
|
|
|
+ } else if (key.includes("WarningValue")) {
|
|
|
let value = 0;
|
|
|
if (chart[key].includes("±")) {
|
|
|
value = chart[key].split("±")[1];
|
|
|
+ warning1.push(+value);
|
|
|
+ warning2.push(-value);
|
|
|
+ }
|
|
|
+ if (key.includes("High")) {
|
|
|
+ warning1.push(chart[key]);
|
|
|
+ } else if (key.includes("Low")) {
|
|
|
+ warning2.push(chart[key]);
|
|
|
}
|
|
|
- warning1.push(+value);
|
|
|
- warning2.push(-value);
|
|
|
- } else if (key == "ActionValue") {
|
|
|
+
|
|
|
+ } else if (key.includes("ActionValue")) {
|
|
|
let value = 0;
|
|
|
if (chart[key].includes("±")) {
|
|
|
value = chart[key].split("±")[1];
|
|
|
+ action1.push(+value);
|
|
|
+ action2.push(-value);
|
|
|
+ }
|
|
|
+ if (key.includes("High")) {
|
|
|
+ action1.push(chart[key]);
|
|
|
+ } else if (key.includes("Low")) {
|
|
|
+ action2.push(chart[key]);
|
|
|
}
|
|
|
- action1.push(+value);
|
|
|
- action2.push(-value);
|
|
|
+
|
|
|
} else {
|
|
|
data.push(chart[key]);
|
|
|
}
|
|
|
@@ -546,13 +543,13 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
label: "警戒值+",
|
|
|
data: warning1,
|
|
|
borderColor: "#FF0000",
|
|
|
- borderDash: [5,5],
|
|
|
+ borderDash: [5, 5],
|
|
|
pointRadius: 0
|
|
|
}, {
|
|
|
label: "警戒值-",
|
|
|
data: warning2,
|
|
|
borderColor: "#FF0000",
|
|
|
- borderDash: [5,5],
|
|
|
+ borderDash: [5, 5],
|
|
|
pointRadius: 0
|
|
|
}, {
|
|
|
label: "行動值+",
|
|
|
@@ -786,19 +783,19 @@ function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
//X-axis displays the date
|
|
|
labels: c_m_date,
|
|
|
datasets: [{
|
|
|
- //Label above the chart to illustrate which color has which purpose
|
|
|
- label: c_wellName,
|
|
|
- //Data value
|
|
|
- data: c_m_value,
|
|
|
- //Detemine line's color
|
|
|
- borderColor: '#3e95cd'
|
|
|
- },
|
|
|
- {
|
|
|
- label: "警戒值",
|
|
|
- data: warning,
|
|
|
- borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
- }
|
|
|
+ //Label above the chart to illustrate which color has which purpose
|
|
|
+ label: c_wellName,
|
|
|
+ //Data value
|
|
|
+ data: c_m_value,
|
|
|
+ //Detemine line's color
|
|
|
+ borderColor: '#3e95cd'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "警戒值",
|
|
|
+ data: warning,
|
|
|
+ borderColor: "#FF0000",
|
|
|
+ pointRadius: 0
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
options: {
|
|
|
@@ -912,15 +909,15 @@ function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_val
|
|
|
data: {
|
|
|
labels: c_m_date,
|
|
|
datasets: [{
|
|
|
- label: c_wellName,
|
|
|
- data: c_m_value,
|
|
|
- borderColor: '#3e95cd'
|
|
|
- },
|
|
|
- {
|
|
|
- label: c2_wellName,
|
|
|
- data: c2_m_value,
|
|
|
- borderColor: '#63fff5'
|
|
|
- }
|
|
|
+ label: c_wellName,
|
|
|
+ data: c_m_value,
|
|
|
+ borderColor: '#3e95cd'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c2_wellName,
|
|
|
+ data: c2_m_value,
|
|
|
+ borderColor: '#63fff5'
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
options: {
|
|
|
@@ -1081,41 +1078,41 @@ function init6(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_value, c3_well
|
|
|
data: {
|
|
|
labels: c_m_date,
|
|
|
datasets: [{
|
|
|
- label: c_wellName,
|
|
|
- data: c_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: c2_wellName,
|
|
|
- data: c2_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: c3_wellName,
|
|
|
- data: c3_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: c4_wellName,
|
|
|
- data: c4_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: c5_wellName,
|
|
|
- data: c5_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: c6_wellName,
|
|
|
- data: c6_m_value,
|
|
|
- borderColor: randomColor()
|
|
|
- },
|
|
|
- {
|
|
|
- label: "警戒值",
|
|
|
- data: warning,
|
|
|
- borderColor: "#FF0000",
|
|
|
- pointRadius: 0
|
|
|
- }
|
|
|
+ label: c_wellName,
|
|
|
+ data: c_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c2_wellName,
|
|
|
+ data: c2_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c3_wellName,
|
|
|
+ data: c3_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c4_wellName,
|
|
|
+ data: c4_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c5_wellName,
|
|
|
+ data: c5_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: c6_wellName,
|
|
|
+ data: c6_m_value,
|
|
|
+ borderColor: randomColor()
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "警戒值",
|
|
|
+ data: warning,
|
|
|
+ borderColor: "#FF0000",
|
|
|
+ pointRadius: 0
|
|
|
+ }
|
|
|
]
|
|
|
},
|
|
|
options: {
|
|
|
@@ -1158,68 +1155,6 @@ function init6(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_value, c3_well
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-/*
|
|
|
-function initCompare(m_date, chart_data, index, label) {
|
|
|
- var ctx = document.getElementById("myChart").getContext("2d");
|
|
|
- var value = -7.9;
|
|
|
- let warning = [];
|
|
|
- var phase = document.getElementById("phase").value;
|
|
|
-
|
|
|
-
|
|
|
- yLabel = "水位高程GL(m)";
|
|
|
- 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: {
|
|
|
- labels: m_date
|
|
|
- },
|
|
|
- options: {
|
|
|
- responsive: true,
|
|
|
- maintainAspectRatio: false,
|
|
|
- scales: {
|
|
|
- y: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: yLabel
|
|
|
- }
|
|
|
- },
|
|
|
- x: {
|
|
|
- title: {
|
|
|
- display: true,
|
|
|
- text: xLabel
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- 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
|
|
|
- });
|
|
|
- }
|
|
|
- */
|
|
|
-//window.chart.update();
|
|
|
-//}
|
|
|
|
|
|
//Chart has multiple lines that need different color
|
|
|
function randomColor() {
|