我使用谷歌图表API绘制图表.我得到这个图表:

我在这个图表中的问题是X轴.标签看起来不那么好.如果我在X轴上有更多的字符串,它看起来像这样:

我认为问题是因为X列类型是字符串而不是DATETIME.我如何更改谷歌图表中的列类型?或者我如何在不改变列类型的情况下更改X轴?我在下面添加脚本......
PHP代码:
$connection = mysql_connect('127.0.0.1','root','123456');
mysql_select_db('db_statmarket',$connection);
$result2 = mysql_query('select sum(`How much read from customer`) as Leads, Date from monitor group by Date;',$connection) or die('cannot show tables');
$json = array();
while($row = mysql_fetch_assoc($result2)) {
$json[] = $row;
}
$str='[\'Date\', \'Leads\'],';
foreach($json as $key=>$value){
$str = $str.'['.'\''.$value["Date"].'\''.', '.$value["Leads"].'],';
}
$str = substr($str, 0, -1);
$str = '['.$str.']';
$result1 = mysql_query('SELECT * FROM monitor ORDER BY customer_id DESC LIMIT 1;',$connection) or die('cannot show tables');
$row = mysql_fetch_assoc($result1);
Run Code Online (Sandbox Code Playgroud)
JS代码:
google.setOnLoadCallback(drawChart); …Run Code Online (Sandbox Code Playgroud)