当前位置: 首页>>代码示例>>PHP>>正文


PHP pData::AddAllSeries方法代码示例

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


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

示例1: writeData

function writeData($data, $graph)
{
    if ($data != "") {
        echo "Plottong " . $graph . "\n";
        $dataset1 = array();
        $dataset2 = array();
        foreach ($data as $key => $value) {
            array_push($dataset1, $key);
            array_push($dataset2, $value);
        }
        $DataSet = new pData();
        $DataSet->AddPoint($dataset2, "Serie1");
        $DataSet->AddPoint($dataset1, "Serie2");
        $DataSet->AddAllSeries();
        $DataSet->SetAbsciseLabelSerie("Serie2");
        $Test = new pChart(380, 200);
        $Test->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
        $Test->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
        // Draw the pie chart
        $Test->setFontProperties("Fonts/tahoma.ttf", 8);
        $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, TRUE, TRUE, 50, 20, 5);
        $Test->drawPieLegend(310, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
        $Test->Render("{$graph}-pie.png");
    }
}
开发者ID:nhandler,项目名称:locotools,代码行数:25,代码来源:chart.php

示例2: draw

 /**
  * Рисует график по переданным данным
  *
  * @param array $points
  * @return string путь к файлу графика
  */
 private function draw(array $points)
 {
     $errLevel = error_reporting();
     error_reporting(0);
     $newsList = $this->dataProvider->getNewsList();
     $classLoader = new CPChart();
     $DataSet = new pData();
     foreach ($points as $news_id => $set) {
         $DataSet->AddPoint($set, "news" . $news_id);
         $DataSet->SetSerieName($newsList[$news_id], "news" . $news_id);
     }
     $DataSet->AddAllSeries();
     $DataSet->AddPoint(array_values($this->dataProvider->getDates()), "dates");
     $DataSet->SetAbsciseLabelSerie('dates');
     // Initialise the graph
     $chart = new pChart(700, 250);
     $chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 7);
     $chart->setGraphArea(60, 30, 570, 200);
     $chart->drawFilledRoundedRectangle(7, 7, 693, 253, 5, 240, 240, 240);
     $chart->drawRoundedRectangle(5, 5, 695, 255, 5, 230, 230, 230);
     $chart->drawGraphArea(255, 255, 255, true);
     $data = $DataSet->GetData();
     if (!empty($data)) {
         $chart->drawScale($data, $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2, true, 3);
         $chart->drawGrid(4, true, 230, 230, 230, 50);
         $chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
         // Finish the graph
         $chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 8);
         $chart->drawLegend(590, 20, $DataSet->GetDataDescription(), 255, 255, 255);
     }
     // Restore reporting level
     error_reporting($errLevel);
     return $this->render($chart, $points);
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:40,代码来源:ExcelChart.php

示例3: _showGraph_pChart

 public function _showGraph_pChart($buscarBarra)
 {
     // Dataset definition
     $DataSet = new pData();
     if ($buscarBarra == "semana") {
         $semana = array("1era Semana", "2da Semana", "3era Semana", "4ta Semana");
         $cantidadSemanal = array(2, 4, 5, 6);
         $DataSet->AddPoint($semana, "Serie1");
         $DataSet->AddPoint($cantidadSemanal, "Serie2");
         // Initialise the graph
         define("WIDTH", 500);
         define("HEIGHT", 500);
         $Test = new pChart(WIDTH, HEIGHT);
         $Test->setFontProperties("../font/arial.ttf", 7);
         $Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
         $Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
         $Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
     } elseif ($buscarBarra == "mes") {
         $mensual = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre");
         $cantidadMensual = array(4, 6, 11, 23, 9, 2, 30, 20, 12, 45);
         $DataSet->AddPoint($mensual, "Serie1");
         $DataSet->AddPoint($cantidadMensual, "Serie2");
         // Initialise the graph
         define("WIDTH", 700);
         define("HEIGHT", 500);
         $Test = new pChart(WIDTH, HEIGHT);
         $Test->setFontProperties("../font/arial.ttf", 7);
         $Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
         $Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
         $Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
         $Test->setColorPalette(0, 224, 100, 46);
     }
     $DataSet->AddAllSeries();
     $DataSet->RemoveSerie("Serie1");
     $DataSet->SetAbsciseLabelSerie("Serie1");
     $DataSet->SetSerieName("Productos Comprados", "Serie2");
     // Initialise the graph
     $Test->drawGraphArea(255, 255, 255, TRUE);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
     $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
     // Draw the 0 line
     $Test->setFontProperties("../font/arial.ttf", 6);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     // Draw the bar graph
     $Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
     // Set labels
     $Test->setFontProperties("../font/arial.ttf", 7);
     $Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2");
     // Finish the graph
     $Test->setFontProperties("../font/arial.ttf", 8);
     $Test->drawLegend(WIDTH / 5, 25, $DataSet->GetDataDescription(), 255, 255, 255);
     $Test->setFontProperties("../font/arial.ttf", 10);
     $Test->drawTitle(WIDTH - 200, 22, "Estadistica de Barra de Grafico", 50, 50, 50, 185);
     $Test->Render("../img/imagenBarra_pChart.png");
 }
开发者ID:johncuervo24,项目名称:EjPHP,代码行数:55,代码来源:GraphBar.php

示例4: line

 function line($valores, $titulo, $label = array())
 {
     $nombre = tempnam('/tmp', 'g') . '.png';
     $DataSet = new pData();
     $ind = 1;
     $DataSet->AddPoint($valores, 'Serie' . $ind);
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie();
     $DataSet->SetSerieName($titulo, 'Serie' . $ind);
     if (count($label) > 0) {
         $ID = 0;
         foreach ($label as $val) {
             $DataSet->Data[$ID]["Name"] = $val;
             $ID++;
         }
     }
     $Test = new pChart(300, 200);
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
     $Test->setGraphArea(70, 30, 280, 170);
     $Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
     $Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
     $Test->drawGraphArea(255, 255, 255, TRUE);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 0);
     $Test->drawGrid(4, TRUE, 200, 200, 200, 50);
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 6);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     $Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
     $Test->drawLegend(200, 9, $DataSet->GetDataDescription(), 255, 255, 255);
     $Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 10);
     //$Test->drawTitle(10,22,$titulo,50,50,50,300);
     $Test->Render($nombre);
     return $nombre;
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:34,代码来源:imgraf.php

示例5: componentPieChart

 public function componentPieChart()
 {
     $DataSet = new pData();
     if (count($this->values) > 0) {
         $DataSet->AddPoint($this->values, "Serie1");
         $DataSet->AddPoint($this->labels, "Serie2");
         $DataSet->AddAllSeries();
         $DataSet->SetAbsciseLabelSerie("Serie2");
     }
     // Draw the pie chart
     // Initialise the graph
     $Test = new pChart($this->width, $this->height);
     $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
     $Test->drawFilledRoundedRectangle(2, 2, $this->width - 3, $this->height - 3, 5, 240, 240, 240);
     $Test->drawRoundedRectangle(0, 0, $this->width - 1, $this->height - 1, 5, 230, 230, 230);
     if ($this->height > 200 && $this->width > 250) {
         if (count($this->values) > 0) {
             $Test->drawPieLegend($this->width / 3 + $this->width / 3, 40, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
         }
         $title_font_size = 10;
         $left = $this->width / 3;
         $pie_labels = PIE_PERCENTAGE_AND_VALUES;
     } else {
         $title_font_size = 7;
         $left = $this->width / 2;
         $pie_labels = PIE_NOLABEL;
     }
     if (isset($this->style) && $this->style == '3d' && count($this->values) > 0) {
         $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), floor($left), floor($this->height / 2), floor(($this->width + $this->height) / 6), $pie_labels, TRUE, 40, 10, 3);
     }
     $Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', $title_font_size);
     $Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30);
     $Test->Stroke();
     //("example2.png");
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:35,代码来源:actioncomponents.class.php

示例6: knews_drawPie

function knews_drawPie($values, $captions, $filename, $palette = "users.txt", $background = true, $legend = true)
{
    // Dataset definition
    $DataSet = new pData();
    $DataSet->AddPoint($values, "Serie1");
    $DataSet->AddPoint($captions, "Serie2");
    $DataSet->AddAllSeries();
    $DataSet->SetAbsciseLabelSerie("Serie2");
    // Initialise the graph
    $Test = new pChart(430, 200);
    $Test->loadColorPalette(KNEWS_DIR . "/includes/pChart/" . $palette);
    if ($background) {
        $Test->drawFilledRoundedRectangle(7, 7, 423, 193, 5, 240, 240, 240);
        //Fons recuadre exterior, X1, Y1, X2, Y2, radi, r, g, b
        $Test->drawRoundedRectangle(5, 5, 425, 195, 5, 230, 230, 230);
        //Filet exterior, X1, Y1, X2, Y2, radi, r, g, b
    }
    // Draw the pie chart
    $Test->setFontProperties(KNEWS_DIR . "/includes/pChart/tahoma.ttf", 8);
    if ($legend) {
        $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 215, 90, 110, PIE_PERCENTAGE_LABEL, TRUE, 50, 20, 0);
    } else {
        $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 215, 90, 110, '', TRUE, 50, 20, 0);
    }
    //$Test->drawPieLegend(290,30,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
    $Test->Render(KNEWS_DIR . "/tmp/" . $filename);
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:27,代码来源:knews_admin_stats.php

示例7: _prepareSerie

 /**
  * Prepare specific serie for the chart
  * @access private
  */
 private function _prepareSerie()
 {
     $this->data->AddAllSeries();
     if ($this->label) {
         $this->data->SetAbsciseLabelSerie($this->label);
     } else {
         $this->data->SetAbsciseLabelSerie();
     }
 }
开发者ID:LWFeng,项目名称:hush,代码行数:13,代码来源:Chart.php

示例8: index

 function index()
 {
     $this->load->model('charge_model');
     $revenue = $this->charge_model->GetRevenueByDay($this->user->Get('client_id'));
     $data = array();
     if ($this->config->item('show_dashboard_chart') !== 'no' and !empty($revenue) and count($revenue) > 1) {
         $series = array();
         foreach ($revenue as $day) {
             $series[] = $day['revenue'];
             $series2[] = date("M j", strtotime($day['day']));
         }
         include APPPATH . 'libraries/pchart/pData.class';
         include APPPATH . 'libraries/pchart/pChart.class';
         // Dataset definition
         $DataSet = new pData();
         $DataSet->AddPoint($series, "Revenue");
         $DataSet->AddPoint($series2, "Serie2");
         $DataSet->AddAllSeries();
         $DataSet->SetAbsciseLabelSerie("Serie2");
         $DataSet->RemoveSerie("Serie2");
         $DataSet->SetXAxisName('Date');
         $DataSet->SetYAxisName('Revenue');
         //$DataSet->SetXAxisFormat('date');
         // Initialise the graph
         $Test = new pChart(1000, 260);
         $Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
         $Test->setGraphArea(90, 30, 960, 200);
         $Test->drawGraphArea(252, 252, 252);
         $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
         $Test->drawGrid(4, TRUE, 230, 230, 230, 255);
         // Draw the line graph
         $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
         $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
         // Finish the graph
         $Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 8);
         $Test->drawLegend(45, 35, $DataSet->GetDataDescription(), 255, 255, 255);
         $Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
         //$Test->drawTitle(60,22,"Last 30 Days",50,50,50,585);
         $Test->Render(BASEPATH . '../writeable/rev_chart_' . $this->user->Get('client_id') . '.png');
     } else {
         $data['no_chart'] = 'true';
     }
     // get log
     $this->load->model('log_model');
     $log = $this->log_model->GetClientLog($this->user->Get('client_id'));
     $data['log'] = $log;
     $this->load->view(branded_view('cp/dashboard'), $data);
 }
开发者ID:carriercomm,项目名称:opengateway,代码行数:48,代码来源:dashboard.php

示例9: generate_image

function generate_image($site_name, $visits)
{
    $font = APP_PATH . "libs/pchart/Fonts/tahoma.ttf";
    //$font = APP_PATH."includes/pchart/Fonts/DejaVuSans.ttf";
    global $lang;
    // Dataset definition
    $DataSet = new pData();
    $names = array();
    $points = array();
    foreach ($visits as $date => $visit) {
        $points[] = $visit;
        $text = $lang['days'][date('N', strtotime($date))];
        $names[] = $text;
    }
    $DataSet->AddPoint($points, "Lankytojai");
    $DataSet->AddPoint($names, "days");
    $DataSet->AddAllSeries();
    $DataSet->RemoveSerie("days");
    $DataSet->SetAbsciseLabelSerie('days');
    // Initialise the graph
    $Test = new pChart(700, 230);
    $Test->setFontProperties($font, 8);
    $Test->setGraphArea(50, 30, 680, 200);
    $Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
    $Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
    $Test->drawGraphArea(255, 255, 255, TRUE);
    $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
    $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $Test->setFontProperties($font, 6);
    $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Draw the bar graph
    $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
    // Finish the graph
    $Test->setFontProperties($font, 8);
    //	 $Test->drawLegend(100,20,$DataSet->GetDataDescription(),255,255,255);
    $Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
    $Test->setFontProperties($font, 10);
    $Test->drawTitle(50, 22, $site_name, 50, 50, 50, 585);
    $path = IMAGE_PATH . "{$site_name}.png";
    if (file_exists($path)) {
        unlink($path);
    }
    $Test->Render($path);
    return $path;
}
开发者ID:songokas,项目名称:manovalstybe_rss,代码行数:46,代码来源:helper.php

示例10: createClosuresGraph

 private function createClosuresGraph($queries)
 {
     $qb = new QueryBrowser();
     $imagehashes = array();
     foreach ($queries as $q) {
         $DataSet = new pData();
         $qResult = $qb->executeQueryToArray($q['query']);
         if (sizeof($qResult) > 0) {
             foreach ($qResult as $row) {
                 $DataSet->AddPoint($row['y'], $q['series'], $row['x']);
             }
             $DataSet->AddAllSeries();
             $DataSet->SetAbsciseLabelSerie();
             $chartname = $this->createPathFromHash(md5(serialize($DataSet)));
             $imagehashes[] = array($chartname, $q['series']);
             if (!file_exists($chartname)) {
                 $Test = new pChart(700, 280);
                 $Test->setFontProperties("graph/Fonts/tahoma.ttf", 8);
                 $Test->setGraphArea(50, 30, 680, 200);
                 $Test->drawFilledRoundedRectangle(7, 7, 693, 273, 5, 240, 240, 240);
                 $Test->drawRoundedRectangle(5, 5, 695, 275, 5, 230, 230, 230);
                 $Test->drawGraphArea(255, 255, 255, true);
                 $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2);
                 $Test->drawGrid(4, true, 230, 230, 230, 50);
                 // Draw the 0 line
                 $Test->setFontProperties("graph/Fonts/tahoma.ttf", 6);
                 $Test->drawTreshold(0, 143, 55, 72, true, true);
                 // Draw the cubic curve graph
                 $Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 50);
                 // Finish the graph
                 $Test->setFontProperties("graph/Fonts/tahoma.ttf", 10);
                 $Test->drawTitle(50, 22, $q['series'], 50, 50, 50, 585);
                 $Test->Render("render/" . $chartname);
             }
         }
     }
     return $imagehashes;
 }
开发者ID:Austin503,项目名称:waca,代码行数:38,代码来源:StatsMonthlyStats.php

示例11: grafico2

function grafico2($dados, $eixo, $grafico)
{
    include_once "pChart/pChart/pData.class";
    include_once "pChart/pChart/pChart.class";
    $DataSet = new pData();
    $DataSet->AddPoint($dados, "Serie1");
    $DataSet->AddPoint($eixo, "Serie2");
    $DataSet->AddAllSeries();
    $DataSet->SetAbsciseLabelSerie("Serie2");
    $Test = new pChart(700, 400);
    $Test->drawFilledRoundedRectangle(7, 7, 700, 430, 5, 180, 216, 216);
    $Test->setFontProperties("pChart/Fonts/tahoma.ttf", 10);
    $Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 270, 210, 210, PIE_PERCENTAGE, TRUE, 50, 20, 5);
    $Test->drawPieLegend(520, 70, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
    $Test->Render("images/" . $grafico);
}
开发者ID:ederfogo00,项目名称:php_robobombeiro,代码行数:16,代码来源:estatistica.php

示例12: dashboardwiki

 public function dashboardwiki()
 {
     $hours = $this->from == $this->to;
     $result = $this->hlp->Query()->dashboardwiki($this->tlimit, $hours);
     $data1 = array();
     $data2 = array();
     $data3 = array();
     $times = array();
     foreach ($result as $time => $row) {
         $data1[] = (int) $row['E'];
         $data2[] = (int) $row['C'];
         $data3[] = (int) $row['D'];
         $times[] = $time . ($hours ? 'h' : '');
     }
     $DataSet = new pData();
     $DataSet->AddPoints($data1, 'Serie1');
     $DataSet->AddPoints($data2, 'Serie2');
     $DataSet->AddPoints($data3, 'Serie3');
     $DataSet->AddPoints($times, 'Times');
     $DataSet->AddAllSeries();
     $DataSet->SetAbscissaLabelSeries('Times');
     $DataSet->SetSeriesName($this->hlp->getLang('graph_edits'), 'Serie1');
     $DataSet->SetSeriesName($this->hlp->getLang('graph_creates'), 'Serie2');
     $DataSet->SetSeriesName($this->hlp->getLang('graph_deletions'), 'Serie3');
     $Canvas = new GDCanvas(700, 280, false);
     $Chart = new pChart(700, 280, $Canvas);
     $Chart->setFontProperties(dirname(__FILE__) . '/pchart/Fonts/DroidSans.ttf', 8);
     $Chart->setGraphArea(50, 10, 680, 200);
     $Chart->drawScale($DataSet, new ScaleStyle(SCALE_NORMAL, new Color(127)), $hours ? 0 : 45, 1, false, ceil(count($times) / 12));
     $Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
     $DataSet->removeSeries('Times');
     $DataSet->removeSeriesName('Times');
     $Chart->drawLegend(550, 15, $DataSet->GetDataDescription(), new Color(250));
     header('Content-Type: image/png');
     $Chart->Render('');
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-statistics,代码行数:36,代码来源:StatisticsGraph.class.php

示例13: array

require_once "../gd-star-config.php";
$wpconfig = get_wpconfig();
require $wpconfig;
global $gdsr;
$data = GDSRChart::votes_counter();
$values = array();
$titles = array();
foreach ($data as $row) {
    $values[] = $row->counter;
    $titles[] = $row->vote;
}
include STARRATING_CHART_PATH . "pchart/pData.class";
include STARRATING_CHART_PATH . "pchart/pChart.class";
$data_set = new pData();
$data_set->AddPoint($values, "Serie1");
$data_set->AddPoint($titles, "Serie2");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie("Serie2");
$chart = new pChart(430, 240);
$chart->loadColorPalette(STARRATING_CHART_PATH . "colors/default.palette");
$chart->drawFilledRoundedRectangle(7, 7, 423, 233, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 425, 235, 5, 230, 230, 230);
$chart->setFontProperties(STARRATING_CHART_PATH . "fonts/quicksand.ttf", 8);
$chart->drawPieGraph($data_set->GetData(), $data_set->GetDataDescription(), 180, 130, 130, PIE_PERCENTAGE, TRUE, 50, 20, 5);
$chart->drawPieLegend(370, 15, $data_set->GetData(), $data_set->GetDataDescription(), 250, 250, 250);
$chart->drawFilledRoundedRectangle(16, 16, 301, 34, 5, 220, 220, 220);
$chart->drawFilledRoundedRectangle(15, 15, 300, 33, 5, 250, 250, 250);
$chart->setFontProperties(STARRATING_CHART_PATH . "fonts/quicksand.ttf", 11);
$chart->drawTitle(20, 29, __("Chart with votes distribution", "gd-star-rating"), 250, 50, 50);
$chart->Stroke();
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:30,代码来源:chart_pie_votes_summary.php

示例14: get_students_attendance_graph

 /**
  * This method return a graph containing informations about students evaluation, it's used inside get_block method for showing it inside dashboard interface
  * @return string  img html
  */
 public function get_students_attendance_graph()
 {
     $students = $this->students;
     $attendance = new Attendance();
     // get data
     $attendances_faults_avg = array();
     if (is_array($students) && count($students) > 0) {
         foreach ($students as $student) {
             $student_id = $student['user_id'];
             //$student_info = api_get_user_info($student_id);
             // get average of faults in attendances by student
             $results_faults_avg = $attendance->get_faults_average_inside_courses($student_id);
             if (!empty($results_faults_avg)) {
                 $attendances_faults_avg[$student['lastname']] = $results_faults_avg['porcent'];
             } else {
                 $attendances_faults_avg[$student['lastname']] = 0;
             }
         }
     }
     arsort($attendances_faults_avg);
     $usernames = array_keys($attendances_faults_avg);
     $faults = array();
     foreach ($usernames as $username) {
         $faults[] = $attendances_faults_avg[$username];
     }
     $graph = '';
     $img_file = '';
     if (is_array($usernames) && count($usernames) > 0) {
         // Defining data
         $data_set = new pData();
         $data_set->AddPoint($faults, "Promedio");
         $data_set->AddPoint($usernames, "Usuario");
         $data_set->AddAllSeries();
         $data_set->SetAbsciseLabelSerie("Usuario");
         // prepare cache for saving image
         $graph_id = $this->user_id . 'StudentEvaluationGraph';
         // the graph id
         $cache = new pCache(api_get_path(SYS_ARCHIVE_PATH));
         $data = $data_set->GetData();
         // return $this->DataDescription
         if ($cache->IsInCache($graph_id, $data_set->GetData())) {
             //if (0) {
             //if we already created the img
             $img_file = $cache->GetHash($graph_id, $data_set->GetData());
             // image file with hash
         } else {
             if (count($usernames) < 5) {
                 $height = 200;
             } else {
                 $height = count($usernames) * 40;
             }
             // Initialise the graph
             $test = new MyHorBar(400, $height + 30);
             $test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
             $test->setGraphArea(100, 30, 370, $height);
             $test->drawFilledRoundedRectangle(7, 7, 393, $height, 5, 240, 240, 240);
             $test->drawRoundedRectangle(5, 5, 395, $height, 5, 230, 230, 230);
             $test->drawGraphArea(255, 255, 255, TRUE);
             //X axis
             $test->setFixedScale(0, 100, 10);
             //var_dump($data_set->GetDataDescription());
             $test->drawHorScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 0, TRUE);
             $test->setColorPalette(0, 255, 0, 0);
             $test->drawHorGrid(10, TRUE, 230, 230, 230, 50);
             // Draw the 0 line
             $test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 6);
             $test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
             // Draw the bar graph
             $test->drawHorBarGraph($data_set->GetData(), $data_set->GetDataDescription(), TRUE, 50);
             $cache->WriteToCache($graph_id, $data_set->GetData(), $test);
             ob_start();
             $test->Stroke();
             ob_end_clean();
             $img_file = $cache->GetHash($graph_id, $data_set->GetData());
         }
         if (!empty($img_file)) {
             $graph = '<img src="' . api_get_path(WEB_ARCHIVE_PATH) . $img_file . '">';
         }
     } else {
         $graph = '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
     }
     return $graph;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:87,代码来源:block_student_graph.class.php

示例15: createChart


//.........这里部分代码省略.........
            }
            $counter = 0;
            foreach ($lbl as $label) {
                $DataSet->SetSerieName($label, "Serie{$counter}");
                $counter++;
            }
            if ($cache->IsInCache("graph" . $language . $iSurveyID, $DataSet->GetData())) {
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
            } else {
                $graph = new pChart(1, 1);
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $legendsize = $graph->getLegendBoxSize($DataSet->GetDataDescription());
                if ($legendsize[1] < 320) {
                    $gheight = 420;
                } else {
                    $gheight = $legendsize[1] + 100;
                }
                $graph = new pChart(690 + $legendsize[0], $gheight);
                $graph->loadColorPalette($homedir . DIRECTORY_SEPARATOR . 'styles' . DIRECTORY_SEPARATOR . $admintheme . DIRECTORY_SEPARATOR . 'limesurvey.pal');
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->setGraphArea(50, 30, 500, $gheight - 60);
                $graph->drawFilledRoundedRectangle(7, 7, 523 + $legendsize[0], $gheight - 7, 5, 254, 255, 254);
                $graph->drawRoundedRectangle(5, 5, 525 + $legendsize[0], $gheight - 5, 5, 230, 230, 230);
                $graph->drawGraphArea(255, 255, 255, TRUE);
                $graph->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 90, 0, TRUE, 5, false);
                $graph->drawGrid(4, TRUE, 230, 230, 230, 50);
                // Draw the 0 line
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
                // Draw the bar graph
                $graph->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), FALSE);
                //$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie4","1","Important point!");
                // Finish the graph
                $graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
                $graph->drawLegend(510, 30, $DataSet->GetDataDescription(), 255, 255, 255);
                $cache->WriteToCache("graph" . $language . $iSurveyID, $DataSet->GetData(), $graph);
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
                unset($graph);
            }
        } else {
            // this block is to remove the items with value == 0
            // and an inelegant way to remove comments from List with Comments questions
            $i = 0;
            while (isset($gdata[$i])) {
                if ($gdata[$i] == 0 || $type == "O" && substr($lbl[$i], 0, strlen($statlang->gT("Comments"))) == $statlang->gT("Comments")) {
                    array_splice($gdata, $i, 1);
                    array_splice($lbl, $i, 1);
                } else {
                    $i++;
                }
            }
            $lblout = array();
            if ($language == 'ar') {
                $lblout = $lbl;
                //reset text order to original
                Yii::import('application.libraries.admin.Arabic', true);
                $Arabic = new Arabic('ArGlyphs');
                foreach ($lblout as $kkey => $kval) {
                    if (preg_match("^[A-Za-z]^", $kval)) {
                        //auto detect if english
                        //eng
                        //no reversing
                    } else {
                        $kval = $Arabic->utf8Glyphs($kval, 50, false);
                        $lblout[$kkey] = $kval;
                    }
                }
            } elseif (getLanguageRTL($language)) {
                $lblout = $lblrtl;
            } else {
                $lblout = $lbl;
            }
            //create new 3D pie chart
            $DataSet = new pData();
            $DataSet->AddPoint($gdata, "Serie1");
            $DataSet->AddPoint($lblout, "Serie2");
            $DataSet->AddAllSeries();
            $DataSet->SetAbsciseLabelSerie("Serie2");
            if ($cache->IsInCache("graph" . $language . $iSurveyID, $DataSet->GetData())) {
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
            } else {
                $gheight = ceil($gheight);
                $graph = new pChart(690, $gheight);
                $graph->loadColorPalette($homedir . '/styles/' . $admintheme . '/limesurvey.pal');
                $graph->drawFilledRoundedRectangle(7, 7, 687, $gheight - 3, 5, 254, 255, 254);
                $graph->drawRoundedRectangle(5, 5, 689, $gheight - 1, 5, 230, 230, 230);
                // Draw the pie chart
                $graph->setFontProperties($rootdir . "/fonts/" . $chartfontfile, $chartfontsize);
                $graph->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 225, round($gheight / 2), 170, PIE_PERCENTAGE, TRUE, 50, 20, 5);
                $graph->setFontProperties($rootdir . "/fonts/" . $chartfontfile, $chartfontsize);
                $graph->drawPieLegend(430, 12, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
                $cache->WriteToCache("graph" . $language . $iSurveyID, $DataSet->GetData(), $graph);
                $cachefilename = basename($cache->GetFileFromCache("graph" . $language . $iSurveyID, $DataSet->GetData()));
                unset($graph);
            }
        }
        //end else -> pie charts
    }
    return $cachefilename;
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:statistics_helper.php


注:本文中的pData::AddAllSeries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。