There is already a caching mechanism for cached images, you just have to add the caching codes to your calls.
http://pchart.sourceforge.net/documentation.php?topic=pCache
The caching mechanism works when a graph is sent to the browser using the Stroke() command. Which is fine, but then it outputs the image directly to the page as a binary file. I not sure If I want to mess with the class to change the file header. Any ideas on how to pass so many parameters? I started to do the easy ones...
$chartWidth= (isset($chartWidth))? $chartWidth : ’400’;
$chartHeight = (isset($chartHeight))? $chartHeight : ’400’;
$chartTitle = (isset($chartTitle))? $chartTitle : ’Chart’;
Any suggestions for handling the data series? TV, external CSV? I actually do not have a real world use for it, so I am guessing how most people would want to implement it.
DropboxUploader -- Upload files to a Dropbox account.
DIG -- Dynamic Image Generator
gus -- Google URL Shortener
makeQR -- Uses google chart api to make QR codes.
MODxTweeter -- Update your twitter status on publish.
It says in there that you can cache in two ways... and you can do both at the same time (one after the other)...
# // Render the graph
# $Cache->WriteToCache("Graph1",$DataSet->GetData(),$Test);
# $Test->Stroke();
In the first line you explicitly sent the graph to the cache....
In the second it is sent to the browser, as you mentioned...
also:
Today there is two rendering methods in pChart :
- Stroke() : This will send the picture to the user browser
- Render($FileName) : this will save the pic to the disk
You can use this two calls to send the picture to the user browser and then use the file to generate PDF stuff (I’m doing that)
Website: www.mercologia.com
MODX Revo Tutorials: www.modxperience.com
MODX Professional Partner