|
|
|
Pie Charts |
|
|
Line & Bar Graphs |
|
|
Support |
|
|
|
Pie Chart PHP Examples |
|
These snippets of PHP are all you need to create pie charts. If you paste one of these examples into a PHP file called mypie.php,
you can go straight to the URL of that script to see the pie chart
in your web browser, or you can embed the image in an HTML page just like any other image: |
|
<img src="mypie.php" width="500" height="400" />
|
|
Pie chart using default style |
|
<?php
include( 'chartlogix.inc.php' );
$pie = new PieChart();
$pie->setTitle( "ChartLogix Pie Chart" );
$pie->addData( 'Bananas', 420, 'FFCC00' );
$pie->addData( 'Apples', 400, '99FF00' );
$pie->addData( 'Strawberries', 210, 'FF6666' );
$pie->addData( 'Grapes', 350, '009900' );
$pie->addData( 'Plums', 100, '9900CC' );
$pie->addData( 'Others', 190, 'AAAAAA' );
$pie->drawPNG( 500, 400 );
|
|
|
|
|
Pie chart with a variety of customisations |
|
<?php
include( 'chartlogix.inc.php' );
$pie = new PieChart();
//---- THE STYLE
$pie->setBackground( 'EEEEFF', 'DDDDEE' );
$pie->setPadding( 20 );
$pie->setTitleStyle( 'arial.ttf', 15, '000000' );
$pie->setTitlePosition( 0, 0 );
$pie->setLegendWidth( 40.00 );
$pie->setLegendTextStyle( 'arial.ttf', 12, 'FFFFFF', 10 );
$pie->setLegendKeyStyle( 12, 5 );
$pie->setLegendBoxStyle( '333366', '000000', 10 );
$pie->setLegendPosition( 1, 0 );
$pie->set3DEdgeStyle( 20, 50, false );
$pie->setHoleSize( 40 );
//---- THE DATA
$pie->setTitle( 'ChartLogix Pie Chart' );
$pie->addData( 'Apples', 593, '99FF00' );
$pie->addData( 'Strawberries', 581, 'FF6600' );
$pie->addData( 'Plums', 395, '9900CC' );
$pie->addData( 'Bananas', 332, 'FFCC00' );
$pie->addData( 'Grapes', 176, '009900' );
$pie->addData( 'Others', 300, 'AAAAAA' );
//---- DRAW PNG
$pie->drawPNG( 500, 400 );
|
|
|
|
|
|
Next Steps |
|
The Pie Chart Designer allows you to interactively customise a pie chart and see the PHP code. |
|
Buy ChartLogix now to start using it on your own web sites. |
|
|