[問題] google chart忽略某個點繪製折線圖

作者: xx250919 (pfnh)   2016-03-23 16:24:16
我的google chart折線圖是以讀txt檔方式來繪製
這是txt檔內容
2016 03 17 00 00 00 44547.82 99 44284.33 98 44297
2016 03 17 00 01 00 44547.76 99 44284.28 79 44297
2016 03 17 00 02 00 44547.90 99 44284.36 99 44297
2016 03 17 00 03 00 44547.94 99 44284.39 99 44297
2016 03 17 00 04 00 44548.07 99 44284.79 88 44297
2016 03 17 00 05 00 44548.26 99 44284.89 68 44297
2016 03 17 00 06 00 44548.41 99 44284.95 69 44297
2016 03 17 00 07 00 44548.39 99 44284.98 78 44297
2016 03 17 00 08 00 44548.21 99 44284.83 98 44297
2016 03 17 00 09 00 44548.02 99 44284.52 99 44297
2016 03 17 00 10 00 null 99 44283.74 98 99999.99
2016 03 17 00 11 00 44547.00 99 44283.16 98 44296
2016 03 17 00 12 00 44547.02 99 44283.35 99 44296
2016 03 17 00 13 00 44547.04 99 44283.34 99 44296
2016 03 17 00 14 00 44547.26 99 44283.40 98 44296
2016 03 17 00 15 00 44547.34 99 44283.54 59 44296
2016 03 17 00 16 00 44547.33 99 44283.53 99 44296
2016 03 17 00 17 00 44547.40 99 44283.70 58 44296
2016 03 17 00 18 00 44547.54 99 44283.91 89 44296
2016 03 17 00 19 00 44547.68 99 44284.01 49 44296
讀到null這個點時會繪製為0
我想忽略null這個點跟99999.99這個點
以下是我的程式
<?php
include_once 'public.php';
//$mainFile = $ccuFile;
$mainFile = basename(__FILE__);//$yymFile;
extract(GetCCu($_GET['date']));
?>
<script>
$(document).ready(function(){
$('#datetimepicker').datetimepicker({
dayOfWeekStart : 1,
lang:'ch',
timepicker:false,
format:'Y/m/d',
formatDate:'Y/m/d',
});
});
function querydata()
{
v = $('#datetimepicker').val();
if (v.length <= 0)
return;
location.href = "<?php echo $mainFile; ?>?date="+v;
}
</script>
<script type="text/javascript"
src="https://www.google.com/jsapi?autoload={
'modules':[{
'name':'visualization',
'version':'1',
'packages':['corechart']
}]
}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data2 = google.visualization.arrayToDataTable([ <?php echo $ccu2;
?>]);
var options2 = {
title: '<?php echo 'TW'; ?>',
curveType: 'function',
hAxis: {title: '<?php echo $ccu2_xtitle;
?>',format:'H'},
vAxis: {title: '<?php echo $ccu2_ytitle; ?>'},
legend: { position: 'right' },
};
var chart2 = new
google.visualization.LineChart(document.getElementById('chart2'));
chart2.draw(data2, options2);
}
</script>
<body>
<style>
body{
font-family:Microsoft JhengHei,Arial;
}
</style>
請選擇查詢日期&nbsp;<input type="text" id="datetimepicker"
name="datetimepicker" value=""><input type="button" value="查詢"
onclick="querydata()">
<div style="color: red"><?php echo $msg; ?></div>
<div style="font-size:20px;font-weight:bold;padding:0.5% 0 0 5% ;"><?php
echo $date; ?></div>
<div id="chart2"></div>
請問各位大大能教我怎麼改我的程式嘛?
作者: illl (ill!)   2016-03-23 16:53:00
先處理再讀吧?

Links booklink

Contact Us: admin [ a t ] ucptt.com