echo gettext('歷史曲線圖查詢'); ?>
echo gettext('歷史曲線圖'); ?>
$value){ //echo date('Y-m-d H:i',$value['date'])."|".$value['date'].""; $date_xAxis[] = "'".date('Y-m-d H:i',$value['date'])."'"; $device_date[date('Y-m-d H:i',$value['date'])][$value['name']] = ($value['formula_val'] != "") ? number_format($value['formula_val'],2,".",""):'null'; } $xAxis = implode(',',array_unique($date_xAxis)); //列軸時間換算 //將sensor的值 存為陣列 foreach($device_date as $key => $value){ foreach($name as $k => $v){ $device_name_1[$v][] = ($value[$v] != "") ? $value[$v]:'null'; } } //解析sensor的陣列 提供給圖內的查詢 $i = 0; foreach($device_name_1 as $key => $value){ if(in_array($key,$name)){ $Y_Axisp[] = "{name: '".$key."', marker: {symbol: '".$chart_symbol[$i]."'}, data: [".implode(',',$value)."]}"; $i++; } } $series = implode(',',$Y_Axisp); //值的時間換算 $unit = "'".$array['0']['unit']."'"; }else{ echo gettext('查詢內容不正確'); } $range = implode(',',$alert_range); $total_number = count($date_xAxis); $x_tickInterval = ($array['0']['x_tickInterval'] != "") ? ",tickInterval:".round($total_number/$array['0']['x_tickInterval']/$totoal_sensor):""; $y_tickInterval = ($array['0']['y_tickInterval'] != "") ? ",tickInterval:".$array['0']['y_tickInterval']:""; $y_max = ($array['0']['y_max'] != "") ? ",max:".$array['0']['y_max']:""; $y_min = ($array['0']['y_min'] != "") ? ",min:".$array['0']['y_min']:""; break; case "1": //print_r($device_load); $date_xAxis = implode("','",$name); $xAxis = "'".$date_xAxis."'"; //列軸時間換算 foreach($device_load as $key => $value){ $device_date[date('Y-m-d H:i',$value['date'])][$value['name']] = ($value['formula_val'] != "") ? number_format($value['formula_val'],2,'.',''):'null'; } foreach($device_date as $key => $value){ $totoal_number = 0; ksort($value); foreach($name as $k => $v){ $totoal_number += ($value[$v] != "") ? $value[$v]:0; $device_name_1[$key][] = $totoal_number; } } $i = 0; foreach($device_name_1 as $key => $value){ $Y_Axisp[] = "{name: '".$key."', marker: {symbol: '".$chart_symbol[$i]."'}, data: [".implode(',',$value)."]}"; $i++; } $series = implode(',',$Y_Axisp); //值的時間換算 $unit = "'".$device_name['0']['unit']."'"; break; } ?>