这是我的动态谷歌图表代码:
<?php
$dateone="20-09-2013";
$datetwo="15-10-2013";
$qry1=mysql_query("SELECT count(call_type) FROM tb_name WHERE call_date>='".$dateone." 00:00:00' AND call_date<='".$dateone." 23:59:59'");
$row1=mysql_fetch_array($qry1);
$qry2=mysql_query("SELECT count(call_type) FROM tb_name WHERE call_date>='".$datetwo." 00:00:00' AND call_date<='".$datetwo." 23:59:59'");
$row2=mysql_fetch_array($qry2);
$chart= array(
array('Date', 'Total Calls' ),
array("$dateone", intval($row1[0])),
array("$datetwo", intval($row2[0])));
$data=json_encode($chart);
?>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(<?php echo $data; ?>);
var options = {'title':'Total Calls'
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
此代码工作正常。但是,如果我运行此代码,它会在谷歌图表中显示特定日期的详细信息。我需要在给定的两个日期之间进行计数。如何为此修改代码。