[pmwiki-users] integrating google charts
Nicolas Poulain
nico.poulain at gmail.com
Sun Jan 13 15:53:35 CST 2008
Jabba Laci a écrit :
> Hi,
>
> Google has a very nice chart API:
> http://code.google.com/apis/chart/
> Example:
>
http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello|World
> Do you know how to integrate such charts in a PmWiki page?
That api is really cool, the following code ads a pie chart in
totalcounter_1_9.php if added after line 816 :
% ------------ pie Chart using GoogleChart API ------------------
if (is_array($tar) && $tot)
foreach ($tar as $pn => $cnt) {
$sc = Round(100*$cnt/$tot);
if ($sc>=3) { # shows only >=3% count pages
$Page[] = $pn;
$Scor[] = $sc;
$mytot = $mytot+$sc;
}
};
$Page[] = "Other...";
$Scor[] = $tot-$mytot;
$html .= "<img
src=\"http://chart.apis.google.com/chart?cht=p3&chd=t:".implode(",",$Scor)."&chs=350x100&chl=".implode("|",$Page)."\"/>";
% ---------------------------------------------------------------
http://www.pmwiki.org/wiki/Cookbook/TotalCounter
--
Nicolas Poulain
nicolas at poulain.name
http://exomatik.net/
More information about the pmwiki-users
mailing list