最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

從數(shù)據(jù)庫中取出最近三十天的數(shù)據(jù)并生成柱狀圖

 更新時(shí)間:2011年05月07日 23:52:52   作者:  
從數(shù)據(jù)庫中取出最近三十天的數(shù)據(jù)并生成柱狀圖的代碼,需要的朋友可以參考下。
在終端用cd 命令進(jìn)入文件目錄
說明:此處例子我是拿項(xiàng)目中的一個(gè)例子講解的。
1、新建一個(gè)項(xiàng)目 :用終端輸入:zf create project Airline 格式:zf create action project project-name 備注:這些格式可以在終端輸入zf 查看
2、新建一個(gè)action :zf create action dirgramshow index 格式:zf create action action-name controller-name
3、新建一個(gè) model :zf create db-table flightinformation
action 層代碼:indexController.php
復(fù)制代碼 代碼如下:

public function indexAction ()
{
// action body
$db = new Application_Model_DbTable_Flightinformation();
/*獲取最近30天內(nèi)的數(shù)目
* select day(boo_time) as day,count(boo_autoid)as count,boo_time from bookinformation
where flag_pass=0 and date_sub(now(), interval 30 day)<=date(boo_time)
group by DATE_FORMAT(boo_time,'%m %d')
*/
$sql = "select DATE_FORMAT(boo_time,'%m-%d') as day,count(boo_autoid)as count from bookinformation " .
"where flag_pass=0 and date_sub(now(), interval 30 day)<=date(boo_time) " .
"group by DATE_FORMAT(boo_time,'%m %d')";
$result = $db->getAllInfo($sql)->fetchAll();
$this->view->result=$result;
}

view 層代碼:dirgramshow.phtml
復(fù)制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>航班折線圖</title>
<script language="javascript" type="text/javascript"
src="<?php
echo $this->baseUrl() . '/skin/source/jquery/jquery.js'?>"></script>
<script language="javascript" type="text/javascript"
src="<?php
echo $this->baseUrl() . '/skin/js/ZJPjscharts.js'?>"></script>
</head>
<body>
<div id="graph">Loading graph...</div>
<script type="text/javascript">
var d=new Array();
var color=new Array();
<?php
foreach ($this->result as $key => $value) {
?>
d.push(new Array('<?php
echo $value['day']?>',<?php
echo $value['count']?>));
color.push('#2D6B96');
<?php
}
?>
if(d!=""){
//['#2D6B96', '#327AAD', '#3E90C9', '#55A7E3', '#60B6F0', '#81C4F0', '#9CCEF0']
var myData = d;
var colors =color;
var myChart = new JSChart('graph', 'bar');
myChart.setDataArray(myData);
myChart.colorizeBars(colors);
myChart.setTitle('Airline diagram');
myChart.setTitleColor('#8E8E8E');
myChart.setAxisNameX('');
myChart.setAxisNameY('');
myChart.setAxisColor('#C4C4C4');
myChart.setAxisNameFontSize(16);
myChart.setAxisNameColor('#999');
myChart.setAxisValuesColor('#777');
myChart.setAxisColor('#B5B5B5');
myChart.setAxisWidth(1);
myChart.setBarValuesColor('#2F6D99');
myChart.setBarOpacity(0.5);
myChart.setAxisPaddingTop(60);
myChart.setAxisPaddingBottom(40);
myChart.setAxisPaddingLeft(45);
myChart.setTitleFontSize(11);
myChart.setBarBorderWidth(0);
myChart.setBarSpacingRatio(50);
myChart.setBarOpacity(0.9);
myChart.setFlagRadius(6);
myChart.setTooltip(['North America', 'U.S.A and Canada']);
myChart.setTooltipPosition('nw');
myChart.setTooltipOffset(3);
myChart.setSize(616, 321);
/*myChart.setBackgroundImage('<?php
//echo $this->baseUrl() . '/skin/image/ZJPchart_bg.jpg'?>');*/
myChart.draw();
}
</script>
</body>
</html>

model 層代碼:Flightinformation.php
復(fù)制代碼 代碼如下:

<?php
class Application_Model_DbTable_Flightinformation extends Zend_Db_Table_Abstract
{
protected $_name = 'flightinformation';
public function getAllInfo($sql){
$adapter = Zend_Registry::get('db');
$flightinformation = $adapter->query($sql);
return $flightinformation;
}
}

最后的效果圖如下:

 

相關(guān)文章

  • mysql update語句的用法詳解

    mysql update語句的用法詳解

    本文詳細(xì)介紹了,mysql中update語句的用法,系統(tǒng)全面的學(xué)習(xí)下update更新語句的用法,有需要的朋友可以參考下
    2014-08-08
  • Mysql隔離性之Read View的用法說明

    Mysql隔離性之Read View的用法說明

    這篇文章主要介紹了Mysql隔離性之Read View的用法說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • MySQL之復(fù)雜查詢的實(shí)現(xiàn)

    MySQL之復(fù)雜查詢的實(shí)現(xiàn)

    本文主要介紹了MySQL之復(fù)雜查詢的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • Mysql自連接查詢實(shí)例詳解

    Mysql自連接查詢實(shí)例詳解

    這篇文章主要介紹了Mysql自連接查詢,結(jié)合實(shí)例形式分析了MySQL自連接查詢的應(yīng)用場景、原理及相關(guān)操作技巧,需要的朋友可以參考下
    2019-07-07
  • mysql分配root賬號(hào)創(chuàng)建數(shù)據(jù)庫的權(quán)限的實(shí)現(xiàn)

    mysql分配root賬號(hào)創(chuàng)建數(shù)據(jù)庫的權(quán)限的實(shí)現(xiàn)

    root用戶通常具有所有的權(quán)限,本文主要介紹了mysql分配root賬號(hào)創(chuàng)建數(shù)據(jù)庫的權(quán)限的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • MySQL定時(shí)器常用案例

    MySQL定時(shí)器常用案例

    這篇文章主要介紹了MySQL定時(shí)器的相關(guān)知識(shí),本文結(jié)合使用案例給大家講解的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-07-07
  • 深入了解MySQL鎖機(jī)制及應(yīng)用場景

    深入了解MySQL鎖機(jī)制及應(yīng)用場景

    MySQL鎖是操作MySQL數(shù)據(jù)庫時(shí)常用的一種機(jī)制。MySQL鎖可以保證多個(gè)用戶在同時(shí)執(zhí)行讀寫操作時(shí),能夠互相協(xié)同、避免數(shù)據(jù)出現(xiàn)不一致或者讀寫沖突等問題。本篇文章將詳細(xì)介紹MySQL鎖的基本知識(shí)和具體應(yīng)用
    2023-03-03
  • mysql 按中文字段排序

    mysql 按中文字段排序

    在MySQL中,進(jìn)行中文排序和查找的時(shí)候,對(duì)漢字的排序和查找結(jié)果是錯(cuò)誤的。 這種情況在MySQL的很多版本中都存在。
    2009-01-01
  • MySQL中union和unionall區(qū)別

    MySQL中union和unionall區(qū)別

    本文主要介紹了MySQL中union和unionall區(qū)別,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-04-04
  • 深入sql數(shù)據(jù)連接時(shí)的一些問題分析

    深入sql數(shù)據(jù)連接時(shí)的一些問題分析

    本篇文章是對(duì)關(guān)于sql數(shù)據(jù)連接時(shí)的一些問題進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
    2013-06-06

最新評(píng)論

宜兰市| 清涧县| 若羌县| 利川市| 平果县| 百色市| 松滋市| 大田县| 射洪县| 湘乡市| 姜堰市| 平和县| 乐安县| 芮城县| 邻水| 徐闻县| 郓城县| 永济市| 基隆市| 灌阳县| 威海市| 顺义区| 华宁县| 宜黄县| 包头市| 阳山县| 绥中县| 马山县| 浠水县| 油尖旺区| 天津市| 伽师县| 温州市| 社会| 宜春市| 南投县| 泗阳县| 峨眉山市| 安平县| 龙游县| 汝南县|