Re: Google Visualization Chart API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17 February 2011 19:13, Ashley M. Kirchner <ashley@xxxxxxxxxx> wrote:
>
> Â ÂI'm currently using Google Visualization API[1] to generate both
> interactive and static charts for a client and they're viewing these
> online[2]. ÂHowever they now want to be able to download a PDF containing
> the charts (static) in it. ÂDoes anyone know of a way where I can take the
> same API and create a PDF document instead?
>
> Â ÂI've worked with fpdf[3] in the past to create PDFs on the fly so that's
> no problem. ÂThe problem is figuring out how to get the charts in such a way
> that I can shove them into the PDF.
>
> Â Â[1] http://code.google.com/apis/visualization/
> Â Â[2] Example: http://www.yeehaw.net/chart.html - feel free to view source
> Â Â[3] http://www.fpdf.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

The image's url is
http://chart.apis.google.com/chart?cht=p3&chs=400x200&chdl=Work%7CEat%7CCommute%7CWatch%20TV%7CSleep&chdlp=r&chco=3399CC%2C80C65A%2CFF0000%2CFFCC33%2CBBCCED%2C3399CC%2C990066%2CFF9900&chd=e%3A..LoLoLoot

Google has an example too ...
https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

See the difference?

In your example, the chd value is e:..LoLoLoot

In their example, the chd value is t:60,40

So, e = encoded, t = text.

So ...

$imgBinary = file_get_contents('http://chart.apis.google.com/chart?cht=p3&chs=400x200&chdl=Work%7CEat%7CCommute%7CWatch%20TV%7CSleep&chdlp=r&chco=3399CC%2C80C65A%2CFF0000%2CFFCC33%2CBBCCED%2C3399CC%2C990066%2CFF9900&chd=e%3A..LoLoLoot');
or
$imgBinary = file_get_contents('https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World');

I've been playing with Google Maps and they document the polyline
encoding algorithm fairly well. I'm sure they would have done the same
for the chd ... and here it is
http://code.google.com/apis/chart/docs/data_formats.html

So. Easy peasy.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux