open-free-chart 1.9.6测试

本文介绍了一个使用OpenFlashChart 1.9.6版本实现的多数据线图表示例,通过PHP生成随机数据并展示不同类型的线条,包括常规线、带点线和空心线,并设置了自定义的X轴和Y轴标签。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.测试对象open-free-chart 1.9.6
2.展示页
<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object( 500, 250, 'http://'. $_SERVER['SERVER_NAME'] .'/1.9.6/data-13u.php', false );
?>


3.数据页
<?php


// generate some random data
srand((double)microtime()*1000000);


//
// NOTE: how we are filling 3 arrays full of data,
//       one for each line on the graph
//
$data_1 = array();
$data_2 = array();
$data_3 = array();
for( $i=0; $i<12; $i++ )
{
  $data_1[] = rand(14,19);
  $data_2[] = rand(8,13);
  $data_3[] = rand(1,7);
}


include_once( 'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->title( 'Many data lines测试', '{font-size: 20px; color: #736AFF}' );


// we add 3 sets of data:
$g->set_data( $data_1 );
$g->set_data( $data_2 );
$g->set_data( $data_3 );


// we add the 3 line types and key labels
$g->line( 2, '0x9933CC', 'Page views', 10 );
$g->line_dot( 3, 5, '0xCC3399', 'Downloads', 10);    // <-- 3px thick + dots
$g->line_hollow( 2, 4, '0x80a033', 'Bounces', 10 );


$g->set_x_labels( array( 'January','February','March','April','May','June','July','August','Spetember','October','November','December' ) );
$g->set_x_label_style( 10, '0x000000', 0, 2 );


$g->set_y_max( 20 );
$g->y_label_steps( 4 );
$g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
echo $g->render();
?>


4.中文乱码解决方法
展示页和代码页的文件存储格式统一使用utf-8后

展示页标题的中文正常

5.效果


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值