Hey, I've been working with the function you created because I knew the data it was returning to be inaccurate. I looked through http://code.google.com/apis/chart/ and found that the type of encoding you used (text encoding) only accepts values from 0 to 100. On my gallery I've got 14,459 photos, 10,998 of which were taken by my XTi. When graphed any values over 100 were kept at 100, making the graph absolutely wrong. I fixed that in my the revised function below by turning each value into a percentage. Also, the "unknown" label was not working for my data, and by changing the `$sql =` line to match code I generated with phpmyadmin I got it to work. Now it doesn't show that I use flash on a quarter of all photos but rather less than one percent.
`
``function pie_graph($col,$title)
{
$sql = "SELECT count( * ) AS `Rows` , ".$col." FROM `images` GROUP BY ".$col." ORDER BY ".$col." LIMIT 0, 30";
$result = mysql_query($sql);
while($r = mysql_fetch_array($result)) {
$current_Label = $r[1];
if (empty($current_Label)) { $Label .= 'Unknown|';
} else {
$Label .= $r[1].'|'; }
$Values .= ( ($r[0])/100 ).',';
}
$Label=trim($Label,"|");
$Values=trim($Values,",");
echo '[img]http://chart.apis.google.com/chart?chts=222829&chtt='.$title.'&chts=222829,16&cht=p3&chco=002E5B&chd=t:'.$Values.'&chs=600x150&chl='.$Label.'&chf=bg,s,6A90AD[/img]';
}`