show me an example of pChart
时间: 2024-05-06 12:15:53 浏览: 17
Sure, here's a simple example of how to create a bar chart using pChart:
```php
// Include the pChart library
require_once('pchart/class/pData.class.php');
require_once('pchart/class/pDraw.class.php');
require_once('pchart/class/pImage.class.php');
// Create a new pData object and add some data
$data = new pData();
$data->addPoints(array(5, 10, 15, 20, 25), "Data");
$data->setAxisName(0, "X Axis");
$data->setAxisName(1, "Y Axis");
// Create a new pChart object and set some properties
$chart = new pImage(400, 300, $data);
$chart->setFontProperties(array("FontName" => "pchart/fonts/verdana.ttf", "FontSize" => 10));
$chart->setGraphArea(50, 30, 350, 250);
$chart->drawScale();
$chart->drawBarChart();
// Output the chart as an image
header("Content-Type: image/png");
$chart->Render();
```
This code will create a bar chart with the data points `5, 10, 15, 20, 25`. You can customize the chart by modifying the properties of the `pData` and `pImage` objects.