Just build the URL from your retrieved data. Here is a sloppy example
for a
pie chart function.
function piechart($data, $name = 'piechart') {
$counter = count($data['metrics']);
$columns = (count($data,1)/count($data,0))-1;
$return = "<img src='http://chart.apis.google.com/chart?";
$return .= "chs=600x200&";
$return .= "cht=p&";
$return .= "chco=3399CC,FF9900,80C65A,7777CC,990066,999999&";
$return .= "chd=t:";
$total = 0;
foreach ($data['values'] as $key => $value)
{
$total += $value;
}
$i = 0;
foreach ($data['values'] as $key => $value)
{
if ($i == 0){
$return .= ($value/$total*100);
} else {
$return .= ",".($value/$total*100);
}
$i++;
}
$return .= "&chl=";
foreach ($data['metrics'] as $key => $value)
{
$return .= $value."|";
}
$return .= "' />";
return($return);
}
On May 19, 12:21 pm, everest_man27 <[email protected]> wrote:
> I have a similar challenge - looking for advise on how to link mysql
> using php into google visualization api to be able to create dynamic
> chart. The documentation on connecting to data source is not clear on
> how to connect to a mysql data base.
>
> Advise on how to connect to mysql is greatly appreciated.
>
> Thank you.
>
> On May 18, 6:26 pm, GutoW <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi, I'm a brazillian developper and i'm need a help with google chart
> > api and mysql with php.
>
> > I have some tables where i create a query for give me the results. At
> > here it's ok, but how i get the information of my query and sent to
> > google chart api to give the chart to put on my website...? i'm
> > looking for some codes in the web but i don't codify to give my
> > prupose.
>
> > Any body help-me ?
>
> > Ps.: Sorry my english is poor...
--
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.