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


PHP pChart::drawLegend方法代码示例

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


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

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

示例2: pData

// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1");
$DataSet->AddPoint(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 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 cubic curve graph
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 50);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Example 7", 50, 50, 50, 585);
$Test->Render("example7.png");
开发者ID:loopzy,项目名称:my,代码行数:31,代码来源:Example7.php

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

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

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

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

示例7: make


//.........这里部分代码省略.........
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         $style = $this->plot->line_style($name, 'style');
         $line_color = $this->plot->line_style($name, 'color');
         if (!$line_color) {
             $colors[$name] = array('R' => 0, 'G' => 0, 'B' => 0);
         } else {
             $colors[$name] = html_color_to_RGB($line_color);
         }
         $plot->setColorPalette($line_no, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
         if (!$style || $style == 'line' || $style == 'both') {
             $line_width = $this->plot->line_style($name, 'width');
             if (!$line_width) {
                 $line_width = 1;
             }
             $dot_size = $this->plot->line_style($name, 'dot-size');
             if (!$dot_size) {
                 $dot_size = 0;
             }
             $plot->setLineStyle($line_width, $dot_size);
             $plot->drawXYGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no);
         }
         if ($style == 'point' || $style == 'both') {
             $radius = $this->plot->line_style($name, 'radius');
             if (!$radius) {
                 $radius = 5;
             }
             $plot->drawXYPlotGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no, $radius, $radius - 2);
         }
         $line_no++;
     }
     $title = $this->plot->property('title');
     foreach ($columns as $column) {
         $data->removeSerie('Serie' . $column);
     }
     $in_legend = array();
     $description = $data->GetDataDescription();
     $description['Description'] = array();
     $palette_id = 0;
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         if (in_array($name, $in_legend)) {
             continue;
         }
         $in_legend[] = $name;
         $description['Description']['Serie' . $column] = $name;
         $plot->setColorPalette($palette_id, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
         ++$palette_id;
     }
     $legend_box_size = $plot->getLegendBoxSize($description);
     $legend_position = $this->plot->property('legend-position');
     if (!$legend_position) {
         $legend_position = 'top-left';
     }
     switch ($legend_position) {
         case 'top-left':
             $legend_left = 0;
             $legend_top = 0;
             break;
         case 'top':
             $legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
             $legend_top = 0;
             break;
         case 'top-right':
             $legend_left = $width - $left_margin - $h - $legend_box_size[0];
             $legend_top = 0;
             break;
         case 'left':
             $legend_left = 0;
             $legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
             break;
         case 'center':
             $legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
             $legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
             break;
         case 'right':
             $legend_left = $width - $left_margin - $h - $legend_box_size[0];
             $legend_top = ($height - 4 * $h - $legend_box_size[1]) / 2;
             break;
         case 'bottom-left':
             $legend_left = 0;
             $legend_top = $height - 4 * $h - $legend_box_size[1];
             break;
         case 'bottom':
             $legend_left = ($width - $h - $left_margin - $legend_box_size[0]) / 2;
             $legend_top = $height - 4 * $h - $legend_box_size[1];
             break;
         case 'bottom-right':
             $legend_left = $width - $left_margin - $h - $legend_box_size[0];
             $legend_top = $height - 4 * $h - $legend_box_size[1];
             break;
     }
     $plot->drawLegend($left_margin + $legend_left, 2 * $h + $legend_top, $description, 255, 255, 255, 100, 100, 100, 0, 0, 0, true);
     $plot->drawTitle($h, 0, $title, 0, 0, 0, $width - $h, $h * 2, 100);
     $plot->Render($this->path($working_path));
     $file_name = $this->plot->name();
     $plot_name = $this->name();
     $this->log($working_path, "Successfully plotted {$file_name} as {$plot_name}\ntitle: {$title}\n");
     return 0;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:plot.php

示例8: makeGraph

function makeGraph($values, $labels)
{
    $values[] = '0';
    $labels[] = '';
    // Standard inclusions
    include_once "charts/pChart.class";
    include_once "charts/pData.class";
    // Dataset definition
    $DataSet = new pData();
    $DataSet->AddPoint($values, "Serie2");
    $DataSet->AddPoint($labels, "Xlabel");
    $DataSet->AddSerie("Serie2");
    $DataSet->SetAbsciseLabelSerie('Xlabel');
    $DataSet->SetSerieName("No Of Births", "Serie2");
    // Initialise the graph
    $Test = new pChart(700, 230);
    $Test->setFontProperties("Fonts/tahoma.ttf", 8);
    $Test->setGraphArea(50, 30, 585, 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("Fonts/tahoma.ttf", 6);
    $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Draw the bar graph
    $Test->drawOverlayBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
    // Finish the graph
    $Test->setFontProperties("Fonts/tahoma.ttf", 8);
    $Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
    $Test->setFontProperties("Fonts/tahoma.ttf", 10);
    $Test->drawTitle(50, 22, "Change in name popularity", 50, 50, 50, 585);
    ob_start();
    $Test->Stroke();
    $img = ob_get_clean();
    $img = base64_encode($img);
    return $img;
}
开发者ID:kanika022,项目名称:baby-name-project,代码行数:39,代码来源:namewise.php

示例9: pChart

$DataSet->AddPoint(array(9, 9, 9, 10, 10, 11, 12, 14, 16, 17, 18, 18, 19, 19, 18, 15, 12, 10, 9), "Serie1");
$DataSet->AddPoint(array(10, 11, 11, 12, 12, 13, 14, 15, 17, 19, 22, 24, 23, 23, 22, 20, 18, 16, 14), "Serie2");
$DataSet->AddPoint(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Serie3");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetYAxisUnit("°C");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->drawGraphAreaGradient(132, 173, 131, 50, TARGET_BACKGROUND);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(120, 20, 675, 190);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the bar chart
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Draw the title
$Title = "  Average Temperatures during\r\n  the first months of 2008  ";
$Test->drawTextBox(0, 0, 50, 230, $Title, 90, 255, 255, 255, ALIGN_BOTTOM_CENTER, TRUE, 0, 0, 0, 30);
// Draw the legend
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
// Render the picture
$Test->addBorder(2);
$Test->Render("example23.png");
开发者ID:han905,项目名称:pChart-php5,代码行数:31,代码来源:Example23.php

示例10: drawBar

 /**
  * Draw bar style chart
  * @return unknown
  */
 protected function drawBar()
 {
     // 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
     $chart_w = $this->w - 150;
     // Chart frame witdh
     $chart_h = $this->h - 40;
     // Chart frame heigth
     $title_w = $this->w - 200;
     // Title width
     $title_h = 45;
     // Title height
     $legend_w = $chart_w + 30;
     // Legend width
     $legend_h = 40;
     // Legend height
     // chart styles
     $grid = isset($this->p['grid']) ? $this->p['grid'] : 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)
     $this->chart->setGraphArea(90, 40, $chart_w, $chart_h);
     // setGraphArea($X1,$Y1,$X2,$Y2)
     $this->chart->drawGraphArea(255, 255, 255, TRUE);
     // drawGraphArea($R,$G,$B)
     $this->chart->drawScale($this->data->GetData(), $this->data->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, $this->margin, $this->skip);
     // drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
     $this->data->RemoveSerie('DEFAULT_SCALE');
     // clear scale serie for setScale method
     // draw grid
     if ($grid) {
         $this->chart->drawGrid(3, TRUE, 230, 230, 230, 50);
         // drawGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=255)
     }
     // draw the cubic curve graph
     $this->chart->drawBarGraph($this->data->GetData(), $this->data->GetDataDescription(), TRUE);
     // 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)
     // add Legend
     $this->chart->setFontProperties($this->font, 8);
     $this->chart->drawLegend($legend_w, $legend_h, $this->data->GetDataDescription(), 255, 255, 255);
     // drawLegend($description,$R,$G,$B)
 }
开发者ID:LWFeng,项目名称:hush,代码行数:64,代码来源:Chart.php

示例11: writeBarData

function writeBarData($data, $graph)
{
    if ($data != "") {
        echo "Plottong " . $graph . "\n";
        $dataset1 = array();
        $dataset2 = array();
        $counter = 0;
        $toggle = true;
        $data = array_reverse($data, TRUE);
        ksort($data);
        foreach ($data as $key => $value) {
            if ($counter % 5 != 0) {
                $key = " ";
            }
            array_push($dataset1, $key);
            array_push($dataset2, $value);
            $counter++;
        }
        // Dataset definition
        $DataSet = new pData();
        $DataSet->AddPoint($dataset2, "Serie1");
        $DataSet->AddPoint($dataset1, "XLabel");
        $DataSet->AddAllSeries();
        $DataSet->SetAbsciseLabelSerie("XLabel");
        $DataSet->RemoveSerie("XLabel");
        $DataSet->SetSerieName("Membership", "Serie1");
        // Initialise the graph
        $Test = new pChart(700, 230);
        $Test->setFontProperties("Fonts/tahoma.ttf", 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("Fonts/tahoma.ttf", 6);
        $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
        // Draw the bar graph
        $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
        // Finish the graph
        $Test->setFontProperties("Fonts/tahoma.ttf", 8);
        $Test->drawLegend(596, 150, $DataSet->GetDataDescription(), 255, 255, 255);
        $Test->setFontProperties("Fonts/tahoma.ttf", 10);
        $Test->drawTitle(50, 22, "Membership by Month", 50, 50, 50, 585);
        $Test->Render("{$graph}-bar.png");
    }
}
开发者ID:nhandler,项目名称:locotools,代码行数:48,代码来源:chart.php

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

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

示例14: array


//.........这里部分代码省略.........
                         //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());
                     }
                     echo '<img src="' . api_get_path(WEB_ARCHIVE_PATH) . $img_file . '" >';
                     if ($i % 2 == 0 && $i != 0) {
                         echo '<br />';
                     }
                     $i++;
                 }
             }
             //end foreach
         } else {
             echo get_lang('ToViewGraphScoreRuleMustBeEnabled');
         }
         // Pie charts
         /*
         $show_draw = false;
         $resource_list = array();
         //print_r($pre_result_pie);
         
         if ($total_users>0) {
             foreach($pre_result_pie as $key=>$res_array) {
                 //$resource_list
                 foreach($res_array as $user_result) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:67,代码来源:flatviewtable.class.php

示例15:

$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Clear the scale
$Test->clearScale();
// Draw the 2nd graph
/*$DataSet->RemoveSerie("Serie1");  
 $DataSet->AddSerie("Serie2");  
 $DataSet->SetYAxisName("Web Hits");  
 $Test->drawRightScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,213,217,221,TRUE,0,0);  
 $Test->drawGrid(4,TRUE,230,230,230,10);  
 $Test->setShadowProperties(3,3,0,0,0,30,4);  
 $Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());  
 $Test->clearShadow();  
 $Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),.1,30);  
 $Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);  */
// Write the legend (box less)
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(530, 5, $DataSet->GetDataDescription(), 0, 0, 0, 0, 0, 0, 255, 255, 255, FALSE);
// Write the title
$Test->setFontProperties("../Fonts/tahoma.ttf", 18);
$Test->setShadowProperties(1, 1, 0, 0, 0);
$Test->drawTitle(0, 0, "Comparison of Fuel usage in 2015", 255, 255, 255, 660, 30, TRUE);
$Test->clearShadow();
// Render the picture
$Test->Render("clientsGraph.png");
?>
  
开发者ID:bettirosengugi,项目名称:My-Web-Projects,代码行数:30,代码来源:fancygraph.php


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