|
@@ -16,14 +16,11 @@ var R03Json = $.getJSON("/BIM-Monitor/assets/json/r03-monitorList.json", functio
|
|
|
$.ajaxSettings.async = true;
|
|
$.ajaxSettings.async = true;
|
|
|
|
|
|
|
|
var lastNode;
|
|
var lastNode;
|
|
|
-var errorArray = [];
|
|
|
|
|
var switchNumber = 0;
|
|
var switchNumber = 0;
|
|
|
passString('SIS');
|
|
passString('SIS');
|
|
|
var wellTBA = [];
|
|
var wellTBA = [];
|
|
|
var wellNameLists = [];
|
|
var wellNameLists = [];
|
|
|
var isAll = true;
|
|
var isAll = true;
|
|
|
-//var isCompare = false;
|
|
|
|
|
-//var saveCheckCompare = "";
|
|
|
|
|
var dataTable;
|
|
var dataTable;
|
|
|
var sparklinePieData = [];
|
|
var sparklinePieData = [];
|
|
|
|
|
|
|
@@ -41,7 +38,6 @@ $(document).ready(function () {
|
|
|
} else {
|
|
} else {
|
|
|
let option = $(this).attr("monitor");
|
|
let option = $(this).attr("monitor");
|
|
|
isAll = true;
|
|
isAll = true;
|
|
|
- //isCompare = false;
|
|
|
|
|
passString(option);
|
|
passString(option);
|
|
|
document.getElementById("monitorName").innerHTML = option + "監測儀器";
|
|
document.getElementById("monitorName").innerHTML = option + "監測儀器";
|
|
|
LoadPage();
|
|
LoadPage();
|
|
@@ -107,10 +103,10 @@ function LoadPage() {
|
|
|
// 到unity的DataTable.cs裡面
|
|
// 到unity的DataTable.cs裡面
|
|
|
myGameInstance.SendMessage("Monitor", "AddDataTable", dataValue);
|
|
myGameInstance.SendMessage("Monitor", "AddDataTable", dataValue);
|
|
|
//原本的模型牆被挖空,SID、RS、VG都有建各自的牆,若選擇一種監測儀器則另外兩種隱藏掉
|
|
//原本的模型牆被挖空,SID、RS、VG都有建各自的牆,若選擇一種監測儀器則另外兩種隱藏掉
|
|
|
- //addData(DataTable.option);
|
|
|
|
|
- //依照DataTable的option將所有optionGameObjects改成normal的顏色
|
|
|
|
|
- //Search(DataTable.option, DataTable.abnormal);
|
|
|
|
|
- //將所有abnormal的儀器改成abnormal的顏色
|
|
|
|
|
|
|
+ //unity會跑addData(DataTable.option);
|
|
|
|
|
+ //功能是依照DataTable的option將所有optionGameObjects改成normal的顏色
|
|
|
|
|
+ //unity會跑Search(DataTable.option, DataTable.abnormal);
|
|
|
|
|
+ //功能是將所有abnormal的儀器改成abnormal的顏色
|
|
|
myGameInstance.SendMessage("Monitor", "Initialization");
|
|
myGameInstance.SendMessage("Monitor", "Initialization");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -145,12 +141,10 @@ function LoadPage() {
|
|
|
function showWell(str, changeCamera) {
|
|
function showWell(str, changeCamera) {
|
|
|
|
|
|
|
|
var strLocal = "";
|
|
var strLocal = "";
|
|
|
- //isCompare = false;
|
|
|
|
|
- //$("#compareCheck").checked = false;
|
|
|
|
|
strLocal = str;
|
|
strLocal = str;
|
|
|
$("#monitorSelect2").innerHTML = strLocal;
|
|
$("#monitorSelect2").innerHTML = strLocal;
|
|
|
getTable(str);
|
|
getTable(str);
|
|
|
- getChart(str, "myChart");
|
|
|
|
|
|
|
+ getChart(str);
|
|
|
|
|
|
|
|
if (isLoad) {
|
|
if (isLoad) {
|
|
|
//把現在選擇的儀器名稱(例:OW-1)傳到unity,unity找模型名稱相同的改變模型顏色以及鏡頭置中模型
|
|
//把現在選擇的儀器名稱(例:OW-1)傳到unity,unity找模型名稱相同的改變模型顏色以及鏡頭置中模型
|
|
@@ -251,24 +245,14 @@ function getTable(monitor) {
|
|
|
|
|
|
|
|
//建立pie chart
|
|
//建立pie chart
|
|
|
function getCheckValue() {
|
|
function getCheckValue() {
|
|
|
-
|
|
|
|
|
- var dataArray = [];
|
|
|
|
|
|
|
|
|
|
|
|
+ var dataArray = [];
|
|
|
var option = window.localStorage.getItem("option");
|
|
var option = window.localStorage.getItem("option");
|
|
|
- for (i = 0; i < errorTable.length; i++) {
|
|
|
|
|
- if (errorTable[i].table_name == option) {
|
|
|
|
|
- var method = errorTable[i].method;
|
|
|
|
|
- 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;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
$.ajax({
|
|
|
url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
|
data: {
|
|
data: {
|
|
|
- type:option
|
|
|
|
|
|
|
+ type: option
|
|
|
},
|
|
},
|
|
|
async: false,
|
|
async: false,
|
|
|
contentType: "application/json",
|
|
contentType: "application/json",
|
|
@@ -276,9 +260,7 @@ function getCheckValue() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
.success(function (response) {
|
|
.success(function (response) {
|
|
|
- console.log(response)
|
|
|
|
|
dataArray = response['wellTBA'];
|
|
dataArray = response['wellTBA'];
|
|
|
-
|
|
|
|
|
var normal_count = response['normal_count'];
|
|
var normal_count = response['normal_count'];
|
|
|
var abnormal_count = response['abnormal_count'];
|
|
var abnormal_count = response['abnormal_count'];
|
|
|
sparklinePieData = [normal_count, abnormal_count];
|
|
sparklinePieData = [normal_count, abnormal_count];
|
|
@@ -292,51 +274,40 @@ function getCheckValue() {
|
|
|
document.getElementById("percent").innerHTML = Math.round(percent * 100) + "%";
|
|
document.getElementById("percent").innerHTML = Math.round(percent * 100) + "%";
|
|
|
})
|
|
})
|
|
|
.error(function () {
|
|
.error(function () {
|
|
|
- //alert("錯誤統計未正常獲取");
|
|
|
|
|
|
|
+ console.log("錯誤統計未正常獲取");
|
|
|
})
|
|
})
|
|
|
.complete(function () {});
|
|
.complete(function () {});
|
|
|
return dataArray;
|
|
return dataArray;
|
|
|
-
|
|
|
|
|
- var dataArray = [];
|
|
|
|
|
- return dataArray;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//建立左側監測儀器(異常數量/總數量)
|
|
//建立左側監測儀器(異常數量/總數量)
|
|
|
function GetCheckAllAJAXValue() {
|
|
function GetCheckAllAJAXValue() {
|
|
|
-
|
|
|
|
|
- errorArray = [];
|
|
|
|
|
- for (i = 0; i < sites["r03"].length; i++) {
|
|
|
|
|
-
|
|
|
|
|
- var option = sites["r03"][i].code;
|
|
|
|
|
- $.ajax({
|
|
|
|
|
- url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
|
|
|
- data: {
|
|
|
|
|
- type: option
|
|
|
|
|
- },
|
|
|
|
|
- async: false,
|
|
|
|
|
- contentType: "application/json",
|
|
|
|
|
- dataType: "json"
|
|
|
|
|
- })
|
|
|
|
|
|
|
|
|
|
- .success(function (response) {
|
|
|
|
|
|
|
+ for (i = 0; i < sites["r03"].length; i++) {
|
|
|
|
|
+ var option = sites["r03"][i].code;
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: "/BIM-Monitor/script/php/get_abnormal.php",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ type: option
|
|
|
|
|
+ },
|
|
|
|
|
+ async: false,
|
|
|
|
|
+ contentType: "application/json",
|
|
|
|
|
+ dataType: "json"
|
|
|
|
|
+ })
|
|
|
|
|
+ .success(function (response) {
|
|
|
|
|
+ var normal_count = response['normal_count'];
|
|
|
|
|
+ var abnormal_count = response['abnormal_count'];
|
|
|
|
|
+ var all_count = 0 + normal_count + abnormal_count;
|
|
|
|
|
+ $(`.${option}`).html("(<font color='#FF0000'>" + abnormal_count + "</font>/" + all_count + ")");
|
|
|
|
|
+ })
|
|
|
|
|
+ .error(function () {
|
|
|
|
|
+ console.log("錯誤統計未正常獲取");
|
|
|
|
|
+ })
|
|
|
|
|
+ .complete(function () {});
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- var normal_count = response['normal_count'];
|
|
|
|
|
- var abnormal_count = response['abnormal_count'];
|
|
|
|
|
- var all_count = 0 + normal_count + abnormal_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 () {
|
|
|
|
|
- //alert("錯誤統計未正常獲取");
|
|
|
|
|
- })
|
|
|
|
|
- .complete(function () {});
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
function CheckError() {
|
|
function CheckError() {
|
|
|
var checkBox = document.getElementById("errorCheck");
|
|
var checkBox = document.getElementById("errorCheck");
|
|
|
if (checkBox.checked == true) {
|
|
if (checkBox.checked == true) {
|
|
@@ -347,22 +318,9 @@ function CheckError() {
|
|
|
SetList();
|
|
SetList();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function get_json_file(file_path) {
|
|
|
|
|
- output = {};
|
|
|
|
|
- $.ajax({
|
|
|
|
|
- dataType: "json",
|
|
|
|
|
- url: file_path,
|
|
|
|
|
- }).done(function (data) {
|
|
|
|
|
- output = data;
|
|
|
|
|
- }).error(function (error) {
|
|
|
|
|
- console.log(error);
|
|
|
|
|
- });
|
|
|
|
|
- return output;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
//Display chart
|
|
//Display chart
|
|
|
function getChart(monitor) {
|
|
function getChart(monitor) {
|
|
|
|
|
+ console.log("monitor: " + monitor);
|
|
|
type = monitor.split("-")[0];
|
|
type = monitor.split("-")[0];
|
|
|
|
|
|
|
|
$.ajax({
|
|
$.ajax({
|
|
@@ -378,15 +336,13 @@ function getChart(monitor) {
|
|
|
charts = response.chart;
|
|
charts = response.chart;
|
|
|
label = response.label;
|
|
label = response.label;
|
|
|
unit = response.unit;
|
|
unit = response.unit;
|
|
|
- console.log(charts);
|
|
|
|
|
|
|
+
|
|
|
displayChart(monitor, label, unit, charts);
|
|
displayChart(monitor, label, unit, charts);
|
|
|
|
|
|
|
|
}).error(function (error) {
|
|
}).error(function (error) {
|
|
|
console.log(error);
|
|
console.log(error);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function displayChart(monitor, label, unit, charts) {
|
|
function displayChart(monitor, label, unit, charts) {
|
|
@@ -404,8 +360,6 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
window.chart.destroy();
|
|
window.chart.destroy();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // console.log(charts);
|
|
|
|
|
-
|
|
|
|
|
if (type == "SIS" || type == "SID") {
|
|
if (type == "SIS" || type == "SID") {
|
|
|
SIS_data["depth"] = [];
|
|
SIS_data["depth"] = [];
|
|
|
SIS_data["warning1"] = [];
|
|
SIS_data["warning1"] = [];
|
|
@@ -437,7 +391,6 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- console.log(SIS_data);
|
|
|
|
|
|
|
|
|
|
var datasets = [{
|
|
var datasets = [{
|
|
|
label: "警戒值+",
|
|
label: "警戒值+",
|
|
@@ -472,8 +425,6 @@ function displayChart(monitor, label, unit, charts) {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- console.log(datasets);
|
|
|
|
|
-
|
|
|
|
|
window.chart = new Chart(ctx, {
|
|
window.chart = new Chart(ctx, {
|
|
|
//Line chart
|
|
//Line chart
|
|
|
type: 'line',
|
|
type: 'line',
|
|
@@ -625,6 +576,7 @@ function ResetCamera() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//選擇觀測儀器
|
|
|
function SetList() {
|
|
function SetList() {
|
|
|
var wellNameListsLocal = "";
|
|
var wellNameListsLocal = "";
|
|
|
var isError = false;
|
|
var isError = false;
|
|
@@ -667,9 +619,7 @@ function SetList() {
|
|
|
monitorButton.appendChild(createButton);
|
|
monitorButton.appendChild(createButton);
|
|
|
}
|
|
}
|
|
|
isError = false;
|
|
isError = false;
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UpdateGPS(GPS) {
|
|
function UpdateGPS(GPS) {
|
|
@@ -678,502 +628,7 @@ function UpdateGPS(GPS) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//Start making the chart
|
|
|
|
|
-function init(c_wellName, c_m_date, c_m_value, elementID) {
|
|
|
|
|
-
|
|
|
|
|
- var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
|
|
- 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 OWwarning1 = 0;
|
|
|
|
|
- var OWwarning2 = 0;
|
|
|
|
|
-
|
|
|
|
|
- var yLabel = "";
|
|
|
|
|
- var xLabel = "";
|
|
|
|
|
-
|
|
|
|
|
- if (c_wellName.includes("ELP")) {
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "水位高程GL(m)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("OW")) {
|
|
|
|
|
-
|
|
|
|
|
- for (const [key, value] of Object.entries(OWFirstData)) {
|
|
|
|
|
- if (c_wellName == key) {
|
|
|
|
|
- OWwarning1 = value + 2;
|
|
|
|
|
- OWwarning2 = value - 2;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(OWwarning1);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "水位高程GL(m)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("SM")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(45);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "沉陷量(mm)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("SBM")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(9.5);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "沉陷量(mm)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("SB")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(0.0008);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "沉陷量(mm)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("VG")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(110);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "應力值(t)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- } else if (c_wellName.includes("HM")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(25);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "沉陷量(mm)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (j = 0; j < c_m_value.length; j++) {
|
|
|
|
|
- if (c_m_value[j] == "") {
|
|
|
|
|
- c_m_value[j] = null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //Destroy chart if it already exists. If not, there'll be multiple charts stack together
|
|
|
|
|
- if (window.chart != undefined) {
|
|
|
|
|
- window.chart.destroy();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart = new Chart(ctx, {
|
|
|
|
|
- //Line chart
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- data: {
|
|
|
|
|
- //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
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- options: {
|
|
|
|
|
- spanGaps: true,
|
|
|
|
|
- maintainAspectRatio: false,
|
|
|
|
|
- responsive: true,
|
|
|
|
|
- scales: {
|
|
|
|
|
- y: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: yLabel
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- x: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: xLabel
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- if (c_wellName.includes("SBM")) {
|
|
|
|
|
-
|
|
|
|
|
- let warning2 = [];
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning2.push(-9.5);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart.data.datasets.push({
|
|
|
|
|
- label: "警戒值2",
|
|
|
|
|
- data: warning2,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- window.chart.update();
|
|
|
|
|
- } else if (c_wellName.includes("SB")) {
|
|
|
|
|
-
|
|
|
|
|
- let warning2 = [];
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning2.push(-0.0008);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart.data.datasets.push({
|
|
|
|
|
- label: "警戒值2",
|
|
|
|
|
- data: warning2,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- window.chart.update();
|
|
|
|
|
- } else if (c_wellName.includes("OW")) {
|
|
|
|
|
-
|
|
|
|
|
- let warning2 = [];
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning2.push(OWwarning2);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart.data.datasets.push({
|
|
|
|
|
- label: "警戒值2",
|
|
|
|
|
- data: warning2,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- window.chart.update();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-function init2(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_date, c2_m_value, elementID) {
|
|
|
|
|
-
|
|
|
|
|
- var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
|
|
- var yLabel = "";
|
|
|
|
|
- var xLabel = "";
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- let warning = [];
|
|
|
|
|
- if (c_wellName.includes("TI")) {
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c2_m_date.length; i++) {
|
|
|
|
|
- warning.push(0.00106);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "徑度量(δ/ L)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (j = 0; j < c_m_value.length; j++) {
|
|
|
|
|
- if (c_m_value[j] == "") {
|
|
|
|
|
- c_m_value[j] = null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (window.chart != undefined) {
|
|
|
|
|
- window.chart.destroy();
|
|
|
|
|
- }
|
|
|
|
|
- c_m_value.forEach(function (item, index, array) {
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- window.chart = new Chart(ctx, {
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- data: {
|
|
|
|
|
- labels: c_m_date,
|
|
|
|
|
- datasets: [{
|
|
|
|
|
- label: c_wellName,
|
|
|
|
|
- data: c_m_value,
|
|
|
|
|
- borderColor: '#3e95cd'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: c2_wellName,
|
|
|
|
|
- data: c2_m_value,
|
|
|
|
|
- borderColor: '#63fff5'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- options: {
|
|
|
|
|
- responsive: true,
|
|
|
|
|
- maintainAspectRatio: false,
|
|
|
|
|
- scales: {
|
|
|
|
|
- y: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: yLabel
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- x: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: xLabel
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- //ELP does not have second warning line, so you need to update it seperately
|
|
|
|
|
- if (c_wellName.includes("TI")) {
|
|
|
|
|
-
|
|
|
|
|
- let warning2 = [];
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c2_m_date.length; i++) {
|
|
|
|
|
- warning2.push(-0.00106);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart.data.datasets.push({
|
|
|
|
|
- label: "警戒值2",
|
|
|
|
|
- data: warning2,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- window.chart.update();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-//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 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 index = 0;
|
|
|
|
|
- var num = 0;
|
|
|
|
|
-
|
|
|
|
|
- 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];
|
|
|
|
|
-
|
|
|
|
|
- if (str.includes("SIS")) {
|
|
|
|
|
- index = SIS_array.indexOf(str);
|
|
|
|
|
- num = SIS_data[index];
|
|
|
|
|
- } else if (str.includes("SID")) {
|
|
|
|
|
- index = SID_array.indexOf(str);
|
|
|
|
|
- num = SID_data[index];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_value[0].length; i++) {
|
|
|
|
|
- warning.push(num);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "觀測深度GL(m)";
|
|
|
|
|
- xLabel = "變位量(cm)";
|
|
|
|
|
-
|
|
|
|
|
- for (j = 0; j < c_m_value.length; j++) {
|
|
|
|
|
- if (c_m_value[j] == "") {
|
|
|
|
|
- c_m_value[j] = null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (window.chart != undefined) {
|
|
|
|
|
- window.chart.destroy();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- for (j = 0; j <= c_m_date.length; j++) {
|
|
|
|
|
- if (j == c_m_date.length) {
|
|
|
|
|
- datasetValue[j] = {
|
|
|
|
|
- axis: 'y',
|
|
|
|
|
- fill: false,
|
|
|
|
|
- label: "警戒值",
|
|
|
|
|
- data: warning,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- datasetValue[j] = {
|
|
|
|
|
- axis: 'y',
|
|
|
|
|
- label: c_m_date[j],
|
|
|
|
|
- data: c_m_value[j],
|
|
|
|
|
- borderColor: randomColor()
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart = new Chart(ctx, {
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- data: {
|
|
|
|
|
- labels: c_m_depth,
|
|
|
|
|
- datasets: datasetValue
|
|
|
|
|
- },
|
|
|
|
|
- options: {
|
|
|
|
|
- //Turns line to vertical
|
|
|
|
|
- maintainAspectRatio: false,
|
|
|
|
|
- responsive: true,
|
|
|
|
|
- indexAxis: 'y',
|
|
|
|
|
- scales: {
|
|
|
|
|
- y: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: yLabel
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- x: {
|
|
|
|
|
- beginAtZero: true,
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: xLabel
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function init6(c_wellName, c_m_date, c_m_value, c2_wellName, c2_m_value, c3_wellName, c3_m_value, c4_wellName, c4_m_value, c5_wellName, c5_m_value, c6_wellName, c6_m_value, elementID) {
|
|
|
|
|
-
|
|
|
|
|
- var ctx = document.getElementById(elementID).getContext("2d");
|
|
|
|
|
- let warning = [];
|
|
|
|
|
- if (c_wellName.includes("RS")) {
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning.push(2000);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- yLabel = "應力值(kg/cm²)";
|
|
|
|
|
- xLabel = "日期";
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (window.chart != undefined) {
|
|
|
|
|
- window.chart.destroy();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart = new Chart(ctx, {
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- 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
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- options: {
|
|
|
|
|
- responsive: true,
|
|
|
|
|
- maintainAspectRatio: false,
|
|
|
|
|
- scales: {
|
|
|
|
|
- y: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: yLabel
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- x: {
|
|
|
|
|
- title: {
|
|
|
|
|
- display: true,
|
|
|
|
|
- text: xLabel
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- //ELP does not have second warning line, so you need to update it seperately
|
|
|
|
|
- if (c_wellName.includes("RS")) {
|
|
|
|
|
-
|
|
|
|
|
- let warning2 = [];
|
|
|
|
|
-
|
|
|
|
|
- for (i = 0; i < c_m_date.length; i++) {
|
|
|
|
|
- warning2.push(-2000);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- window.chart.data.datasets.push({
|
|
|
|
|
- label: "警戒值2",
|
|
|
|
|
- data: warning2,
|
|
|
|
|
- borderColor: "#FF0000",
|
|
|
|
|
- pointRadius: 0
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- window.chart.update();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-//Chart has multiple lines that need different color
|
|
|
|
|
-function randomColor() {
|
|
|
|
|
- return "#" + ((1 << 24) * Math.random() | 0).toString(16);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function randomColorBlue() {
|
|
function randomColorBlue() {
|
|
|
var mid = Math.floor(Math.random() * 255);
|
|
var mid = Math.floor(Math.random() * 255);
|
|
|
return "#30" + mid.toString(16) + "ff";
|
|
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("tabData");
|
|
|
|
|
- while (myNode.firstChild) {
|
|
|
|
|
- myNode.removeChild(myNode.lastChild);
|
|
|
|
|
- }
|
|
|
|
|
- var table = document.createElement("table");
|
|
|
|
|
- table.id = "dataTable";
|
|
|
|
|
- table.className = "display";
|
|
|
|
|
- myNode.appendChild(table);
|
|
|
|
|
}
|
|
}
|