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


PHP pImage::drawBarChart方法代码示例

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


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

示例1: grafico

/**
 * Gera um gráfico de linha
 * @param array $dados Array no formato array('Label' => array(pontos))
 * @param string $tipo linha ou barra
 */
function grafico($dados, $tipo = 'linha')
{
    require_once 'exemplos/graficos/pChart/class/pDraw.class.php';
    require_once 'exemplos/graficos/pChart/class/pImage.class.php';
    require_once 'exemplos/graficos/pChart/class/pData.class.php';
    // precisamos ter dados para montar os gráficos
    $DataSet = new pData();
    // Adicionando os pontos de um gráfico de linha
    // horas de trabalho na semana
    foreach ($dados as $label => $pontos) {
        $DataSet->addPoints($pontos, $label);
    }
    $DataSet->setAxisName(0, 'Horas');
    // unidade
    $DataSet->setAxisUnit(0, 'h');
    $settings = array("R" => 229, "G" => 11, "B" => 11, "Alpha" => 80);
    $DataSet->setPalette("Joao", $settings);
    // Labels
    $DataSet->addPoints(array('Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'), 'Dias');
    $DataSet->setSerieDescription('Dias', 'Dias da Semana');
    $DataSet->setAbscissa('Dias');
    $Graph = new pImage(700, 230, $DataSet);
    $Graph->setFontProperties(array('FontName' => 'exemplos/graficos/pChart/fonts/verdana.ttf', 'FontSize' => 8));
    $Graph->setGraphArea(50, 40, 670, 190);
    $scale = array('GridR' => 150, 'GridG' => 150, 'GridB' => 150, 'DrawSubTicks' => true, 'CycleBackground' => true);
    $Graph->drawScale($scale);
    if ($tipo == 'linha') {
        $Graph->drawLineChart();
    } else {
        $Graph->drawBarChart();
    }
    $Graph->drawLegend(540, 25, array('Style' => LEGEND_ROUND, 'Mode' => LEGEND_VERTICAL));
    $Graph->drawText(60, 20, "Horas Trabalhadas");
    $Graph->autoOutput();
}
开发者ID:TiagoRodrigoLima,项目名称:gerencia-net-php-essentials,代码行数:40,代码来源:teste.php

示例2: index

 function index()
 {
     $width = 600;
     $height = 230;
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->addPoints(array(-4, VOID, VOID, 12, 8, 3), "Female");
     $MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Male");
     //$MyData->addPoints(array(2,0,5,18,19,22),"Probe 3");
     $MyData->setSerieTicks("Male", 4);
     $MyData->setAxisName(0, "Number of males, females");
     $MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
     $MyData->setSerieDescription("Labels", "Months");
     $MyData->setAbscissa("Labels");
     /* Create the pChart object */
     $myPicture = new pImage($width, $height, $MyData);
     /* Draw the background */
     $Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
     $myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
     /* Overlay with a gradient */
     $Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
     $myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
     //$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));
     /* Add a border to the picture */
     $myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
     /* Write the picture title */
     //$myPicture->setFontProperties(array("FontName"=>pClass."fonts/Silkscreen.ttf","FontSize"=>6));
     //$myPicture->drawText(10,13,"drawBarChart() - draw a bar chart",array("R"=>255,"G"=>255,"B"=>255));
     /* Write the chart title */
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 11));
     $myPicture->drawText(250, 55, "Average time to find a set", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
     /* Draw the scale and the 1st chart */
     $myPicture->setGraphArea(60, 60, 450, 190);
     $myPicture->drawFilledRectangle(60, 60, 450, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
     $myPicture->drawScale(array("DrawSubTicks" => TRUE));
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/pf_arma_five.ttf", "FontSize" => 10));
     $myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => TRUE, "Surrounding" => 30));
     //$myPicture->drawBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Surrounding"=>30));
     $myPicture->setShadow(FALSE);
     /* Draw the scale and the 2nd chart */
     /*
     $myPicture->setGraphArea(500,60,670,190);
     $myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
     $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE));
     $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
     $myPicture->drawBarChart();
     $myPicture->setShadow(FALSE);
     */
     /* Write the chart legend */
     //$myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
     $myPicture->drawLegend(500, 105, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
     /* Render the picture (choose the best way) */
     $myPicture->stroke();
 }
开发者ID:BGCX067,项目名称:facebook-slt-svn-to-git,代码行数:55,代码来源:avgtime.php

示例3: renderChart

 function renderChart($chartType, $title, $prepData, $legend)
 {
     $width = 800;
     $height = 500;
     $titleHeight = 20;
     /*
      * Create a dataset we can use
      */
     $dataSet = array_values($prepData);
     $imgData = new pData();
     if ($chartType == "bar") {
         $imgData->addPoints($dataSet, "data");
         $imgData->addPoints($legend, "legend");
         $imgData->setAbscissa("legend");
         $imgData->setPalette("data", array("R" => 0, "G" => 108, "B" => 171, "Alpha" => 100));
         $img = new pImage($width, $height, $imgData);
         $img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
         $img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
         $img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
         $img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
         $img->setFontProperties(array("R" => 255, "G" => 255, "B" => 255, "FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
         $img->setGraphArea(60, $titleHeight + 20, $width - 50, $height - 30);
         $img->drawScale(array("GridR" => 200, "GridG" => 200, "GridB" => 200, "Mode" => SCALE_MODE_START0));
         $img->drawBarChart(array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Surrounding" => 10));
     } elseif ($chartType == "3Dpie") {
         $imgData->addPoints($dataSet, "data");
         $imgData->addPoints($legend, "legend");
         $imgData->setAbscissa("legend");
         $img = new pImage($width, $height, $imgData, TRUE);
         $PieChart = new pPie($img, $imgData);
         $img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
         $img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
         $img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
         $img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
         $PieChart->setSliceColor(0, array("R" => 0, "G" => 108, "B" => 171));
         $PieChart->setSliceColor(1, array("R" => 205, "G" => 159, "B" => 0));
         $PieChart->setSliceColor(2, array("R" => 0, "G" => 171, "B" => 0));
         $PieChart->setSliceColor(3, array("R" => 171, "G" => 28, "B" => 0));
         $img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
         $PieChart->draw3DPie($width / 2, $height / 2 + $titleHeight, array("Radius" => $width / 2 - 100, "SecondPass" => TRUE, "DrawLabels" => TRUE, "WriteValues" => TRUE, "Precision" => 2, "ValueR" => 0, "ValueG" => 0, "ValueB" => 0, "ValueAlpha" => 100, "SkewFactor" => 0.6, "LabelR" => 255, "LabelG" => 255, "LabelB" => 255, "LabelAlpha" => 100));
     }
     # if
     if (isset($img)) {
         ob_start();
         $img->render(NULL);
         $imageString = ob_get_clean();
         $dimensions = $this->_svcImageUtil->getImageDimensions($imageString);
         return array('metadata' => $dimensions, 'content' => $imageString);
     } else {
         return false;
     }
     # else
 }
开发者ID:Ernie69,项目名称:spotweb,代码行数:53,代码来源:Services_Image_Chart.php

示例4: columnChart

 /**
  *
  * @param array $data
  * @param string $title
  * @return resource
  */
 public static function columnChart(array $data, $title, $scaleConfig = array(), $legendConfig = array())
 {
     $fontsChart = APPLICATION_PATH . '/../library/pChart/fonts/verdana.ttf';
     App_Util_Chart::loadClass(array('pData', 'pDraw', 'pImage'));
     $myData = new pData();
     foreach ($data['series'] as $c => $serie) {
         $serieId = 'Serie' . $c;
         $myData->addPoints($serie, $serieId);
         $myData->setSerieDescription($serieId, $data['names'][$c]);
         $myData->setSerieOnAxis($serieId, 0);
     }
     $myData->addPoints($data['labels'], 'Absissa');
     $myData->setAbscissa('Absissa');
     $myData->setAxisPosition(0, AXIS_POSITION_LEFT);
     $myPicture = new pImage(700, 500, $myData);
     $Settings = array("R" => 250, "G" => 250, "B" => 250);
     $myPicture->drawFilledRectangle(0, 0, self::$_width, self::$_height, $Settings);
     $myPicture->drawRectangle(0, 0, self::$_width - 1, self::$_height - 1, array("R" => 0, "G" => 0, "B" => 0));
     $myPicture->setFontProperties(array("FontName" => $fontsChart . "verdana.ttf", "FontSize" => 14));
     $myPicture->setGraphArea(50, 50, self::$_width - 1, self::$_height - 100);
     $myPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => $fontsChart, "FontSize" => 10));
     $Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_START0, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "CycleBackground" => 1, "LabelRotation" => 45, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
     foreach ($scaleConfig as $c => $v) {
         $Settings[$c] = $v;
     }
     $myPicture->drawScale($Settings);
     $Config = array("DisplayValues" => 1, "AroundZero" => 1, "Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN);
     $myPicture->drawBarChart($Config);
     $pos = floor(strlen($title) / 2);
     $start = 350 - $pos * 9;
     $myPicture->setFontProperties(array('FontName' => $fontsChart, 'FontSize' => 14));
     $myPicture->drawText($start, 25, $title, array('R' => 0, 'G' => 0, 'B' => 0));
     $Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => $fontsChart, "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
     foreach ($legendConfig as $c => $v) {
         $Config[$c] = $v;
     }
     $myPicture->drawLegend(480, 40, $Config);
     ob_start();
     imagepng($myPicture->Picture);
     $image = ob_get_clean();
     return $image;
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:48,代码来源:Chart.php

示例5: array

 function func_bargraphGenerate($student_id, $time, $type, $basepath, $success, $r = "", $g = "", $b = "", $name)
 {
     $bookIdResult = $this->func_getBookId('1,2');
     $bookID = array();
     foreach ($bookIdResult as $book) {
         $bookID[] = $book['book_id'];
     }
     $getActivityTypeIdResult = $this->func_getActivityTypeId('WORD HUNT');
     foreach ($getActivityTypeIdResult as $activityTypeId) {
         $activityTypeId = $activityTypeId['activity_type_id'];
     }
     $getActivityIdResult = $this->func_getActivityId($bookID, $activityTypeId);
     $actId = array();
     foreach ($getActivityIdResult as $activityId) {
         $actId[] = $activityId['activity_id'];
     }
     $actNewId = implode(',', $actId);
     $k = 0;
     $j = 0;
     for ($i = 0; $i < 5; $i = $i + 1) {
         $date[$k] = date("Y-m-d", strtotime("-{$i} day"));
         $dateRec[] = date('M d', strtotime("-{$i} day"));
         $k = $k + 1;
     }
     $successaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", $success);
     $totalaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", '0,1');
     for ($i = 0; $i < 5; $i = $i + 1) {
         $j = $i;
         if ($totalaccessmentResult['0']['count_' . $j] == "0") {
             $totalaccessmentResult['0']['count_' . $j] = 1;
         }
         $per[$i] = $successaccessmentResult['0']['count_' . $j] / $totalaccessmentResult['0']['count_' . $j] * 100;
     }
     $MyData = new pData();
     $MyData->addPoints($per, "Server A");
     $MyData->setAxisName(0, "Percentage");
     $MyData->addPoints(array_reverse($dateRec), "Months");
     $MyData->setSerieDescription("Months", "Month");
     $MyData->setAbscissa("Months");
     $myPicture = new pImage(350, 230, $MyData);
     /* Turn of Antialiasing */
     $myPicture->Antialias = FALSE;
     /* Add a border to the picture */
     $myPicture->drawGradientArea(0, 0, 400, 230, DIRECTION_VERTICAL, array("StartR" => 255, "StartG" => 255, "StartB" => 255, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
     // $myPicture->drawRectangle(0,0,400,229,array("R"=>0,"G"=>0,"B"=>0));
     /* Set the default font */
     $myPicture->setFontProperties(array("FontName" => $basepath . "Silkscreen.ttf", "FontSize" => 6));
     /* Define the chart area */
     $myPicture->setGraphArea(60, 40, 350, 200);
     /* Draw the scale */
     $scaleSettings = array("GridR" => 300, "GridG" => 300, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => FALSE, "Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_MANUAL, "LabelingMethod" => LABELING_ALL);
     $myPicture->drawScale($scaleSettings);
     /* Turn on shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     /* Draw the chart */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     $settings = array("Surrounding" => -30, "InnerSurrounding" => 30, "Mode" => 0);
     $myPicture->drawBarChart($settings, $r, $g, $b);
     /* Render the picture (choose the best way) */
     $picname = $student_id . '_' . $name . '_' . $time . '.png';
     $this->fun_getImageLog($student_id, $picname, $type, $time, $name);
     $myPicture->render("uploads/graph/" . $picname);
 }
开发者ID:rohitbatra1987,项目名称:ruckus_dev,代码行数:63,代码来源:CommonFunctions.class.php

示例6: plotBarChart

 protected function plotBarChart(pImage $picture, $options = array())
 {
     $picture->setShadow(FALSE);
     $Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "DrawXLines" => FALSE, "DrawYLines" => ALL, "GridTicks" => 1, "GridR" => 168, "GridG" => 186, "GridB" => 203, "GridAlpha" => 30, "AxisR" => 40, "AxisG" => 40, "AxisB" => 43, "AxisAlpha" => 100, "TickR" => 40, "TickG" => 40, "TickB" => 43, "TickAlpha" => 50, "DrawSubTicks" => 1, "SubTickR" => 168, "SubTickG" => 186, "SubTickB" => 203, "SubTickAlpha" => 100, "DrawArrows" => false, "CycleBackground" => false, "LabelRotation" => 90);
     $Settings = array_merge($Settings, $options);
     $picture->drawScale($Settings);
     $options = array('AroundZero' => true, 'Draw0Line' => true);
     $picture->drawBarChart($options);
     $Config = array("FontName" => sfConfig::get('sf_web_dir') . "/fonts/Ubuntu-R.ttf", "FontSize" => 6, "FontR" => 40, "FontG" => 40, "FontB" => 43, "Margin" => 6, "Alpha" => 100, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL, "Family" => LEGEND_FAMILY_LINE);
     $picture->drawLegend(655, 50, $Config);
     return $picture;
 }
开发者ID:rbolliger,项目名称:otokou,代码行数:12,代码来源:ChartBuilderPChart.class.php

示例7: pData

include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->loadPalette("../palettes/blind.color", TRUE);
$MyData->addPoints(array(150, 220, 300, 250, 420, 200, 300, 200, 110), "Server A");
$MyData->addPoints(array("January", "February", "March", "April", "May", "Juin", "July", "August", "September"), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the floating 0 data serie */
$MyData->addPoints(array(60, 80, 20, 40, 40, 50, 90, 30, 100), "Floating 0");
$MyData->setSerieDrawable("Floating 0", FALSE);
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 110, "G" => 110, "B" => 110));
/* Write the title */
$myPicture->drawText(10, 13, "Net Income 2k8");
/* Set the graphical area  */
$myPicture->setGraphArea(50, 30, 680, 180);
/* Draw the scale  */
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 500));
$myPicture->drawScale(array("InnerTickWidth" => 0, "OuterTickWidth" => 0, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "LabelRotation" => 45, "DrawXLines" => FALSE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridTicks" => 0, "GridAlpha" => 30, "AxisAlpha" => 0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$settings = array("Floating0Serie" => "Floating 0", "Surrounding" => 10);
$myPicture->drawBarChart($settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.span.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawBarChart.span.php

示例8: pData

/* CAT:Bar Chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(13251, 4118, 3087, 1460, 1248, 156, 26, 9, 8), "Hits");
$MyData->setAxisName(0, "Hits");
$MyData->addPoints(array("Firefox", "Chrome", "Internet Explorer", "Opera", "Safari", "Mozilla", "SeaMonkey", "Camino", "Lunascape"), "Browsers");
$MyData->setSerieDescription("Browsers", "Browsers");
$MyData->setAbscissa("Browsers");
$MyData->setAbscissaName("Browsers");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC, 1);
/* Create the pChart object */
$myPicture = new pImage(500, 500, $MyData);
$myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the chart scale */
$myPicture->setGraphArea(100, 30, 480, 480);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM));
//
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Rounded" => TRUE, "Surrounding" => 30));
/* Write the legend */
$myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.vertical.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawBarChart.vertical.php

示例9: foreach

     foreach ($arrSeriesY2 as $serie) {
         $myData->setSerieDrawable($serie, FALSE);
     }
 }
 $arrDisplayValues = array("DisplayValues" => FALSE);
 if ($plot == 2) {
     $arrDisplayValues["DisplayValues"] = TRUE;
 }
 /* Enable shadow computing */
 $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
 /* Draw the stacked area chart */
 if ($chartType == 'area2') {
     $myPicture->drawStackedAreaChart();
 } else {
     if ($chartType == 'bar') {
         $myPicture->drawBarChart(array("Surrounding" => -15, "InnerSurrounding" => 15) + $arrDisplayValues);
     } else {
         if ($chartType == 'bar2') {
             $myPicture->drawStackedBarChart();
         } else {
             $myPicture->drawLineChart();
             if ($plot > 0) {
                 $myPicture->drawPlotChart($arrDisplayValues + array("PlotSize" => $weight * 1.5 + 3, "PlotBorder" => TRUE, "BorderSize" => 0.8, "BorderAlpha" => 75, "Surrounding" => -30));
             }
         }
     }
 }
 // 隐藏主坐标轴数据,画副坐标轴数据
 if (isset($arrSeriesY2)) {
     foreach ($arrSeries as $serie) {
         if (in_array($serie, $arrSeriesY2)) {
开发者ID:Strongc,项目名称:php_chart,代码行数:31,代码来源:chart_png_sxm.php

示例10: pData

/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(13251, 4118, 3087, 1460, 1248, 156, 26, 9, 8), "Hits");
$MyData->setAxisName(0, "Hits");
$MyData->addPoints(array("Firefox", "Chrome", "Internet Explorer", "Opera", "Safari", "Mozilla", "SeaMonkey", "Camino", "Lunascape"), "Browsers");
$MyData->setSerieDescription("Browsers", "Browsers");
$MyData->setAbscissa("Browsers");
/* Create the pChart object */
$myPicture = new pImage(500, 500, $MyData);
$myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the chart scale */
$myPicture->setGraphArea(100, 30, 480, 480);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Create the per bar palette */
$Palette = array("0" => array("R" => 188, "G" => 224, "B" => 46, "Alpha" => 100), "1" => array("R" => 224, "G" => 100, "B" => 46, "Alpha" => 100), "2" => array("R" => 224, "G" => 214, "B" => 46, "Alpha" => 100), "3" => array("R" => 46, "G" => 151, "B" => 224, "Alpha" => 100), "4" => array("R" => 176, "G" => 46, "B" => 224, "Alpha" => 100), "5" => array("R" => 224, "G" => 46, "B" => 117, "Alpha" => 100), "6" => array("R" => 92, "G" => 224, "B" => 46, "Alpha" => 100), "7" => array("R" => 224, "G" => 176, "B" => 46, "Alpha" => 100));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Rounded" => TRUE, "Surrounding" => 30, "OverrideColors" => $Palette));
/* Write the legend */
$myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Write a label over the chart */
$myPicture->writeLabel("Hits", array(1, 4));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.vertical.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawLabel.vertical.php

示例11: PlotLine

function PlotLine($rowX, $rowY, $name, $ch)
{
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pData.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pDraw.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pImage.class.php";
    include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pPie.class.php";
    //**************************************
    $myData = new pData();
    $myData->addPoints($rowX, "Serie1");
    $myData->setSerieDescription("Serie1", $name);
    //$myData->setSerieOnAxis("Serie1",0);
    $myData->addPoints($rowY, "Absissa");
    $myData->setAbscissa("Absissa");
    //$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa");
    //$myData->setAbscissa("Absissa");
    $myData->setAxisPosition(0, AXIS_POSITION_LEFT);
    //$myData->setAxisName(0,"1st axis");
    $myData->setAxisUnit(0, "");
    $myPicture = new pImage(700, 230, $myData);
    $Settings = array("R" => 240, "G" => 242, "B" => 241, "Dash" => 1, "DashR" => 260, "DashG" => 262, "DashB" => 261);
    $myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
    $Settings = array("StartR" => 252, "StartG" => 255, "StartB" => 254, "EndR" => 252, "EndG" => 255, "EndB" => 254, "Alpha" => 50);
    $myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
    $myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
    $myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
    $TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 252, "G" => 252, "B" => 252, "DrawBox" => 1, "BoxAlpha" => 30);
    //$myPicture->drawText(350,25,$name,$TextSettings);
    $myPicture->setShadow(FALSE);
    $myPicture->setGraphArea(50, 50, 675, 190);
    //$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
    $Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
    $myPicture->drawScale($Settings);
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
    $Config = "";
    if ($ch == 1) {
        $myPicture->drawSplineChart($Config);
    }
    if ($ch == 2) {
        $myPicture->drawBarChart($Config);
    }
    if ($ch == 3) {
        $myPicture->drawLineChart($Config);
    }
    if ($ch == 4) {
        $myPicture->drawPlotChart($Config);
    }
    if ($ch == 5) {
        $myPicture->drawStepChart($Config);
    }
    if ($ch == 6) {
        $myPicture->drawAreaChart($Config);
    }
    if ($ch == 7) {
        $myPicture->drawFilledSplineChart($Config);
    }
    if ($ch == 8) {
        $myPicture->drawFilledStepChart($Config);
    }
    if ($ch == 9) {
        $myPicture->drawStackedAreaChart($Config);
    }
    $Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
    $myPicture->drawLegend(563, 16, $Config);
    $myPicture->stroke();
}
开发者ID:tarekdjouad,项目名称:TBIMS,代码行数:66,代码来源:Plot.php

示例12: block_mystats_quiz_chart

function block_mystats_quiz_chart($avg, $high, $strAvg, $strHigh, $strTitle, $strScale, $userid)
{
    $myQuizData = new pData();
    $myQuizData->addPoints(array($avg), "Serie1");
    $myQuizData->setSerieDescription("Serie1", $strAvg);
    $myQuizData->setSerieOnAxis("Serie1", 0);
    $myQuizData->addPoints(array($high), "Serie2");
    $myQuizData->setSerieDescription("Serie2", $strHigh);
    $myQuizData->setSerieOnAxis("Serie2", 0);
    $myQuizData->addPoints(array(" "), "Absissa");
    $myQuizData->setAbscissa("Absissa");
    $myQuizData->setAxisPosition(0, AXIS_POSITION_LEFT);
    $myQuizData->setAxisName(0, $strScale);
    $myQuizData->setAxisUnit(0, "");
    $myQuizPicture = new pImage(350, 230, $myQuizData);
    $quizSettings = array("R" => 255, "G" => 255, "B" => 255);
    $myQuizPicture->drawFilledRectangle(0, 0, 350, 230, $quizSettings);
    $myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
    $myQuizPicture->setFontProperties(array("FontName" => "../blocks/mystats/pChart2.1.3/fonts/GeosansLight.ttf", "FontSize" => 14));
    $TextSettings = array("Align" => TEXT_ALIGN_TOPLEFT, "R" => 0, "G" => 0, "B" => 0);
    $myQuizPicture->drawText(25, 25, $strTitle, $TextSettings);
    $myQuizPicture->setShadow(FALSE);
    $myQuizPicture->setGraphArea(25, 70, 325, 210);
    $myQuizPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8));
    $AxisBoundaries = array(0 => array("Min" => 0, "Max" => 110), 1 => array("Min" => 00, "Max" => 1));
    $quizSettings = array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
    $myQuizPicture->drawScale($quizSettings);
    $myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
    $quizConfig = array("DisplayValues" => 1, "Rounded" => 1, "AroundZero" => 1);
    $myQuizPicture->drawBarChart($quizConfig);
    $quizConfig = array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 50, "AxisID" => 0, "Ticks" => 4, "Caption" => "Threshold");
    $myQuizPicture->drawThreshold(0, $quizConfig);
    $quizConfig = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_ROUND, "Mode" => LEGEND_VERTICAL, "Family" => LEGEND_FAMILY_CIRCLE);
    $myQuizPicture->drawLegend(240, 16, $quizConfig);
    $imgName = sha1($userid . $strTitle) . '.png';
    $myQuizPicture->Render('../blocks/mystats/img/' . $imgName);
    return '<img src="../blocks/mystats/img/' . $imgName . '" alt="' . $strAvg . ': ' . $avg . ', ' . $strHigh . ': ' . $high . '">';
}
开发者ID:arroby,项目名称:moodle_block_mystats,代码行数:38,代码来源:lib.php

示例13: drawBarChart

 private function drawBarChart($filename, $yAxisLabel, $dataSeries, $labelSeries)
 {
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->addPoints($dataSeries, "Members");
     $MyData->setAxisName(0, "Members");
     $MyData->addPoints($labelSeries, "Languages");
     $MyData->setSerieDescription("Languages", "Languages");
     $MyData->setAbscissa("Languages");
     /* Create the pChart object */
     $myPicture = new pImage(400, 250, $MyData, true);
     //$myPicture->drawGradientArea(0,0,500,500,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100));
     //$myPicture->drawGradientArea(0,0,500,500,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20));
     $myPicture->setFontProperties(array("FontName" => "../lib/pchart-2.1.3/fonts/verdana.ttf", "FontSize" => 6));
     /* Draw the chart scale */
     $myPicture->setGraphArea(70, 20, 380, 200);
     $myPicture->drawScale(array("CycleBackground" => TRUE, "LabelRotation" => 30, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10));
     /* Turn on shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     /* Create the per bar palette */
     $Palette = array("0" => array("R" => 188, "G" => 224, "B" => 46, "Alpha" => 100), "1" => array("R" => 224, "G" => 100, "B" => 46, "Alpha" => 100), "2" => array("R" => 224, "G" => 214, "B" => 46, "Alpha" => 100), "3" => array("R" => 46, "G" => 151, "B" => 224, "Alpha" => 100), "4" => array("R" => 176, "G" => 46, "B" => 224, "Alpha" => 100), "5" => array("R" => 224, "G" => 46, "B" => 117, "Alpha" => 100), "6" => array("R" => 92, "G" => 224, "B" => 46, "Alpha" => 100), "7" => array("R" => 224, "G" => 176, "B" => 46, "Alpha" => 100), "8" => array("R" => 120, "G" => 59, "B" => 19, "Alpha" => 100), "9" => array("R" => 10, "G" => 79, "B" => 39, "Alpha" => 100), "10" => array("R" => 100, "G" => 200, "B" => 59, "Alpha" => 100));
     /* Draw the chart */
     $myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_OUTSIDE, "DisplayValues" => TRUE, "Surrounding" => 30, "OverrideColors" => $Palette));
     /* Write the legend */
     $myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     $myPicture->render($filename . ".png");
 }
开发者ID:gpuenteallott,项目名称:rox,代码行数:27,代码来源:stats.model.php

示例14: pData

/* CAT:Bar Chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(60, 30, 10), "Answers");
$MyData->setAxisName(0, "Answers (%)");
$MyData->addPoints(array("I do agree  ", "I disagree  ", "No opinion  "), "Options");
$MyData->setAbscissa("Options");
/* Create the pChart object */
$myPicture = new pImage(500, 220, $MyData);
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 15));
$myPicture->drawText(20, 34, "Q: Flexibility is a key point of this library", array("FontSize" => 20));
/* Define the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Set the graph area */
$myPicture->setGraphArea(70, 60, 480, 200);
$myPicture->drawGradientArea(70, 60, 480, 200, DIRECTION_HORIZONTAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 240, "EndG" => 240, "EndB" => 240, "Alpha" => 30));
/* Draw the chart scale */
$scaleSettings = array("DrawXLines" => FALSE, "Mode" => SCALE_MODE_START0, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->drawBarChart(array("Rounded" => TRUE, "Surrounding" => 30));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.poll.png");
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:30,代码来源:example.drawBarChart.poll.php

示例15: actionGraph2

 public function actionGraph2()
 {
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->addPoints(array(13251, 4118, 3087, 1460, 1248, 156, 26, 9, 8), "Hits");
     $MyData->setAxisName(0, "Hits");
     $MyData->addPoints(array("Firefox", "Chrome", "Internet Explorer", "Opera", "Safari", "Mozilla", "SeaMonkey", "Camino", "Lunascape"), "Browsers");
     $MyData->setSerieDescription("Browsers", "Browsers");
     $MyData->setAbscissa("Browsers");
     /* Create the pChart object */
     $myPicture = new pImage(500, 500, $MyData);
     $myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
     $myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
     $myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
     /* Draw the chart scale */
     $myPicture->setGraphArea(100, 30, 480, 480);
     $myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM));
     //
     /* Turn on shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     /* Draw the chart */
     $myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Rounded" => TRUE, "Surrounding" => 30));
     /* Write the legend */
     $myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput("pictures/example.drawBarChart.vertical.png");
 }
开发者ID:kit9,项目名称:ERP_Accounting_Indonesia,代码行数:27,代码来源:SReportController.php


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