123456789101112131415161718192021222324252627282930313233343536373839404142 |
- function get_data(){
- var xhr = new XMLHttpRequest();
- var url = "channel/dev001/ch01";
- obj="";
- xhr.open("GET",url);
- xhr.onload = function(){
- obj = JSON.parse(xhr.responseText);
- insertHTML(obj);
- };
- xhr.send();
- }
- function insertHTML(data){
- console.log(data);
- //aria.innerHTML=data[0].tower_name;
- var inner='<table> <tr> <th>主軸分析 </th><th>軸承分析 </th><th>馬達分析 </th><th>齒輪分析 </th> </tr> <tr>';
- inner+='<td> 不平衡 '+data.DW_Unbalance+'</td><td>油膜旋震 '+data.DW_Whirl+'</td><td>氣隙不均 '+data.DW_AirGap+'</td><td>齒輪不對中 '+data.DW_GMisalignment+'</td></tr><tr>';
- inner+='<td> 軸彎曲 '+data.DW_Unbalance+'</td><td>油膜晃蕩 '+data.DW_Whirl+'</td><td>轉子條斷裂 '+data.DW_AirGap+'</td><td>齒輪斷齒 '+data.DW_GMisalignment+'</td></tr><tr>';
- inner+='<td> 不對中 '+data.DW_Unbalance+'</td><td>內還損傷 '+data.DW_Whirl+'</td><td>相位問題 '+data.DW_AirGap+'</td><td>齒輪磨損 '+data.DW_GMisalignment+'</td></tr><tr>';
- inner+='<td> 鬆動 '+data.DW_Unbalance+'</td><td>外環損傷 '+data.DW_Whirl+'</td><td></td><td>齒輪彎曲 '+data.DW_GMisalignment+'</td></tr><tr>';
- inner+='<td> </td><td>滾珠損傷 '+data.DW_Whirl+'</td><td></td><td>齒輪偏心 '+data.DW_GMisalignment+'</td></tr><tr>';
-
- document.getElementById("channel").innerHTML=inner;
- }
- get_data();
- get_chart_data();
- function get_chart_data(){
- var xhr = new XMLHttpRequest();
- var url = "channel_chart/dev001/ch01";
- obj="";
- xhr.open("GET",url);
- xhr.onload = function(){
- obj = JSON.parse(xhr.responseText);
- document.getElementById("chart_info").innerHTML=obj;
- console.log(obj[0]);
- };
- xhr.send();
- }
|