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 '';
echo '';
echo '';
$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 '';
}
}
复制代码 代码如下:
{
"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#人
#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());
}
}
复制代码 代码如下:
コードをコピーしますは次のとおりです:
/**
* @brief ofc データ処理
* @params データベースは、X、Y 軸データに関するデータセットをクエリします
* @note 背景
*/
/*
public function init_count($rs )
{
$numbers = '';
$dates = '';
foreach($rs as $row)
{
$numbers .= $row['num'].',';//y 軸データ
$dates .='"'.$row['month'].'",'; //x 軸データif($max$steps=ceil($max/10); (
'steps' => $steps,
'numbers' => strlen($numbers)>1 ? substr($numbers,0,-1):null ,
'dates' => strlen($dates)>1 ? substr($dates,0,-1) : null,
'max' => $max $steps
);
}