for a project I need to display the same chart with different data at the same time. The data is read from database.
Because of using the same graphs I don`t want to make an extra file for each graph.
So my Idea is to put the code of the graph to a funtion and pass the necessary arguments, like the arrays got by the sql-statements.
function setLineGraph ($array1...){
//includes...
//Graph code
//draw graph
$myPicture->stroke();
}
With "img src="LineGraph.php" - File which contains the code, graph is shown.
Due to simplicity I`ve just hardcoded the values, so see if the function shows the graph.
So when calling it in php:
include 'Filename.php'
setLineGraph();
the error "Graphic could not be diplayed, it has failures" appears in the browser.
On http://wiki.pchart.net/doc.faq.script.output.html, there is written:
Calling the Stroke() method in your script will automatically send the ‘Content-type: image/png‘ header to the user web browser and the raw picture in the HTTP GET data field.
I have searched quite a couple of hours, but didn`t find anything to solve the problem.
Do you have any ideas how to get/ access the graph?