我需要简单的php库来绘制图表,但是直接从php渲染并在webserver 上制作jpg(或png)文件而不使用javascript或flash。我尝试了pChart,它很好,但它使用javascript进行渲染,所以对我来说没用。此外,我不想使用任何类型的API,它将与某些服务或服务器通信。我需要它全部用php绘制。
答案 0 :(得分:0)
以下是您的解决方案:http://wiki.pchart.net/
示例:
<?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");
?>