php4.0 中怎么做对比统计图? Pls read the GD functions in PHP manual. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 JpGraphhttp://www.aditus.nu/jpgraph/jpdownload.php <?phprequire_once("init.php");// ListForm設定require_once('form/ReportForm.php');$report = new ReportForm( $smarty );if ( $report->validate() ) { $item = $report->exportValues(); $renderer =& new HTML_QuickForm_Renderer_ArraySmarty( $smarty ); //初期値 $report->setDefaults($item); $report->accept( $renderer ); $smarty->assign( 'list', $renderer->toArray() ); $sql = " avg(cust_emo_level) as cust_emo_level,"; $sql .= "avg(comm_emo_level) as comm_emo_level, "; $sql .= "avg(cust_emo_transit) as cust_emo_transit, "; $sql .= "avg(comm_emo_transit) as comm_emo_transit, "; $sql .= "avg(totaltime) as totaltime, "; $sql .= "sum(totaltime) as alltime, "; $sql .= "count(*) as count "; //データ取得 $db = DB_Factory::create( 'callhistory' ); $db->setSelect($sql); Tools::setWhere($db,$item); $dball = DB_Factory::create( 'callhistory' ); $dball->setSelect($sql); //感情解析結果 $dball->addWhere(" resultcode_cust = ?" ,0); $dball->addWhere(" resultcode_comm = ?" ,0); $dball->addWhere(" analysised = ?" ,1); $rows = $db->getAll(); $allrows = $dball->getAll(); $row = $rows[0]; $allrow = $allrows[0]; if($allrow['cust_emo_level'] < 0){ $allrow['cust_emo_level1'] = -1 *$allrow['cust_emo_level']; } if($allrow['comm_emo_level'] < 0){ $allrow['comm_emo_level1'] = -1 *$allrow['comm_emo_level']; } if($allrow['cust_emo_transit'] < 0){ $allrow['cust_emo_transit1'] = -1 * $allrow['cust_emo_transit']; } if($allrow['comm_emo_transit'] < 0){ $allrow['comm_emo_transit1'] = -1 * $allrow['comm_emo_transit']; } $smarty->assign("total",$allrow); if($row['cust_emo_level'] < 0){ $row['cust_emo_level1'] = -1 *$row['cust_emo_level']; } if($row['comm_emo_level'] < 0){ $row['comm_emo_level1'] = -1 *$row['comm_emo_level']; } if($row['cust_emo_transit'] < 0){ $row['cust_emo_transit1'] = -1 * $row['cust_emo_transit']; } if($row['comm_emo_transit'] < 0){ $row['comm_emo_transit1'] = -1 * $row['comm_emo_transit']; } $smarty->assign("some",$row); //抽出 お客様 $db = DB_Factory::create( 'callhistory' ); $db->setSelect("count(*) as count,cust_emo_level as level"); Tools::setWhere($db,$item); $db->setOrder(" cust_emo_level desc"); $db->setGroup(" cust_emo_level "); $rows = $db->getAll(); $data = Tools::getData($rows); //抽出 コミュニケータ $db = DB_Factory::create( 'callhistory' ); $db->setSelect("count(*) as count,comm_emo_level as level"); Tools::setWhere($db,$item); $db->setOrder(" comm_emo_level desc"); $db->setGroup(" comm_emo_level "); $rows = $db->getAll(); $data1 = Tools::getData($rows); if (Tools::sum($data) != 0 && Tools::sum($data1) != 0){ $smarty->assign("file1", Tools::createGraph($data,$data1,'お客様','コミュニケータ')); } //全部 お客様 $db = DB_Factory::create( 'callhistory' ); $db->setSelect("count(*) as count,cust_emo_level as level"); $db->setOrder(" cust_emo_level desc"); $db->setGroup(" cust_emo_level "); //感情解析結果 $db->addWhere(" resultcode_cust = ?" ,0); $db->addWhere(" resultcode_comm = ?" ,0); $db->addWhere(" analysised = ?" ,1); $rows = $db->getAll(); $data = Tools::getData($rows); //全部 コミュニケータ $db = DB_Factory::create( 'callhistory' ); $db->setSelect("count(*) as count,comm_emo_level as level"); $db->setOrder(" comm_emo_level desc"); $db->setGroup(" comm_emo_level "); //感情解析結果 $db->addWhere(" resultcode_cust = ?" ,0); $db->addWhere(" resultcode_comm = ?" ,0); $db->addWhere(" analysised = ?" ,1); $rows = $db->getAll(); $data1 = Tools::getData($rows); if (Tools::sum($data) != 0 && Tools::sum($data1) != 0){ $smarty->assign("file3", Tools::createGraph($data,$data1,'お客様','コミュニケータ')); } $smarty->assign("add","+"); $smarty->display( './report.html' );} else { //セッションクリア $renderer =& new HTML_QuickForm_Renderer_ArraySmarty( $smarty ); //初期値 list($syear,$smonth,$sday) = split('-',date('Y-m-d')); $item = array("syear" => $syear, "smonth" => $smonth, "sday" => $sday, "eyear" => $syear, "emonth" => $smonth, "eday" => $sday ); $report->setDefaults($item); $report->accept( $renderer ); $smarty->assign( 'list', $renderer->toArray() ); $smarty->assign("add","+"); $smarty->display( './report.html' );}?> 5楼那个提供程序的高人,程序是你自己作的吗?那能不能再提供一下你爱的两个require_once()中的源程序来看看,里面用了不少的::调用,要不然你叫别人咋看懂? <?php//by sunj 2006/02/19if(isset($_REQUEST['sessionid'])){ session_id($_REQUEST['sessionid']);}//by sunj 2006/02/19// sessionsession_start();require_once( 'config.php' );// set headerheader('Content-Type: text/html; charset=shift_jis');// load util classrequire_once( 'Var_Dump.php' );// initialize Smartyrequire_once( 'Smarty.class.php' );$smarty = new Smarty;$smarty->template_dir = APP_HOME. '/smarty/templates/';$smarty->compile_dir = APP_HOME. '/smarty/templates_c/';$smarty->config_dir = APP_HOME. '/smarty/configs/';$smarty->cache_dir = APP_HOME. '/smarty/cache/';require_once( 'util/InitLoad.php' );$util = new InitLoad($smarty);$smarty->assign( 'util', $util );require_once( 'util/Constant.php' );$cons = new Constant($smarty);$smarty->assign( 'cons', $cons );$smarty->assign( 'word1', "閲覧ユーザー" );$smarty->assign( 'pagercount', PAGE_COUNT );// initialize DBrequire_once( 'DB_Factory.php' );DB_Factory::initialize(DSN);// check loginif ( empty( $_SESSION[ 'LOGIN' ] ) ) { if ( preg_match( '/^\/member\//', $_SERVER[ 'PHP_SELF' ] ) ) { // メンバー領域にアクセス require_once( 'HTTP.php' ); HTTP::redirect( '/index.php' ); }else{ }}require_once "HTML/QuickForm.php"; require_once "util/Tools.php"; require_once "HTML/QuickForm/Renderer/ArraySmarty.php"; ?>这个是init.php <?phprequire_once( 'BaseForm.php' );class ReportForm extends BaseForm { public function __construct ( &$smarty ) { parent::__construct( $smarty, 'form3' ); //期間 $this->addElement( 'select', 'syear', '', $this->getYear(),$this->listattr); $this->addElement( 'select', 'smonth', '', $this->getMonth(),$this->listattr); $this->addElement( 'select', 'sday', '', $this->getDay(),$this->listattr); $this->addElement( 'select', 'eyear', '', $this->getYear(),$this->listattr); $this->addElement( 'select', 'emonth', '', $this->getMonth(),$this->listattr); $this->addElement( 'select', 'eday', '', $this->getDay(),$this->listattr); //通話開始時間 $this->addElement( 'select', 'shour', '', $this->getHour(),$this->listattr); $this->addElement( 'select', 'smin', '', $this->getMin(),$this->listattr); $this->addElement( 'select', 'ehour', '', $this->getHour(),$this->listattr); $this->addElement( 'select', 'emin', '', $this->getMin(),$this->listattr); //通話時間 $this->addElement( 'select', 'totaltime', '', $this->getTime(),$this->listattr); $this->addElement( 'select', 'timelevel', '', $this->getLevel(),$this->listattr); //GROUP require_once("util/Tools.php");// $this->addElement('select','group_id','',Tools::getGroup(),$this->listattr); //$this->addElement('select','group_id','',Tools::getGroup(),$this->listattr); //お客様電話番号 $this->addElement('text','customerid','',$this->callerattr); //IN/OUT $this->addElement('select','calldirection','',Tools::getCallDirection(),$this->listattr); //GENRE $this->addElement('select','genre_id','',Tools::getGenre(),$this->listattr); //ID $this->addElement('select','id','',Tools::getID(),$this->listattr); $this->addElement('text','idvalue','',$this->listattr); $this->addElement('text','name','',$this->listattr); //感情レベル $this->addElement('select','cust_emo_level','',Tools::getEmoLevel(),$this->listattr); $this->addElement('select','cust_emo_level_no','',$this->getEmoLevel(),$this->listattr); $this->addElement('select','comm_emo_level','',Tools::getEmoLevel(),$this->listattr); $this->addElement('select','comm_emo_level_no','',$this->getEmoLevel(),$this->listattr); $this->addElement('select','cust_emo_transit','',Tools::getEmoLevel(),$this->listattr); $this->addElement('select','cust_emo_transit_no','',$this->getEmoLevel(),$this->listattr); $this->addElement('select','comm_emo_transit','',Tools::getEmoLevel(),$this->listattr); $this->addElement('select','comm_emo_transit_no','',$this->getEmoLevel(),$this->listattr); //タグ 1 2 3 $this->addElement('text','tag1','',$this->tagattr); $this->addElement('select','tag1level','',$this->getEmoLevel(),$this->listattr); $this->addElement('text','tag2','',$this->tagattr); $this->addElement('select','tag2level','',$this->getEmoLevel(),$this->listattr); $this->addElement('text','tag3','',$this->tagattr); $this->addElement('select','tag3level','',$this->getEmoLevel(),$this->listattr); } }?>这个是ReportForm.php JpGraph 这个库还是挺好用的,可以用做参考.如果嫌大,也可以到网上找些别人写好的类. 同意楼上。搜一下JpGraph用吧。就是大了点,但是很全。 替换html标签怎么办? php分页 php与js结合应用 高分!PHP网页抓取的问题 急求 急急急???为什么提交php表单时得不到数据? apach php 的配置问题 php到底好在哪? 求PHP的简易论坛代码 求大神!!!解决! php 向sqlerver datetime类型插入数据 寻求业余打工机会~~~~ 新人问题,关于包含文件!
http://www.aditus.nu/jpgraph/jpdownload.php
require_once('form/ReportForm.php');
$report = new ReportForm( $smarty );if ( $report->validate() ) {
$item = $report->exportValues();
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty( $smarty );
//初期値
$report->setDefaults($item);
$report->accept( $renderer );
$smarty->assign( 'list', $renderer->toArray() ); $sql = " avg(cust_emo_level) as cust_emo_level,";
$sql .= "avg(comm_emo_level) as comm_emo_level, ";
$sql .= "avg(cust_emo_transit) as cust_emo_transit, ";
$sql .= "avg(comm_emo_transit) as comm_emo_transit, ";
$sql .= "avg(totaltime) as totaltime, ";
$sql .= "sum(totaltime) as alltime, ";
$sql .= "count(*) as count "; //データ取得
$db = DB_Factory::create( 'callhistory' );
$db->setSelect($sql);
Tools::setWhere($db,$item);
$dball = DB_Factory::create( 'callhistory' );
$dball->setSelect($sql);
//感情解析結果
$dball->addWhere(" resultcode_cust = ?" ,0);
$dball->addWhere(" resultcode_comm = ?" ,0);
$dball->addWhere(" analysised = ?" ,1);
$rows = $db->getAll();
$allrows = $dball->getAll();
$row = $rows[0];
$allrow = $allrows[0]; if($allrow['cust_emo_level'] < 0){
$allrow['cust_emo_level1'] = -1 *$allrow['cust_emo_level'];
}
if($allrow['comm_emo_level'] < 0){
$allrow['comm_emo_level1'] = -1 *$allrow['comm_emo_level'];
}
if($allrow['cust_emo_transit'] < 0){
$allrow['cust_emo_transit1'] = -1 * $allrow['cust_emo_transit'];
}
if($allrow['comm_emo_transit'] < 0){
$allrow['comm_emo_transit1'] = -1 * $allrow['comm_emo_transit'];
}
$smarty->assign("total",$allrow);
if($row['cust_emo_level'] < 0){
$row['cust_emo_level1'] = -1 *$row['cust_emo_level'];
}
if($row['comm_emo_level'] < 0){
$row['comm_emo_level1'] = -1 *$row['comm_emo_level'];
}
if($row['cust_emo_transit'] < 0){
$row['cust_emo_transit1'] = -1 * $row['cust_emo_transit'];
}
if($row['comm_emo_transit'] < 0){
$row['comm_emo_transit1'] = -1 * $row['comm_emo_transit'];
}
$smarty->assign("some",$row);
//抽出 お客様
$db = DB_Factory::create( 'callhistory' );
$db->setSelect("count(*) as count,cust_emo_level as level");
Tools::setWhere($db,$item);
$db->setOrder(" cust_emo_level desc");
$db->setGroup(" cust_emo_level ");
$rows = $db->getAll();
$data = Tools::getData($rows); //抽出 コミュニケータ
$db = DB_Factory::create( 'callhistory' );
$db->setSelect("count(*) as count,comm_emo_level as level");
Tools::setWhere($db,$item);
$db->setOrder(" comm_emo_level desc");
$db->setGroup(" comm_emo_level ");
$rows = $db->getAll();
$data1 = Tools::getData($rows); if (Tools::sum($data) != 0 && Tools::sum($data1) != 0){
$smarty->assign("file1", Tools::createGraph($data,$data1,'お客様','コミュニケータ'));
} //全部 お客様
$db = DB_Factory::create( 'callhistory' );
$db->setSelect("count(*) as count,cust_emo_level as level");
$db->setOrder(" cust_emo_level desc");
$db->setGroup(" cust_emo_level ");
//感情解析結果
$db->addWhere(" resultcode_cust = ?" ,0);
$db->addWhere(" resultcode_comm = ?" ,0);
$db->addWhere(" analysised = ?" ,1);
$rows = $db->getAll();
$data = Tools::getData($rows); //全部 コミュニケータ
$db = DB_Factory::create( 'callhistory' );
$db->setSelect("count(*) as count,comm_emo_level as level");
$db->setOrder(" comm_emo_level desc");
$db->setGroup(" comm_emo_level ");
//感情解析結果
$db->addWhere(" resultcode_cust = ?" ,0);
$db->addWhere(" resultcode_comm = ?" ,0);
$db->addWhere(" analysised = ?" ,1);
$rows = $db->getAll();
$data1 = Tools::getData($rows);
if (Tools::sum($data) != 0 && Tools::sum($data1) != 0){
$smarty->assign("file3", Tools::createGraph($data,$data1,'お客様','コミュニケータ'));
}
$smarty->assign("add","+");
$smarty->display( './report.html' );
} else {
//セッションクリア
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty( $smarty );
//初期値
list($syear,$smonth,$sday) = split('-',date('Y-m-d'));
$item = array("syear" => $syear,
"smonth" => $smonth,
"sday" => $sday,
"eyear" => $syear,
"emonth" => $smonth,
"eday" => $sday
); $report->setDefaults($item);
$report->accept( $renderer );
$smarty->assign( 'list', $renderer->toArray() );
$smarty->assign("add","+");
$smarty->display( './report.html' );
}
?>
//by sunj 2006/02/19
if(isset($_REQUEST['sessionid'])){
session_id($_REQUEST['sessionid']);
}
//by sunj 2006/02/19// session
session_start();
require_once( 'config.php' );
// set header
header('Content-Type: text/html; charset=shift_jis');
// load util class
require_once( 'Var_Dump.php' );// initialize Smarty
require_once( 'Smarty.class.php' );
$smarty = new Smarty;
$smarty->template_dir = APP_HOME. '/smarty/templates/';
$smarty->compile_dir = APP_HOME. '/smarty/templates_c/';
$smarty->config_dir = APP_HOME. '/smarty/configs/';
$smarty->cache_dir = APP_HOME. '/smarty/cache/';require_once( 'util/InitLoad.php' );
$util = new InitLoad($smarty);
$smarty->assign( 'util', $util );require_once( 'util/Constant.php' );
$cons = new Constant($smarty);
$smarty->assign( 'cons', $cons );$smarty->assign( 'word1', "閲覧ユーザー" );
$smarty->assign( 'pagercount', PAGE_COUNT );// initialize DB
require_once( 'DB_Factory.php' );
DB_Factory::initialize(DSN);// check login
if ( empty( $_SESSION[ 'LOGIN' ] ) ) {
if ( preg_match( '/^\/member\//', $_SERVER[ 'PHP_SELF' ] ) ) {
// メンバー領域にアクセス
require_once( 'HTTP.php' );
HTTP::redirect( '/index.php' );
}else{
}
}require_once "HTML/QuickForm.php";
require_once "util/Tools.php";
require_once "HTML/QuickForm/Renderer/ArraySmarty.php";
?>
这个是init.php
require_once( 'BaseForm.php' );class ReportForm extends BaseForm {
public function __construct ( &$smarty ) {
parent::__construct( $smarty, 'form3' ); //期間
$this->addElement( 'select', 'syear', '', $this->getYear(),$this->listattr);
$this->addElement( 'select', 'smonth', '', $this->getMonth(),$this->listattr);
$this->addElement( 'select', 'sday', '', $this->getDay(),$this->listattr); $this->addElement( 'select', 'eyear', '', $this->getYear(),$this->listattr);
$this->addElement( 'select', 'emonth', '', $this->getMonth(),$this->listattr);
$this->addElement( 'select', 'eday', '', $this->getDay(),$this->listattr); //通話開始時間
$this->addElement( 'select', 'shour', '', $this->getHour(),$this->listattr);
$this->addElement( 'select', 'smin', '', $this->getMin(),$this->listattr); $this->addElement( 'select', 'ehour', '', $this->getHour(),$this->listattr);
$this->addElement( 'select', 'emin', '', $this->getMin(),$this->listattr); //通話時間
$this->addElement( 'select', 'totaltime', '', $this->getTime(),$this->listattr); $this->addElement( 'select', 'timelevel', '', $this->getLevel(),$this->listattr); //GROUP
require_once("util/Tools.php");
// $this->addElement('select','group_id','',Tools::getGroup(),$this->listattr);
//$this->addElement('select','group_id','',Tools::getGroup(),$this->listattr); //お客様電話番号
$this->addElement('text','customerid','',$this->callerattr);
//IN/OUT
$this->addElement('select','calldirection','',Tools::getCallDirection(),$this->listattr);
//GENRE
$this->addElement('select','genre_id','',Tools::getGenre(),$this->listattr);
//ID
$this->addElement('select','id','',Tools::getID(),$this->listattr);
$this->addElement('text','idvalue','',$this->listattr);
$this->addElement('text','name','',$this->listattr);
//感情レベル
$this->addElement('select','cust_emo_level','',Tools::getEmoLevel(),$this->listattr);
$this->addElement('select','cust_emo_level_no','',$this->getEmoLevel(),$this->listattr);
$this->addElement('select','comm_emo_level','',Tools::getEmoLevel(),$this->listattr);
$this->addElement('select','comm_emo_level_no','',$this->getEmoLevel(),$this->listattr);
$this->addElement('select','cust_emo_transit','',Tools::getEmoLevel(),$this->listattr);
$this->addElement('select','cust_emo_transit_no','',$this->getEmoLevel(),$this->listattr);
$this->addElement('select','comm_emo_transit','',Tools::getEmoLevel(),$this->listattr);
$this->addElement('select','comm_emo_transit_no','',$this->getEmoLevel(),$this->listattr); //タグ 1 2 3
$this->addElement('text','tag1','',$this->tagattr);
$this->addElement('select','tag1level','',$this->getEmoLevel(),$this->listattr);
$this->addElement('text','tag2','',$this->tagattr);
$this->addElement('select','tag2level','',$this->getEmoLevel(),$this->listattr);
$this->addElement('text','tag3','',$this->tagattr);
$this->addElement('select','tag3level','',$this->getEmoLevel(),$this->listattr); }
}?>
这个是ReportForm.php
如果嫌大,也可以到网上找些别人写好的类.