MySQL Forums
Forum List  »  PHP

PHP Charts
Posted by: freddie
Date: May 12, 2005 11:33AM

Hi,

I am using a PHP/SWF charting tool i found on the internet. The tool looks fantastic but i need to be able to customise it to display my own data.

This is the code i am using to include a chart:
<?php
include "charts.php";
echo InsertChart ( "charts.swf", "industrybreakdown.php", 400, 280 , "FFFFFF", false );
?>

and this is the data in the industrybreakdown.php file:

<?php
include 'charts.php';

$chart[ 'chart_bg' ] = array ( 'positive_alpha'=>0 );
$chart[ 'chart_data' ] = array ( array ( '', '2001', '2002', '2003','2004'), array ( '', 15, 27,45,60 ) );
$chart[ 'chart_grid_h' ] = array ( 'thickness'=>0 );
$chart[ 'chart_rect' ] = array ( 'x'=>50, 'y'=>50, 'width'=>300, 'height'=>200 );
$chart[ 'chart_type' ] = '3d pie';
$chart[ 'chart_value' ] = array ( 'color'=>'000000', 'alpha'=>65, 'font'=>'arial', 'bold'=>true, 'size'=>10, 'position'=>'inside', 'prefix'=>'',

'suffix'=>'', 'decimals'=>0, 'separator'=>'', 'as_percentage'=>true );

$chart[ 'draw_text' ] = array ( array ( 'color'=>'000000', 'alpha'=>4, 'font'=>'arial', 'rotation'=>0, 'bold'=>true, 'size'=>40, 'x'=>50, 'y'=>260,

'width'=>300, 'height'=>50, 'text'=>'56789012345678901234', 'h_align'=>'center', 'v_align'=>'middle' )) ;

$chart[ 'legend_bg' ] = array ( 'bg_color'=>'44aaff', 'bg_alpha'=>10, 'border_color'=>'000000', 'border_alpha'=>0, 'border_thickness'=>0 );
$chart[ 'legend_label' ] = array ( 'layout'=>'horizontal', 'bullet'=>'circle', 'font'=>'arial', 'bold'=>true, 'size'=>12, 'color'=>'44aaff', 'alpha'=>85 );
$chart[ 'legend_rect' ] = array ( 'x'=>0, 'y'=>45, 'width'=>50, 'height'=>210, 'margin'=>10 );

$chart[ 'series_color' ] = array ( '00ff88', 'ffaa00','44aaff', 'aa00ff' );
$chart[ 'series_explode' ] = array ( 25, 75, 0, 0 );

SendChartData ( $chart );
?>


How would i go about changing the data in this file based on my database? If someone can tell me how i include this code inside the document with the chart in, i should easily be able to do it. I.e. how do i adjust the first bit of code: "industrybreakdown.php" to include PHP code in the same document.

Thanks in advance.

Options: ReplyQuote


Subject
Written By
Posted
PHP Charts
May 12, 2005 11:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.