我一直在努力使用谷歌图表API.我在SO PHP MySQL Google Chart JSON上找到了这个精彩的例子- 完整示例.
但是我想知道如何更改dafault蓝色的条形颜色.我对如何使用该{ role: 'style' }功能感到困惑.
这是我的代码:
<?php
$con=mysql_connect("localhost","username","pass") or die("Failed to connect with database");
mysql_select_db("rosac", $con);
$query = mysql_query("
SELECT TarikhLulusTahun AS Tahun, COUNT(*) AS Jumlah
FROM association
GROUP BY TarikhLulusTahun");
$rows = array();
$table = array();
$table['cols'] = array(
array('label' => 'Tahun', 'type' => 'string'),
array('label' => 'Jumlah Persatuan', 'type' => 'number')
({type: 'string', role: 'style'})
);
$rows = array();
while($r = mysql_fetch_assoc($query)) {
$temp = array();
$temp[] …Run Code Online (Sandbox Code Playgroud)