2

I need simple php library for drawing charts, but one that renders direct from php and make me jpg (or png) file on webserver with no use of javascript or flash. I tried pChart and it is nice but it uses javascript for rendering so it is useless for me. Also I don't want to use API of any kind, that will communicate with some services or servers. I need it drawn all by php.

S S
  • 987
  • 1
  • 9
  • 20
  • See this question and answer: http://stackoverflow.com/questions/13319806/create-pie-chart-from-php-using-mysql-table – random_user_name Jul 12 '13 at 22:05
  • This is off-topic question. – Mike Brant Jul 12 '13 at 22:07
  • This is a good question but you should rephrase it or it will be shut down. – JSON Jul 12 '13 at 22:17
  • Specifically, if you've searched other sources you've presumably seen available solutions. What specifically is wrong with existing server-side (php) solutions that you've found? – JSON Jul 12 '13 at 22:21
  • @cale_b thanks! Here is the answer if someone bump in this thread. [link](http://stackoverflow.com/questions/6785952/how-do-i-save-an-image-created-by-pchart-to-a-file) – S S Jul 12 '13 at 23:02
  • here it is again not hyperlinked http://stackoverflow.com/questions/6785952/how-do-i-save-an-image-created-by-pchart-to-a-file – S S Jul 12 '13 at 23:03

1 Answers1

0

Here is your solution: http://wiki.pchart.net/

Example:

<?php
 include("../class/pDraw.class.php"); 
 include("../class/pImage.class.php"); 
 include("../class/pData.class.php");

 /* Create your dataset object */ 
 $myData = new pData(); 
 
 /* Add data in your dataset */ 
 $myData->addPoints(array(1,3,4,3,5));

 /* Create a pChart object and associate your dataset */ 
 $myPicture = new pImage(700,230,$myData);

 /* Choose a nice font */
 $myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11));

 /* Define the boundaries of the graph area */
 $myPicture->setGraphArea(60,40,670,190);

 /* Draw the scale, keep everything automatic */ 
 $myPicture->drawScale();

 /* Draw the scale, keep everything automatic */ 
 $myPicture->drawSplineChart();

 /* Render the picture (choose the best way) */
 $myPicture->autoOutput("pictures/example.basic.png");
?>