pChart 2.x forum
http://wiki.pchart.net/forum/

More than one chart into a website
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=2340
Page 1 of 1

Author:  daniel.fusco [ Wed Feb 01, 2012 12:46 pm ]
Post subject:  More than one chart into a website

Hi,

How can I do to display more than on chart into a website?

Best regards.

Daniel.

Author:  daniel.fusco [ Thu Feb 02, 2012 12:34 pm ]
Post subject:  Re: More than one chart into a website

on = one

Author:  marsman [ Wed Jul 18, 2012 4:18 pm ]
Post subject:  Re: More than one chart into a website

I've got the same problem. I need to create round about 10 different chars on one HTML page.

It works if you have different files (chart1.php, chart2.php) and call them in the image tag of your HTML code like this:
Code:
<img alt="" src="chart1.php" />


The main problem with this is. If you have to fetch different data from a database you have to do that in each of the chart*.php files which is bad, ugly and finally slow.
So the better option is get all the data you need for all charts, put the data into different arrays and access those arrays in one or more well functions I would say.
The problem is this is what I currently can't get to work. :(

If I use a normal PHP functions like lets say renderChart1($myChartTitle, $myChartDataX,$myChartDataY,...) of my initial buildPage() function (here the SQL stuff fetches the data) at my chart_generator.php class to create the chart.
Then I'll get the binary image data which is displayed in my HTML code when I call the functions at my '<img alt="" src="'.renderChart1(...parameters...).'" />' string creation. HTML-String creation is the problem here. The image will be interpreted as text as it is concated into the image src.
This I don't want. ;)
So how do I do it the "correct" way?
Storing the data in _SESSION scope and access the arrays then from another chart1.php file?

The charts will be different for each user (and once additional data is available the old one is also of no use) so the pCache isn't going to help. I could write the image to the filesystem but is this cleaned up?

Sorry, I'm normally develop applications in other languages (like Java, C#,...). PHP had to be used because of LimeSurvey where I replaced the original pChart v1.x version with the new pChart v2.x library. I need it for some very special charts.

Some hints seem to be in this thread: viewtopic.php?f=1&t=29357

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/