开源方便的PHP & Flash图表:Open Flash Chart

基本用法

HTML文件

<html>
<head>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"300", "350", "9.0.0", "expressInstall.swf",
{"data-file":"radar-chart.php"} );
</script>
</head>
<body>
<div id="my_chart"></div>
</body>
</html>

radar-chart.php

<?php

include '../php-ofc-library/open-flash-chart.php';

// 创建画布
$chart = new open_flash_chart();
$chart->set_title( new title( 'Charles' ) );

$area = new area_hollow();

$area->set_width( 1 );
$area->set_dot_size( 3 );
$area->set_halo_size( 1 );
$area->set_colour( '#FA341F' );

$area->set_fill_colour( '#FE7903' );
$area->set_fill_alpha( 0.4 );
$area->set_loop();

// 设置要显示的值
$v1 = 10/20;
$v2 = 35/20;
$v3 = 40/20;
$v4 = 55/20;
$v5 = 90/20;
$area->set_values(array($v1, $v2, $v3, $v4, $v5));

$chart->add_element( $area );

// 设置背景显示的网格数
$r = new radar_axis( 5 );

$r->set_colour( '#BEBEBE' ); // 设置延伸线颜色
$r->set_grid_colour( '#D0D0D0' ); // 设置网格线颜色

$labels = new radar_axis_labels( array('0','10','20','40','50','100') );
$labels->set_colour( '#9F819F' );
$r->set_labels( $labels );

$chart->set_radar_axis( $r );

$tooltip = new tooltip();
$tooltip->set_proximity('a','b','c','d','e');
$chart->set_tooltip( $tooltip );

$chart->set_bg_colour( '#FFFFFF' );

echo $chart->toPrettyString();
?>

官方网站:http://teethgrinder.co.uk/open-flash-chart/index.php
下载网址:http://teethgrinder.co.uk/open-flash-chart/download.php
以下效果图是我截取Flash截图,要查看更多效果可以去官方网站。这么好的工具,非常方便我们绘制各种图表啦。。。

相应其他类似的还有:
PHP/SWF Charts: http://www.maani.us/charts/index.php
FusionCharts Freehttp://www.fusioncharts.com/free/Default.asp

posted @ 2011-07-20 18:28  科学家会武术  阅读(483)  评论(0编辑  收藏  举报