• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP BarPlot类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中BarPlot的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot类的具体用法?PHP BarPlot怎么用?PHP BarPlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了BarPlot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getGrafmayorcosto

 public function getGrafmayorcosto()
 {
     JpGraph::module('bar');
     $graph = new Graph(680, 300);
     $graph->SetScale("textlin");
     $graph->yscale->SetGrace(5);
     $graph->SetBox(true);
     $labels = array();
     $valores = array();
     foreach (Activo::where('id', '>', '0')->orderBy('costo', 'desc')->take(10)->get() as $activo) {
         $labels[] = $activo->num_activo;
         $valores[] = $activo->costo;
     }
     //titulo de la grafica
     $graph->title->SetColor('black');
     $graph->title->Set('Gráfica: Activos con Mayor Costo');
     //valores de los labels en ambas axis y como se ubicaran
     $graph->xaxis->SetTickLabels($labels);
     $graph->xaxis->SetLabelAlign('center', 'top', 'center');
     $graph->ygrid->SetFill(false);
     $graph->yaxis->HideLabels(false);
     $graph->yaxis->HideTicks(false, false);
     //Fonts para las axis
     $graph->xaxis->SetColor('black');
     $graph->yaxis->SetColor('black');
     //grafica de activos con mayor costo
     $mayorCosto = new BarPlot($valores);
     $mayorCosto->SetColor('white');
     $mayorCosto->SetWidth(0.6);
     //agrega la grafica generada a la instancia de la grafica
     $graph->Add($mayorCosto);
     //Despliega la grafica
     $graph->Stroke();
 }
开发者ID:EdgardoPitti,项目名称:plagetri21v2,代码行数:34,代码来源:GraficarController.php


示例2: draw

 public function draw($format = false)
 {
     /* Make sure we have GD support. */
     if (!function_exists('imagecreatefromjpeg')) {
         die;
     }
     if ($format === false) {
         $format = IMG_PNG;
     }
     $group = new PlotGroup();
     $graph = new Graph($this->width, $this->height);
     $graph->setFormat($format);
     $graph->setBackgroundColor(new Color(0xf4, 0xf4, 0xf4));
     $graph->shadow->setSize(3);
     $graph->title->set($this->title);
     $graph->title->setFont(new Tuffy(10));
     $graph->title->setColor(new Color(0x0, 0x0, 0x8b));
     $graph->border->setColor(new Color(187, 187, 187, 15));
     $plot = new BarPlot($this->xValues);
     $plot->setBarColor(new $this->color());
     $plot->barBorder->hide(true);
     $plot->setBarGradient(new LinearGradient(new $this->color(), new White(), 0));
     $plot->setBarPadding(0.2, 0.2);
     $group->axis->bottom->setLabelText($this->xLabels);
     $group->axis->bottom->label->setFont(new Tuffy(8));
     $plot2 = new LinePlot($this->xValues, LinePlot::MIDDLE);
     $plot2->setColor(new DarkBlue());
     $plot2->setThickness(1);
     if (GRAPH_TREND_LINES) {
         $group->add($plot2);
     }
     $group->add($plot);
     $graph->add($group);
     $graph->draw();
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:35,代码来源:GraphGenerator.php


示例3: renderGraph

 public function renderGraph()
 {
     require_once 'libs/jpgraph/jpgraph.php';
     require_once 'libs/jpgraph/jpgraph_bar.php';
     $graph = new Graph($this->_controllerAction->getRequest()->getParam('type') == 'month' ? 400 : 300, 200, 'auto');
     $graph->SetMarginColor('white');
     $graph->SetFrame(false);
     $graph->SetScale("textlin");
     $graph->img->SetMargin(0, 30, 20, 40);
     $graph->yaxis->scale->SetGrace(20);
     $graph->yaxis->HideLabels();
     $graph->yaxis->HideTicks();
     $graph->ygrid->SetFill(true, '#[email protected]', '#[email protected]');
     $labelsy = array();
     $datay = array();
     switch ($this->_controllerAction->getRequest()->getParam('type')) {
         case 'month':
             $this->_populateMonthData($labelsy, $datay);
             break;
         case 'year':
             $this->_populateYearData($labelsy, $datay);
             break;
         default:
             $this->_populateWeekData($labelsy, $datay);
     }
     $graph->xaxis->SetTickLabels($labelsy);
     $bplot = new BarPlot($datay);
     $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
     $bplot->value->Show();
     $bplot->value->SetFormat('%d');
     $graph->Add($bplot);
     $graph->Stroke();
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:33,代码来源:Registrations.php


示例4: ShowHBar

/**
 * Show Horizontal Bar graph
 */
function ShowHBar(&$legend, &$value)
{
    $height = 50 + count($value) * 18;
    $width = 500;
    // Set the basic parameters of the graph
    $graph = new Graph($width, $height, 'auto');
    $graph->SetScale("textlin");
    $top = 30;
    $bottom = 20;
    $left = 100;
    $right = 50;
    $graph->Set90AndMargin($left, $right, $top, $bottom);
    $graph->xaxis->SetTickLabels($legend);
    $graph->SetFrame(false);
    // Label align for X-axis
    $graph->xaxis->SetLabelAlign('right', 'center', 'right');
    // Label align for Y-axis
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    // Create a bar pot
    $bplot = new BarPlot($value);
    $bplot->SetFillColor("orange");
    $bplot->SetWidth(0.5);
    // We want to display the value of each bar at the top
    $graph->yaxis->scale->SetGrace(10);
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    $graph->yaxis->SetLabelFormat('%d');
    $bplot->value->Show();
    $bplot->value->SetFormat('%.d votes');
    // Setup color for gradient fill style
    $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_MIDVER);
    $graph->Add($bplot);
    $graph->Stroke();
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:36,代码来源:graphs.php


示例5: barcart

function barcart($datay)
{
    require_once "jpgraph/jpgraph.php";
    require_once "jpgraph/jpgraph_bar.php";
    // Setup the graph.
    $graph = new Graph(660, 250);
    $graph->SetScale("textlin");
    // Add a drop shadow
    $graph->SetShadow();
    // Adjust the margin a bit to make more room for titles
    $graph->SetMargin(40, 30, 20, 40);
    // Setup the titles
    $graph->title->Set('NHR Registry');
    $graph->xaxis->title->Set('X-title');
    $graph->yaxis->title->Set('Y-title');
    // Create the bar pot
    $bplot = new BarPlot($datay);
    // Adjust fill color
    $bplot->SetFillColor('orange');
    $graph->Add($bplot);
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
    return $graph;
}
开发者ID:JosephMokano,项目名称:somu-nhr,代码行数:25,代码来源:jpgraph_pi.php


示例6: barGraph_2

 public function barGraph_2($data, $examinee_id, $color = 'green')
 {
     require_once '../app/classes/jpgraph/jpgraph_bar.php';
     // Create the graph. These two calls are always required
     $graph = new Graph(400, 334);
     $graph->SetScale('textlin');
     $graph->SetShadow(true, 5, 'white');
     // Adjust the margin a bit to make more room for titles
     $graph->SetMargin(40, 30, 20, 40);
     $graph->SetFrame(true, 'black', 1);
     // Create a bar pot
     $datay = array();
     $datalabel = array();
     foreach ($data as $value) {
         $datay[] = $value['score'];
         $datalabel[] = $value['chs_name'];
     }
     $bplot = new BarPlot($datay);
     // Adjust fill color
     $bplot->SetFillColor($color);
     $bplot->SetShadow("white");
     $graph->Add($bplot);
     // Setup labels
     $lbl = $datalabel;
     $graph->xaxis->SetTickLabels($lbl);
     $graph->xaxis->SetFont(FF_CHINESE, FS_BOLD, 12);
     // Send back the HTML page which will call this script again
     // to retrieve the image.
     //临时文件命名规范    $examinee_id_$date_rand(100,900)
     $date = date('H_i_s');
     $stamp = rand(100, 900);
     $fileName = './tmp/' . $examinee_id . '_' . $date . '_' . $stamp . '.jpeg';
     $graph->Stroke($fileName);
     return $fileName;
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:35,代码来源:WordChart.php


示例7: _stats_build_graph

function _stats_build_graph($data, $labels, $filename, $stat, $width, $height, $vars)
{
    if (file_exists($filename)) {
        unlink($filename);
    }
    $data_orig = $data;
    foreach ($data as $key => $val) {
        if (!is_numeric($val)) {
            $data[$key] = 0;
        }
    }
    // $vars["color_tab_black"]
    $bg_grey = _stats_color($vars["bg_grey"], 0);
    $bg_light_blue = _stats_color($vars["bg_light_blue"], 25);
    $graph = new Graph($width, $height);
    $group = new PlotGroup();
    $group->setSpace(2, 2);
    $group->grid->setType(LINE_DASHED);
    $group->grid->hideVertical(TRUE);
    $group->setPadding(30, 10, 25, 20);
    $graph->setBackgroundColor($bg_grey);
    $graph->title->set($stat);
    $graph->title->setFont(new Tuffy(10));
    $plot = new BarPlot($data, 1, 1, 0);
    $plot->setBarColor($bg_light_blue);
    $plot->label->set($data_orig);
    $plot->label->move(0, -5);
    $group->add($plot);
    $group->axis->bottom->setLabelText($labels);
    $group->axis->bottom->hideTicks(TRUE);
    $graph->add($group);
    $graph->draw($filename);
}
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:33,代码来源:preview.php


示例8: conf__grafico

 function conf__grafico(toba_ei_grafico $grafico)
 {
     if (isset($this->datos)) {
         $datos = array();
         $leyendas = array();
         foreach ($this->datos as $value) {
             $datos[] = $value['resultado'];
             $leyendas[] = $value['codc_uacad'];
         }
     }
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_bar.php';
     // Setup a basic graph context with some generous margins to be able
     // to fit the legend
     $canvas = new Graph(900, 300);
     $canvas->SetMargin(100, 140, 60, 40);
     $canvas->title->Set('Cr�dito Disponible');
     //$canvas->title->SetFont(FF_ARIAL,FS_BOLD,14);
     // For contour plots it is custom to use a box style ofr the axis
     $canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
     $canvas->SetScale('intint');
     //$canvas->SetAxisStyle(AXSTYLE_BOXOUT);
     //$canvas->xgrid->Show();
     $canvas->ygrid->Show();
     $canvas->xaxis->SetTickLabels($leyendas);
     // A simple contour plot with default arguments (e.g. 10 isobar lines)
     $cp = new BarPlot($datos);
     $cp->SetColor("#B0C4DE");
     $cp->SetFillColor("#B0C4DE");
     $cp->SetLegend("Resultado");
     $canvas->Add($cp);
     // Con esta llamada informamos al gr�fico cu�l es el gr�fico que se tiene
     // que dibujar
     $grafico->conf()->canvas__set($canvas);
 }
开发者ID:pkogan,项目名称:presupuesto,代码行数:35,代码来源:ci_comparacion_unidad.php


示例9: Bar

 /**
  *Funcion que crea graficas tipo Barra
  *@param array() $data Array en el cual estan los datos para Y array(1, 2.3, 3, 4)
  *@param string $legend Título de los datos de la Barra
  *@param string $color Color de la Barra
  */
 function Bar($data, $legend = null, $color = '#000000')
 {
     vendor('jpgraph/jpgraph_bar');
     $bar = new BarPlot($data);
     $bar->SetFillColor($color);
     $bar->Legend($legend);
     $this->graph->Add($bar);
 }
开发者ID:boriscy,项目名称:upsys,代码行数:14,代码来源:jpgraph.php


示例10: execute

 function execute()
 {
     $this->set_title('Statistics Center');
     $this->tree('Statistics Center');
     if (!extension_loaded('gd')) {
         return $this->message('JpGraph Error', 'You need to install the correct GD libraries to run the Statistics centre (GD Libraries were not detected)');
     }
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         return $this->message('JpGraph Error', 'This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)');
     }
     /**
      * Posts
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(post_id) AS posts,\r\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\r\n\t\tFROM {$this->pre}posts\r\n\t\tGROUP BY month\r\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Posts by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\r\n\t\tSELECT\r\n\t\t    COUNT(user_id) AS users,\r\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\r\n\t\tFROM {$this->pre}users\r\n\t\tWHERE user_joined != 0\r\n\t\tGROUP BY month\r\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set('Registrations by Month');
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message('Statistics Center', "<img src='{$this->time}1.png' alt='Posts by Month' /><br /><br />\r\n\t\t<img src='{$this->time}2.png' alt='Registrations by Month' />");
 }
开发者ID:BackupTheBerlios,项目名称:mercuryb-svn,代码行数:57,代码来源:stats.php


示例11: index

 public function index()
 {
     // We want a bar graph, so use JpGraph's bar chart library
     require_once APPPATH . '/libraries/JpGraph/jpgraph_bar.php';
     // Example data (04/2015)
     $json = '[{"Hogwarts Academy":{"Yield":"19021 kWh","Yield specific":"127.01 kWh\\/kWp","Target yield":"16069.23 kWh","Current-target yield %":"<span style=\\"color: #3ab121\\">118.37 %<span>"}},{"cols": [{"id":"","label":"Time","pattern":"","type":"string"},{"id":"","label":"Hogwarts Academy (AC)","pattern":"","type":"number"},{"id":"","label":"Target values","pattern":"","type":"number"}], "rows": [{"c":[{"v":"01/04","f":null}, {"v":615.8,"f":"615,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"02/04","f":null}, {"v":712.5,"f":"712,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"03/04","f":null}, {"v":171,"f":"171,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"04/04","f":null}, {"v":382.3,"f":"382,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"05/04","f":null}, {"v":606.3,"f":"606,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"06/04","f":null}, {"v":774.5,"f":"774,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"07/04","f":null}, {"v":570.6,"f":"570,60 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"08/04","f":null}, {"v":726.8,"f":"726,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"09/04","f":null}, {"v":789.2,"f":"789,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"10/04","f":null}, {"v":592.9,"f":"592,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"11/04","f":null}, {"v":677.1,"f":"677,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"12/04","f":null}, {"v":244.5,"f":"244,50 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"13/04","f":null}, {"v":457.4,"f":"457,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"14/04","f":null}, {"v":340.8,"f":"340,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"15/04","f":null}, {"v":425.3,"f":"425,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"16/04","f":null}, {"v":828.8,"f":"828,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"17/04","f":null}, {"v":616.8,"f":"616,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"18/04","f":null}, {"v":660.3,"f":"660,30 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"19/04","f":null}, {"v":453.2,"f":"453,20 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"20/04","f":null}, {"v":691.9,"f":"691,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"21/04","f":null}, {"v":904.4,"f":"904,40 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"22/04","f":null}, {"v":879.1,"f":"879,10 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"23/04","f":null}, {"v":824.8,"f":"824,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"24/04","f":null}, {"v":777.9,"f":"777,90 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"25/04","f":null}, {"v":413.8,"f":"413,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"26/04","f":null}, {"v":834.8,"f":"834,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"27/04","f":null}, {"v":920.8,"f":"920,80 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"28/04","f":null}, {"v":751,"f":"751,00 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"29/04","f":null}, {"v":737.7,"f":"737,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]},{"c":[{"v":"30/04","f":null}, {"v":638.7,"f":"638,70 kWh"}, {"v":535.640966432,"f":"535,64 kWh"}]}]}]';
     // Turn string into object
     $obj = json_decode($json);
     // Stores for graph data
     $xdata = array();
     $ydata = array();
     // Get coords data from object
     $obj_data = $obj[1]->rows;
     $counter = 1;
     // Add it to each of our storage arrays
     foreach ($obj_data as $data) {
         // only plot when there is a kW value
         if (isset($data->c[1]->v)) {
             $xdata[] = $data->c[0]->v;
             // date
             $ydata[] = $data->c[1]->v;
             // kw
         }
     }
     // Create the graph.
     // One minute timeout for the cached image
     // INLINE_NO means don't stream it back to the browser.
     $graph = new Graph(600, 350, 'auto');
     $graph->SetScale("textlin");
     $graph->img->SetMargin(60, 30, 20, 40);
     $graph->yaxis->SetTitleMargin(45);
     $graph->yaxis->scale->SetGrace(30);
     $graph->SetShadow();
     // Turn the tickmarks
     $graph->xaxis->SetTickSide(SIDE_DOWN);
     $graph->yaxis->SetTickSide(SIDE_LEFT);
     // Create a bar pot
     $bplot = new BarPlot($ydata);
     $bplot->SetFillColor("orange");
     // Use a shadow on the bar graphs (just use the default settings)
     $bplot->SetShadow();
     $bplot->value->SetFormat(" %2.1f kW", 70);
     $bplot->value->SetFont(FF_VERDANA, FS_NORMAL, 8);
     $bplot->value->SetColor("blue");
     $bplot->value->Show();
     $graph->Add($bplot);
     $graph->title->Set("Hogwarts Academy");
     $graph->xaxis->title->Set("Day");
     $graph->yaxis->title->Set("Yield in kilowatt hours");
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     // Send back the HTML page which will call this script again
     // to retrieve the image.
     $graph->StrokeCSIM();
 }
开发者ID:alexismansilla,项目名称:codeigniter-jpgraph,代码行数:56,代码来源:grapher.php


示例12: renderGraph

 public function renderGraph()
 {
     require_once 'libs/jpgraph/jpgraph.php';
     require_once 'libs/jpgraph/jpgraph_bar.php';
     require_once 'libs/jpgraph/jpgraph_line.php';
     $graph = new Graph(300, 200, 'auto');
     $graph->SetMarginColor('white');
     $graph->SetFrame(false);
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     $graph->img->SetMargin(0, 30, 20, 65);
     $graph->yaxis->HideLabels();
     $graph->yaxis->HideTicks();
     $graph->yaxis->scale->SetGrace(20);
     $graph->y2axis->SetColor("black", "red");
     $graph->ygrid->SetFill(true, '#[email protected]', '#[email protected]');
     $labelsy = array();
     $datay = array();
     $datay2 = array();
     switch ($this->_controllerAction->getRequest()->getParam('type')) {
         case 'year':
             $this->_populateYearData($labelsy, $datay, $datay2);
             break;
         default:
             $this->_populateWeekData($labelsy, $datay, $datay2);
     }
     $graph->xaxis->SetTickLabels($labelsy);
     $locale = Zend_Registry::get('Zend_Locale');
     if ($locale == 'ja') {
         // the ttf file for FF_MINCHO is already encoded in utf-8
         $legend1 = $this->view->translate('Trusted sites');
         $legend2 = $this->view->translate('Sites per user');
     } else {
         // default ttf files are latin-1 encoded
         $legend1 = utf8_decode($this->view->translate('Trusted sites'));
         $legend2 = utf8_decode($this->view->translate('Sites per user'));
     }
     $bplot = new BarPlot($datay);
     $bplot->setLegend($legend1);
     $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
     $bplot->value->Show();
     $bplot->value->SetFormat('%d');
     $p1 = new LinePlot($datay2);
     $p1->SetColor("red");
     $p1->SetLegend($legend2);
     $graph->Add($bplot);
     $graph->AddY2($p1);
     $graph->legend->SetLayout(LEGEND_HOR);
     if ($locale == 'ja') {
         $graph->legend->setFont(FF_MINCHO, FS_NORMAL);
     }
     $graph->legend->Pos(0.5, 0.99, "center", "bottom");
     $graph->Stroke();
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:54,代码来源:Sites.php


示例13: execute

 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     if (!defined('IMG_PNG')) {
         JpGraphError::Raise("This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)");
     }
     /**
      * Posts
      */
     $query = $this->db->query("SELECT COUNT(post_id) AS posts, FROM_UNIXTIME(post_time, '%%b %%y') AS month\n\t\t\tFROM %pposts GROUP BY month\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("SELECT COUNT(user_id) AS users, FROM_UNIXTIME(user_joined, '%%b %%y') AS month\n\t\t\tFROM %pusers\n\t\t\tWHERE user_joined != 0\n\t\t\tGROUP BY month\n\t\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $temp = array_values($data);
     $barplot = new BarPlot($temp);
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("../stats/{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='../stats/{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='../stats/{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:54,代码来源:stats.php


示例14: makeGraph

function makeGraph($x_data, $y_data, $num_results, $title = "Statistics", $graph_type = "bar", $graph_scale = "textint")
{
    // default graph info
    $width = 600;
    $height = 500;
    $top = 60;
    $bottom = 30;
    $left = 80;
    $right = 30;
    if ($graph_type != 'csv' && $num_results == 0) {
        header('Content-type: image/png');
        readfile($GLOBALS['BASE_DIR'] . '/images/no-calls.png');
        exit;
    }
    // Set the basic parameters of the graph
    switch ($graph_type) {
        case "line":
            //do line graph here
            break;
            // not really a graph, returns comma seperated values
        // not really a graph, returns comma seperated values
        case "csv":
            header("content-type: text/csv");
            header('Content-Disposition: attachment; filename="statistics.csv"');
            $columns = implode(',', $x_data);
            $rows = implode(',', $y_data);
            echo $columns . "\n" . $rows;
            break;
        case "bar":
        default:
            // bar is default
            $graph = new Graph($width, 90 + 10 * $num_results, 'auto');
            $graph->SetScale($graph_scale);
            // Nice shadow
            $graph->SetShadow();
            $graph->Set90AndMargin($left, $right, $top, $bottom);
            // Setup labels
            $graph->xaxis->SetTickLabels($x_data);
            // Label align for X-axis
            $graph->xaxis->SetLabelAlign('right', 'center', 'right');
            // Label align for Y-axis
            $graph->yaxis->SetLabelAlign('center', 'bottom');
            // Create a bar pot
            $bplot = new BarPlot($y_data);
            $bplot->SetFillColor("#708090");
            $bplot->SetWidth(0.5);
            $bplot->SetYMin(0);
            //$bplot->SetYMin(1990);
            $graph->title->Set($title);
            $graph->Add($bplot);
            $graph->Stroke();
    }
}
开发者ID:AholibamaSI,项目名称:plymouth-webapp,代码行数:53,代码来源:statistics_image.php


示例15: bar_task

 public function bar_task($id)
 {
     $help = new Helper();
     $issues = $help->searchIssues($id);
     //foreach ($issues as $issue) {
     # code...
     //	$issue->id
     //}
     //$iteration = Iterations::findOrFail($id);
     //$idTmp = $iteration->id;
     // $issues = Issue::where('iterationid','=', $idTmp)->get();
     //$issues = $iteration->issues;
     //$countIssues = sizeof($issues);
     $countIssues = 0;
     $dataEstimatedTime = array();
     $dataRealTime = array();
     $dataIterationName = array();
     $countTODO = 0;
     $countDOING = 0;
     $countDONE = 0;
     //$string_iterations = implode(";", $iterations);
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(12, 8, 19, 3, 10, 5);
     // Create the graph. These two calls are always required
     $graph = new Graph(300, 200);
     $graph->SetScale('textlin');
     // Add a drop shadow
     $graph->SetShadow();
     // Adjust the margin a bit to make more room for titles
     $graph->SetMargin(40, 30, 20, 40);
     // Create a bar pot
     $bplot = new BarPlot($datay);
     // Adjust fill color
     $bplot->SetFillColor('orange');
     $graph->Add($bplot);
     // Setup the titles
     $graph->title->Set('A basic bar graph ');
     $graph->xaxis->title->Set('X-title');
     $graph->yaxis->title->Set('Y-title');
     $graph->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
     $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
     //$graph->Stroke();
     //$response = Response::make(
     //     $graph->Stroke()
     //);
     //    	$response->header('content-type', 'image/png');
     //  	return $response;
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:51,代码来源:GraphicsTaskController.php


示例16: summary

 /**
  *
  */
 public function summary($id)
 {
     $iterationAux;
     //try {
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     //foreach($iterations as $var){
     //  $iterationAux = $iterationAux . var_dump($var);
     //}
     //}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
     //}
     //die;
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(20, 30, 50, 80);
     $datay2 = array(30, 95, 70, 40);
     $datazero = array(0, 0, 0, 0);
     // Create the graph.
     $graph = new Graph(800, 500);
     $graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
     // Setup Y and Y2 scales with some "grace"
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     //$graph->yaxis->scale->SetGrace(30);
     //$graph->y2axis->scale->SetGrace(30);
     //$graph->ygrid->Show(true,true);
     $graph->ygrid->SetColor('gray', '[email protected]');
     // Setup graph colors
     $graph->SetMarginColor('white');
     $graph->y2axis->SetColor('darkred');
     // Create the "dummy" 0 bplot
     $bplotzero = new BarPlot($datazero);
     // Create the "Y" axis group
     $ybplot1 = new BarPlot($datay);
     $ybplot1->value->Show();
     $ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
     // Create the "Y2" axis group
     $ybplot2 = new BarPlot($datay2);
     $ybplot2->value->Show();
     $ybplot2->value->SetColor('darkred');
     $ybplot2->SetFillColor('darkred');
     $y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
     // Add the grouped bar plots to the graph
     $graph->Add($ybplot);
     $graph->AddY2($y2bplot);
     $datax = array('A', 'B', 'C', 'D');
     $graph->xaxis->SetTickLabels($datax);
     // .. and finally stroke the image back to browser
     $graph->Stroke();
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:54,代码来源:GraphicsTestController.php


示例17: Artichow_Histogram

function Artichow_Histogram($Name, $File, $Lines, $Labels, $Colors)
{
    #-----------------------------------------------------------------------------
    $Graph = new Graph(800, 500);
    $Graph->setDriver('gd');
    $Graph->setAntiAliasing(TRUE);
    $Graph->title->set($Name);
    $Graph->title->move(0, -5);
    $Graph->border->hide();
    $Graph->setBackgroundGradient(new LinearGradient(new Color(240, 240, 240, 0), new White(), 0));
    #-----------------------------------------------------------------------------
    $Group = new PlotGroup();
    $Group->grid->hide(FALSE);
    $Group->setBackgroundColor(new Color(240, 240, 240));
    $Group->setSpace(2, 2, 20, 0);
    $Group->setPadding(60, 10, NULL, NULL);
    #-----------------------------------------------------------------------------
    foreach ($Lines as $LineID => $Value) {
        #---------------------------------------------------------------------------
        $Legend = $Value['Name'];
        unset($Value['Name']);
        #---------------------------------------------------------------------------
        $Plot = new BarPlot($Value, 1, 1, 0);
        $Plot->barShadow->setPosition(Shadow::RIGHT_TOP);
        $Plot->barShadow->setColor(new Color(160, 160, 160, 10));
        $Color = Color_RGB_Explode($Colors[$LineID]);
        $Plot->setBarColor(new Color($Color['R'], $Color['G'], $Color['B'], 56));
        #---------------------------------------------------------------------------
        $Group->add($Plot);
        $Group->legend->add($Plot, $Legend, Legend::BACKGROUND);
    }
    #-----------------------------------------------------------------------------
    $Group->axis->bottom->setLabelText($Labels);
    $Group->axis->bottom->hideTicks(TRUE);
    #-----------------------------------------------------------------------------
    $Group->legend->shadow->setSize(4);
    $Group->legend->setAlign(Legend::BOTTOM);
    $Group->legend->setSpace(5);
    $Group->legend->setTextFont(new Tuffy(8));
    $Group->legend->setPosition(0.3, 0.2);
    $Group->setPadding(50, 10, 50, 30);
    $Group->legend->setBackgroundColor(new Color(255, 255, 255, 25));
    #-----------------------------------------------------------------------------
    $Graph->add($Group);
    #-----------------------------------------------------------------------------
    $Graph->draw($File);
    #-----------------------------------------------------------------------------
    return TRUE;
}
开发者ID:carriercomm,项目名称:jbs,代码行数:49,代码来源:Artichow.php


示例18: execute

 function execute()
 {
     $this->set_title($this->lang->stats);
     $this->tree($this->lang->stats);
     include '../lib/jpgraph/jpgraph.php';
     include '../lib/jpgraph/jpgraph_bar.php';
     /**
      * Posts
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(post_id) AS posts,\n\t\t    FROM_UNIXTIME(post_time, '%b %y') AS month\n\t\tFROM {$this->pre}posts\n\t\tGROUP BY month\n\t\tORDER BY post_time");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['posts'];
     }
     if (!$data) {
         $data = array(0, 0);
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_post_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}1.png");
     /**
      * Registrations
      */
     $query = $this->db->query("\n\t\tSELECT\n\t\t    COUNT(user_id) AS users,\n\t\t    FROM_UNIXTIME(user_joined, '%b %y') AS month\n\t\tFROM {$this->pre}users\n\t\tWHERE user_joined != 0\n\t\tGROUP BY month\n\t\tORDER BY user_joined");
     $data = array();
     while ($item = $this->db->nqfetch($query)) {
         $data[$item['month']] = $item['users'];
     }
     $graph = new Graph(400, 300, 'auto');
     $graph->SetScale('textint');
     $graph->SetColor('aliceblue');
     $graph->SetMarginColor('white');
     $graph->xaxis->SetTickLabels(array_keys($data));
     $graph->yaxis->scale->SetGrace(20);
     $graph->title->Set($this->lang->stats_reg_by_month);
     $barplot = new BarPlot(array_values($data));
     $barplot->SetFillColor('darkorange');
     $graph->add($barplot);
     $graph->Stroke("{$this->time}2.png");
     return $this->message($this->lang->stats, "<img src='{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
 }
开发者ID:BackupTheBerlios,项目名称:qsf-svn,代码行数:49,代码来源:stats.php


示例19: toPdf

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Base类代码示例发布时间:2022-05-23
下一篇:
PHP Bar类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap