[pmwiki-users] integrating google charts

Ansgar Bockstiegel ansgar at bockstiegel.net
Thu Jan 10 01:51:16 CST 2008


Wouldn't it be nice to edit the chart inside the wiki?
If we have a markup like (:gchart type=lc xsize=150 ysize=50 
data=justatest:) a recipe could transfer this to the corresponding img-Tag.
I just tested it. There are still things to add, but basically it works:

Markup('gchart',
       'directives',
       '/\\(:gchart(\\s+.*?)?:\\)/ei',
       'Keep(gchart("$1"))');

function gchart($unparsed_args){
    $args = ParseArgs($unparsed_args);
    $out = '<img src="http://chart.apis.google.com/chart?';
    $out .= 'chs='.$args['xsize'].'x'.$args['ysize'];
    $out .= '&amp;';
    $out .= 'chd=s:'.$args['data'];
    $out .= '&amp;';
    $out .= 'cht='.$args['type'];
    $out .= '" />';
    return $out;
}


Ansgar

Petko Yotov schrieb:
> On Thursday 10 January 2008 02:25:27 Petko Yotov wrote:
>   
>> http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hi|All&.
>> png
>>     
>
> Update: for this to work, you need to also replace any "|" in the address 
> with "%7A". So the address of the picture will be:
>
> http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hi%7CAll&.png
>
> Petko
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
>   




More information about the pmwiki-users mailing list