Re: Google Visualization Chart API

From: Date: Thu, 17 Feb 2011 20:18:28 +0000
Subject: Re: Google Visualization Chart API
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-311412@lists.php.net to get a copy of this message
On 17 February 2011 19:13, Ashley M. Kirchner <ashley@pcraft.com> 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

« previous php.general (#311412) next »