I have found a solution.

if any one else is ever interested in something similar.

while($row = mysql_fetch_array($result))
{
if(!in_array($row['name'],$name)) 
{$names[]=$row['name'];} 
 $y = array_search($row['name'],$names); 
$x = date('Y,m,d',strtotime($row['timestamp'])); 
 if(isset($tlTable["'".$x."'"])) 
{
if(isset($tlTable["'".$x."'"][$y])) 
{$tlTable["'".$x."'"][$y]++;} 
else 
{$tlTable["'".$x."'"][$y]=1;} 
}
else
{  
$tlTable["'".$x."'"]=array();
$tlTable["'".$x."'"][$y]=1;}
$k++;
}

// to output results

var tlData = new google.visualization.DataTable();
tlData.addColumn('date', 'Date');
        <?php
foreach ($names as $key => $value)
{
echo "tlData.addColumn('number', '".$value."');\n";
        echo "tlData.addColumn('string', 'title".$key."');\n";
        echo "tlData.addColumn('string', 'text".$key."');\n";
}
?>
tlData.addRows(<?php if(count($tlTable)==0){echo "1";}else{ echo 
count($tlTable);} ?>);
   <?php
$u=0;
foreach ($tlTable as $key => $value)
{
echo "tlData.setValue(".$u.", 0, new Date(".$key."));\n";
$hits = $value;
foreach($hits as $k => $v)
{$index=3*$k+1;
   echo "tlData.setValue(".$u.", ".$index.", ".$v.");\n";
}
$u++;
}
?>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to