龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

利用open flash chart生成图表

时间:2014-07-22 14:52来源: 作者: 点击:
分享到:
利用open flash chart生成图表 访问方式:a href=http://127.0.0.1/chart/chart.html?ofc=data.phphttp://127.0.0.1/chart/chart.html?ofc=data.php/a
利用open flash chart生成图表   访问方式:  http://127.0.0.1/chart/chart.html?ofc=data.php
<html>
<head>

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("open-flash-chart.swf", "my_chart", "300", "200", "9.0.0");
</script>
 
</head>
<body style="text-align:center">
<p>Hello World</p>
<div id="my_chart"></div>
</body>

4. [代码]data.php     跳至 [3] [4] [全屏预览]

<?php
require_once('OFC/OFC_Chart.php');

$title = new OFC_Elements_Title( '我的第一表:'.date("D M d Y") );
 
$line_dot = new OFC_Charts_Line();

$line_dot->set_values( array(6,2,7,8,10,12,7,6,5,12,10,9,11,4,3,2,1) );

$line_dot->set_colour('#D7E4A3');

$line_dot1 = new OFC_Charts_Line();

$line_dot1->set_values( array(2,4,6,8,11,9,12,8,10,6,15,14,8,7,6,8,9,2,1) );

$chart = new OFC_Chart();

$chart->set_title( $title );

$x=new OFC_Elements_Axis_X();

$x->set_offset(false);

$x->set_steps(1);

$x->set_colour( '#A2ACBA');

$x->set_range(0,20,1);

$y=new OFC_Elements_Axis_Y();

$y->set_range(0,16,1);

$y->set_steps(1);

$y->set_colour( '#A2ACBA');

$chart->set_x_axis($x);

$chart->set_y_axis($y);

$chart->add_element( $line_dot );

$chart->add_element( $line_dot1 );

echo $chart->toPrettyString();
?>

精彩图集

赞助商链接