php flash chart,open flash chart使用

燕扬
2023-12-01

1.图表显示的位置

2.用js去请求数据

function onload_bar(){

var so_order_num = new SWFObject("/open-flash-chart/actionscript/open-flash-chart.swf", "ofc", "1020", "500", "9", "#FFFFFF");

so_order_num.addVariable("data", "/console/get-order-num/start_date/"+$("#start_date_2").val()+"/end_date/"+$("#end_date_2").val()+"/type/"+$("#type").val());

so_order_num.addParam("allowScriptAccess", "always" );

so_order_num.addParam("wmode", "transparent" );

so_order_num.write("pic_order_num");

}

3.php文件反回图表

$data =(二维数据(array(array("a"=>a,"b"=>2),array("a"=>kdk,"b"=>33))))

foreach ($data as $d){

switch ($type) {

case "week":

$m = explode("*",$d['a']);

$a[] = $m[0]."第".$m[1]."周";

break;

case "quarier":

$m = explode("*",$d['a']);

$a[] = $m[0]."第".$m[1]."季度";

break;

default:

$a[] = $d['a'];

}

$b[]=$d['b'];

if((int)$d['b']>$max){

$max=(int)$d['b'];

}

}

include_once( 'open-flash-chart/php-ofc-library/open-flash-chart.php' );

$g = new graph();

$g->title( '采购单数趋势图', '{font-size:14px; color: #d01f3c;}' );

$g->set_data($b);

//填充阴影

$g->area_hollow( 2, 3, 25, '#CC3399' );

$g->set_x_labels( $a );

$g->set_x_label_style( 10, '#9933CC', 2, 1 );

$g->set_x_axis_steps( 2 );

$g->set_y_max(0);

$g->set_y_max($max+(10-($max%10)));

$g->y_label_steps(10);

$g->set_tool_tip( '日期: #x_label#
订单数: #val#' );

echo  $g->render();

这样就可以了。

 类似资料: