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


PHP pChart::setFontProperties方法代码示例

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


在下文中一共展示了pChart::setFontProperties方法的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: drawPie

 /**
  * Draw pie chart
  * @return unknown
  */
 protected function drawPie()
 {
     // prepare font & series
     $this->_prepareSerie();
     $this->_prepareFont();
     // init chart params
     $outer_w = $this->w - 5;
     // Outer frame witdh
     $outer_h = $this->h - 5;
     // Outer frame heigth
     $inner_w = $this->w - 7;
     // Inner frame witdh
     $inner_h = $this->h - 7;
     // Inner frame heigth
     $pie_x = intval(($this->w - 150) / 2);
     // Pie witdh
     $pie_y = intval(($this->h - 10) / 2);
     // Pie heigth
     $pie_r = intval($pie_x - 50);
     // Pie radius
     $title_w = $this->w - 200;
     // Title width
     $title_h = 50;
     // Title height
     $legend_w = $this->w - 120;
     // Legend width
     $legend_h = 50;
     // Legend height
     // chart styles
     $flat = isset($this->p['flat']) ? $this->p['flat'] : false;
     // fill chart
     $this->chart->drawBackground(255, 255, 255);
     $this->chart->setFontProperties($this->font, 7);
     // set font and size
     $this->chart->drawRoundedRectangle(5, 5, $outer_w, $outer_h, 10, 230, 230, 230);
     // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     $this->chart->drawFilledRoundedRectangle(7, 7, $inner_w, $inner_h, 10, 240, 240, 240);
     // drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$R,$G,$B)
     // draw the pie chart
     $this->chart->setFontProperties($this->font, 8);
     // flat pie
     if ($flat) {
         $this->chart->drawFlatPieGraphWithShadow($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, 10);
         // 3d pie
     } else {
         $this->chart->drawPieGraph($this->data->GetData(), $this->data->GetDataDescription(), $pie_x, $pie_y, $pie_r, PIE_PERCENTAGE, TRUE, 50, 20, 5, 1);
     }
     $this->chart->drawPieLegend($legend_w, $legend_h, $this->data->GetData(), $this->data->GetDataDescription(), 250, 250, 250);
     // add title
     $this->chart->setFontProperties($this->font, 10);
     $this->chart->drawTitle(40, 0, $this->title, 50, 50, 50, $title_w, $title_h);
     // drawTitle($XPos,$YPos,$Value,$R,$G,$B,$XPos2=-1,$YPos2=-1,$Shadow=FALSE)
 }
开发者ID:LWFeng,项目名称:hush,代码行数:57,代码来源:Chart.php

示例3: drawChart

function drawChart($title, $DataSet, $names, $colors, $legend = false)
{
    // Initialise the graph
    $Chart = new pChart(1300, 750);
    $Chart->setFontProperties("Fonts/tahoma.ttf", 8);
    $Chart->setGraphArea(50, 25, 1200, 725);
    $Chart->drawGraphArea(255, 255, 255, TRUE);
    $Chart->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "ally", "allx", 150, 150, 150, TRUE, 45);
    $Chart->setLineStyle(4);
    // Draw the 0 line
    $Chart->setFontProperties("Fonts/tahoma.ttf", 6);
    $Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    foreach ($colors as $idx => $color) {
        $Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
    }
    $i = 0;
    foreach ($names as $name) {
        $Chart->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $name . "y", $name . "x", $i);
        $i++;
    }
    if ($legend) {
        $Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
    }
    // Finish the graph
    $Chart->setFontProperties("Fonts/tahoma.ttf", 10);
    //  $Chart->drawTitle(60,22,$title,50,50,50,530);
    $Chart->Stroke();
}
开发者ID:FigBug,项目名称:GamenightEx,代码行数:28,代码来源:allelo.php

示例4: 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

示例5: _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

示例6: drawChart

function drawChart($title, $DataSet, $type, $colors, $legend = false)
{
    // Initialise the graph
    $Chart = new pChart(1300, 700);
    $Chart->setFontProperties("Fonts/tahoma.ttf", 8);
    $Chart->setGraphArea(50, 50, 1200, 600);
    $Chart->drawGraphArea(255, 255, 255, TRUE);
    $Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 0, TRUE);
    // Draw the 0 line
    $Chart->setFontProperties("Fonts/tahoma.ttf", 6);
    $Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    foreach ($colors as $idx => $color) {
        $Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
    }
    if ($type == "bar") {
        $Chart->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
    } else {
        if ($type == "line") {
            $Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
        }
    }
    if ($legend) {
        $Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
    }
    // Finish the graph
    $Chart->setFontProperties("Fonts/tahoma.ttf", 10);
    $Chart->drawTitle(60, 22, $title, 50, 50, 50, 530);
    $Chart->Stroke();
}
开发者ID:FigBug,项目名称:GamenightEx,代码行数:29,代码来源:graphfunclarge.php

示例7: createGraphToFile

/**
 * Генерация графика
 * @param DataSet $DataSet
 * @param String $GraphTitle
 * @param String $safeToFile
 */
function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat)
{
    // Rotrate
    $rotate = 30;
    // Initialise the graph
    $GraphImage = new pChart(594, 344);
    $GraphImage->setDateFormat($scaleFormat);
    // $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt');
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8);
    $GraphImage->setGraphArea(80, 50, 580, 300);
    $GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240);
    $GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230);
    $GraphImage->drawGraphArea(255, 255, 255, TRUE);
    $GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE);
    $GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6);
    $GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Просто пунктирная линия
    // Draw the cubic curve graph
    $GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    // Draw the line graph
    //$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
    $GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
    // Finish the graph
    $GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12);
    $GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600);
    //$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png');
    $GraphImage->Stroke();
}
开发者ID:rootree,项目名称:vk-footboller-content-system,代码行数:36,代码来源:graph.php

示例8: generateGraph

function generateGraph($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to)
{
    $myarr = graphTests($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
    $myarr1 = graphErrs($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
    $myarr2 = graphLbls($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
    // Standard inclusions
    include "pChart/pChart/pData.class";
    include "pChart/pChart/pChart.class";
    // Dataset definition
    $DataSet = new pData();
    $DataSet->AddPoint($myarr, "Serie1");
    $DataSet->AddPoint($myarr1, "Serie2");
    $DataSet->AddPoint($myarr2, "Serie3");
    $DataSet->AddSerie("Serie1");
    $DataSet->AddSerie("Serie2");
    $DataSet->SetAbsciseLabelSerie("Serie3");
    $DataSet->SetSerieName("Test Resulting trends", "Serie1");
    $DataSet->SetSerieName("Errors in tests", "Serie2");
    $DataSet->SetYAxisName("Tests");
    // $DataSet->SetYAxisFormat("time");
    $DataSet->SetXAxisName("months");
    // Initialise the graph
    $Test = new pChart(750, 330);
    $Test->setFontProperties("Fonts/tahoma.ttf", 8);
    $Test->setGraphArea(85, 30, 650, 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);
    $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $Test->setFontProperties("Fonts/tahoma.ttf", 6);
    $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // 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("Fonts/tahoma.ttf", 8);
    $Test->drawLegend(90, 35, $DataSet->GetDataDescription(), 255, 255, 255);
    $Test->setFontProperties("Fonts/tahoma.ttf", 10);
    $Test->drawTitle(60, 22, "Test Summary", 50, 50, 50, 585);
    $Test->Render("mpdf.png");
}
开发者ID:OmondiKevin,项目名称:CD4,代码行数:43,代码来源:mailpdf.php

示例9: make

 public function make($working_path)
 {
     // This will import the file http://my.domain.com/myData.csv using each column as a serie
     if (!$this->plot->valid()) {
         $file = $this->plot->name();
         $error = $this->plot->error();
         $this->log($working_path, "Plot file {$file} is invalid: {$error}");
         return 1;
     }
     $data = new pData();
     $columns = array();
     $all_columns = array();
     $x_column = $this->plot->property('x_column') - 1;
     if ($x_column === NULL) {
         $x_column = 0;
     }
     $data_file = $this->plot->data_property('name');
     $deliminator = $this->plot->data_property('deliminator');
     $has_header = $this->plot->data_property('header') == 'yes';
     foreach ($this->plot->columns() as $column => $name) {
         if ($column != $x_column + 1) {
             $columns[] = $column - 1;
         }
         $all_columns[] = $column - 1;
     }
     $data->ImportFromCSV($working_path . $data_file, $deliminator, $all_columns, $has_header);
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         $data->AddSerie('Serie' . $column);
         $data->SetSerieName($name, "Serie" . $column);
     }
     $max_col = -1;
     $max_val = NULL;
     foreach ($data->GetData() as $record) {
         foreach ($columns as $column) {
             $point = $record['Serie' . $column];
             if ($max_val === NULL || $point > $max_val) {
                 $max_val = $point;
                 $max_col = $column;
             }
         }
     }
     $x_label = $this->plot->axis_property('x', 'label');
     if ($x_label) {
         $data->SetXAxisName($x_label);
     } else {
         $data->SetXAxisName($this->plot->column($x_column + 1));
     }
     $x_unit = $this->plot->axis_property('x', 'unit');
     if ($x_unit) {
         $data->SetXAxisUnit($x_unit);
     }
     $y_label = $this->plot->axis_property('y', 'label');
     reset($columns);
     if ($y_label) {
         $data->SetYAxisName($y_label);
     } else {
         $data->SetYAxisName($this->plot->column(current($columns) + 1));
     }
     $y_unit = $this->plot->axis_property('y', 'unit');
     if ($y_unit) {
         $data->SetyAxisUnit($y_unit);
     }
     $width = $this->plot->property('width');
     if (!$width) {
         $width = 640;
     }
     $height = $this->plot->property('height');
     if (!$height) {
         $height = 480;
     }
     $plot = new pChart($width, $height);
     $font_name = $this->plot->property('font-name');
     if (!$font_name) {
         $font_name = 'tahoma.ttf';
     }
     $font_name = 'lib/plugins/projects/pchart/fonts/' . $font_name;
     $font_size = $this->plot->property('font_size');
     if (!$font_size) {
         $font_size = 12;
     }
     $plot->setFontProperties($font_name, $font_size);
     $h = $font_size + 10;
     $left_margin = 0;
     foreach ($data->GetData() as $record) {
         $position = imageftbbox($font_size, 0, $font_name, $record['Serie' . $max_col]);
         $text_width = $position[2] - $position[0];
         if ($text_width > $left_margin) {
             $left_margin = $text_width;
         }
     }
     $left_margin += 2 * $h;
     $plot->setGraphArea($left_margin, 2 * $h, $width - $h, $height - 2 * $h);
     $background = $this->plot->property('background');
     if (!$background) {
         $background = array('R' => 255, 'G' => 255, 'B' => 255);
     } else {
         $background = html_color_to_RGB($background);
     }
     $plot->drawGraphArea($background['R'], $background['G'], $background['B']);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:plot.php

示例10: 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

示例11: 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

示例12: 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

示例13: generateGraph

 /**
  * Create graph (a .png file)
  *
  * @param string $file
  */
 public function generateGraph($file)
 {
     $patientValues = Storage::getInstance()->getPatientsData($file);
     /*
      * pGraph work
      */
     $dataSet = new pData();
     if (!empty($patientValues)) {
         $dataSet->AddPoint(array_keys($patientValues[$file]), 'label');
         $dataSet->SetAbsciseLabelSerie('label');
         $serie1 = array_values($patientValues[$file]);
         $average = round(array_sum($serie1) / count($serie1), 2);
         $dataSet->AddPoint($serie1, "Serie1");
         $dataSet->AddSerie("Serie1");
         // Initialise the graph
         $graph = new MyHorBar(450, 600);
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 8);
         $graph->setGraphArea(120, 60, 410, 550);
         $graph->drawFilledRoundedRectangle(7, 7, 443, 593, 5, 240, 240, 240);
         $graph->drawRoundedRectangle(5, 5, 443, 595, 5, 230, 230, 230);
         $graph->drawGraphArea(255, 255, 255, true);
         $graph->drawHorScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, true, 0, 2, true);
         $graph->drawHorGrid(10, true, 230, 230, 230, 50);
         // Draw the 0 line
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 6);
         $graph->drawTreshold($average, 143, 55, 72, true, false, 2, null, 90);
         // Draw the bar graph
         $graph->drawHorBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), false);
         // Finish the graph
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
         $graph->drawLegend(15, 15, $dataSet->GetDataDescription(), 255, 255, 255);
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
         $graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
     } else {
         $graph = new pChart(450, 150);
         $graph->setGraphArea(120, 60, 410, 100);
         $graph->drawFilledRoundedRectangle(7, 7, 443, 143, 5, 240, 240, 240);
         $graph->drawRoundedRectangle(5, 5, 443, 145, 5, 230, 230, 230);
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
         $graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
         $graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 36);
         $graph->drawTitle(125, 90, 'No data!', 245, 50, 50, -1);
     }
     $graph->Render(WWW_DIR . '/images/graphs/' . $file . '.png');
 }
开发者ID:srigi,项目名称:nette-patients,代码行数:50,代码来源:Graphs.php

示例14: array


//.........这里部分代码省略.........
                 $resource = array_reverse($resource, true);
                 foreach ($resource as $name => $cant) {
                     $DataSet->AddPoint($cant, "Serie" . $j);
                     $DataSet->SetSerieName(strip_tags($name), "Serie" . $j);
                     $j++;
                 }
                 //print_r($pre_result); print_r($header_name);
                 // Dataset definition
                 $DataSet->AddAllSeries();
                 $DataSet->SetAbsciseLabelSerie('');
                 $DataSet->SetXAxisName(get_lang('GradebookSkillsRanking'));
                 $DataSet->SetYAxisName(get_lang('Students'));
                 $show_draw = true;
                 // Cache definition
                 $Cache = new pCache();
                 // the graph id
                 $gradebook_id = intval($_GET['selectcat']);
                 $graph_id = api_get_user_id() . 'ByResource' . $gradebook_id . api_get_course_id() . api_get_session_id();
                 if ($show_draw) {
                     //if ($Cache->IsInCache($graph_id, $DataSet->GetData())) {
                     if (0) {
                         //if we already created the img we get the img file id
                         //echo 'in cache';
                         $img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
                     } else {
                         // if the image does not exist in the archive/ folder
                         // Initialise the graph
                         $chart_size_w = 480;
                         $chart_size_h = 250;
                         $Test = new pChart($chart_size_w, $chart_size_h);
                         // Adding the color schemma
                         $Test->loadColorPalette(api_get_path(LIBRARY_PATH) . "pchart/palette/pastel.txt");
                         // set font of the axes
                         $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 8);
                         $area_graph_w = $chart_size_w - 130;
                         $Test->setGraphArea(50, 30, $area_graph_w, $chart_size_h - 50);
                         $Test->drawFilledRoundedRectangle(5, 5, $chart_size_w - 1, $chart_size_h - 20, 5, 240, 240, 240);
                         //$Test->drawRoundedRectangle(5,5,790,330,5,230,230,230);
                         //background color area & stripe or not
                         $Test->drawGraphArea(255, 255, 255, TRUE);
                         //Setting max height by default see #3296
                         if (!empty($max)) {
                             $Test->setFixedScale(0, $max);
                         }
                         $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALLSTART0, 150, 150, 150, TRUE, 0, 0, FALSE);
                         //background grid
                         $Test->drawGrid(4, 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->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
                         //Set legend properties: width, height and text color and font
                         $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 9);
                         $Test->drawLegend($area_graph_w + 10, 50, $DataSet->GetDataDescription(), 255, 255, 255);
                         //Set title properties
                         $Test->setFontProperties(api_get_path(LIBRARY_PATH) . "pchart/fonts/tahoma.ttf", 10);
                         $Test->drawTitle(50, 22, strip_tags($header_name[$i - 1]), 50, 50, 80, $chart_size_w - 50);
                         //------------------
                         //echo 'not in cache';
                         $Cache->WriteToCache($graph_id, $DataSet->GetData(), $Test);
                         //ob_start();
                         //$Test->Stroke();
                         //ob_end_clean();
                         $img_file = $Cache->GetHash($graph_id, $DataSet->GetData());
                     }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:67,代码来源:flatviewtable.class.php

示例15: checkRights

$pChartCfg->YSize = 400;
$pChartCfg->centerX = intval($pChartCfg->XSize / 2);
$pChartCfg->centerY = intval($pChartCfg->YSize / 2);
$pChartCfg->radius = 150;
$pChartCfg->legendX = 10;
$pChartCfg->legendY = 15;
$graph = new stdClass();
$graph->data = $DataSet->GetData();
$graph->description = $DataSet->GetDataDescription();
$Test = new pChart($pChartCfg->XSize, $pChartCfg->YSize);
foreach ($series_color as $key => $hexrgb) {
    $rgb = str_split($hexrgb, 2);
    $Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
}
// Draw the pie chart
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
$Test->AntialiasQuality = 0;
$Test->drawBasicPieGraph($graph->data, $graph->description, $pChartCfg->centerX, $pChartCfg->centerY, $pChartCfg->radius, PIE_PERCENTAGE, 255, 255, 218);
$Test->drawPieLegend($pChartCfg->legendX, $pChartCfg->legendY, $graph->data, $graph->description, 250, 250, 250);
$Test->Stroke();
function checkRights(&$db, &$user)
{
    return $user->hasRight($db, 'testplan_metrics');
}
/**
 * 
 *
 */
function init_args()
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:platformPieChart.php


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