无为清净楼资源网 Design By www.qnjia.com
1.openflashchart是一种比较实用的图标呈现插件,而且是开源的,网址http://teethgrinder.co.uk/open-flash-chart/

2.FlashChart类
复制代码 代码如下:
FlashChart Class Code

class FlashChart
{
private $id;
private $height;
private $width;
private $path;
function __construct($path="",$width=300,$height=500,$id="myChart")
{
global $flash_chart;
$this->id=$id;
$this->height=$height;
$this->width=$width;
$this->path=$path;
if(!$flash_chart)
{
echo '<script type="text/javascript" src="/UploadFiles/2021-04-02/json2.js">echo '<script type="text/javascript" src="/UploadFiles/2021-04-02/swfobject.js">echo '<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.4.4.min.js">$flash_chart=true;
}
}

function __destruct()
{
unset($this->id,$this->height,$this->width,$this->path);
}
function setID($id)
{
$this->id=$id;
}
function setChart($file,$info)
{
$tp=new TemplateData($file);
echo '<script type="text/javascript">';
echo "data_{$this->id}=".$tp->changeInfo($info).';';
echo "function ofc_get_dataOf{$this->id}(){return JSON.stringify(data_{$this->id});}";
echo "swfobject.embedSWF('".$this->path."/open-flash-chart.swf', '$this->id', '$this->width','$this->height','9.0.0','expressInstall.swf',{'get-data':'ofc_get_dataOf{$this->id}'} )";
echo '</script>';
}
}

3,TemplateData类

把一个简单的图标的配置从已经写好的txt文本里取出来加载所用的类 :例如
复制代码 代码如下:
{
"title":
{
"text":"(title)",
"style":"{color:#FF0000;font-size:24px;}"
},
"y_legend":{
"text": "iWebShop",
"style": "{color: #736AFF;font-size:16px;}"
},

"elements":[
{
"type": "line",
"colour": "#736AFF",
"text": "注册用户量(人)",
"width": 1,
"dot-style": {
"type":"solid-dot", "colour":"#a44a80", "dot-size": 3,
"tip":"#val#人<br>#x_label#" },
"on-show": {"type": "shrink-in", "cascade":1, "delay":0.5},
"values" : [(numbers)]
}
],

"x_axis":{
"labels": {
"labels":[(dates)]
}
},

"y_axis":{
"steps": (steps),
"max": (max)
}
}

这是类的内容:
复制代码 代码如下:


class TemplateData
{
public $substitution;
private $templateFile;
function __construct($filename)
{
$this->templateFile=@file_get_contents($filename) or die("not find templateFile");
}
function __destruct() {
unset ($this->templateFile,$this->substitution);
}
function setTemplateFile($tfile)
{
$this->templateFile=$tfile;
}
function getTemplateFile()
{
return $this->templateFile;
}
function replaceReal($matches)
{
extract($this->substitution, EXTR_OVERWRITE);
return isset($$matches[1])?$$matches[1]:$matches[1];
}
function changeInfo($subs)
{
$this->substitution=$subs;
return preg_replace_callback("(\((\w+)\))",array(&$this, 'replaceReal'),$this->getTemplateFile());
}

}

4,调用的代码
复制代码 代码如下:

<!--//这里的myChat是显示flash的地方,所以不能为空,改动的话要在声明FlashChart类的时候定义,详细见FlashChart类-->
<div class='content_box'><div id="myChart"></div></div>

<?php
include("flashchart.php");
include("templatedata.php");
$fc=new FlashChart('chart/',"100%",320);
$infos=array(
'numbers'=>"30000,10000,5000,6000000,700",
'dates'=>"\"字符串1\",\"字符串2\",\"字符串3\",\"字符串4\",\"字符串5\"",
'steps'=>600000,
'max'=>6000000
);
$info=array("title"=>'用户注册统计','numbers'=>$infos['numbers'],'dates'=>$infos['dates'],'steps'=>$infos['steps'],'max'=>$infos['max']);
$fc->setChart("chart/templatechart/user-add.txt",$info);

5,还有一个处理数据的函数,把查询出来的数据集转换成ofc用的数据

复制代码 代码如下:


/**
* @brief ofc数据处理
* @params 数据库查询出关于x,y轴的数据的数据集
* @note 后台
*/
/*
public function init_count($rs)
{

$numbers ='';
$dates = '';
$max = 0;
foreach($rs as $row)
{

$numbers .= $row['num'].',';//y轴数据
$dates .='"'.$row['month'].'",';//x轴数据
if($max<$row['num']) $max = $row['num'];
}
$steps=ceil($max/10);
$result= array(
'steps' => $steps,
'numbers' => strlen($numbers)>1 ? substr($numbers,0,-1):null,
'dates' => strlen($dates)>1 ? substr($dates,0,-1) : null,
'max' => $max+$steps
);
return $result;
}
标签:
openflashchart

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。