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

PHP pData类代码示例

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

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



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

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


示例3: index

 function index()
 {
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->addPoints(getGenders($this->db), "ScoreA");
     $MyData->setSerieDescription("ScoreA", "Application A");
     /* Define the absissa serie */
     $MyData->addPoints(array("Female", "Male"), "Labels");
     $MyData->setAbscissa("Labels");
     /* Create the pChart object */
     $myPicture = new pImage(240, 180, $MyData, TRUE);
     /* Set the default font properties */
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
     /* Create the pPie object */
     $PieChart = new pPie($myPicture, $MyData);
     /* Enable shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     /* Draw a splitted pie chart */
     $PieChart->draw3DPie(120, 90, array("Radius" => 100, "DataGapAngle" => 12, "DataGapRadius" => 10, "Border" => TRUE));
     /* Write the legend box */
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/Silkscreen.ttf", "FontSize" => 6, "R" => 0, "G" => 0, "B" => 0));
     $PieChart->drawPieLegend(140, 160, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     /* Render the picture (choose the best way) */
     $myPicture->stroke();
     //$myPicture->autoOutput("pictures/example.draw3DPie.transparent.png");
 }
开发者ID:BGCX067,项目名称:facebook-slt-svn-to-git,代码行数:26,代码来源:user_gender.php


示例4: line

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


示例5: testGetXYMapMissing

 /**
  * Check that if our data set contains non-numeric data, it will
  * add they keys to the $missing array
  */
 public function testGetXYMapMissing()
 {
     $data = new pData();
     $data->addPoints(array(2, 3, 4, 'apple', 5, 'banana'), 'series1');
     $data->addPoints(array(3, 4, 5, 6, 7), 'series2');
     $xIn = array();
     $yIn = array();
     $missing = array();
     $data->getXYMap('series1', $xIn, $yIn, $missing, $index);
     $this->assertEquals(6, $index);
     $this->assertEquals(array(4 => true, 6 => true), $missing);
 }
开发者ID:rbraband,项目名称:pChart,代码行数:16,代码来源:pDataTest.php


示例6: drawBarChart

 protected function drawBarChart(ChartDataset $CDs)
 {
     if (!extension_loaded("gd") && !extension_loaded("gd2")) {
         /* Extension not loaded */
         // NO BARCHARTS AND ERRORS FOR YOU!
         return;
     }
     /* Create and populate the pData object */
     $MyData = new pData();
     if (empty($CDs->data)) {
         return;
     }
     //print_r($CDs->data);
     foreach ($CDs->data as $points) {
         //print_r($points);
         $MyData->addPoints($points["points"], $points["label"]);
     }
     $MyData->setAxisName(0, "Amount Sold");
     $MyData->setSerieDescription($points["label"], $points["label"]);
     $MyData->setAbscissa($points["label"]);
     /* Create the pChart object */
     $myPicture = new pImage(1000, 230, $MyData);
     // the horrible way to add fonts is just one bunch of fucked up shit, not making sense. bullshit parameters and paths.
     //$myPicture->setFontProperties(array("FontName"=>"Bedizen"));
     $myPicture->setFontProperties(array("FontName" => "pChart2.1.4//fonts/calibri.ttf", "FontSize" => 11));
     //print_r(is_file("C:/xampp_jan2015/htdocs/hackerbar/web/fonts/GeosansLight.ttf"));
     /* Turn of Antialiasing */
     $myPicture->Antialias = false;
     /* Add a border to the picture */
     $myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
     $myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
     $myPicture->drawRectangle(0, 0, 999, 229, array("R" => 0, "G" => 0, "B" => 0));
     /* Set the default font */
     //$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
     /* Define the chart area */
     $myPicture->setGraphArea(60, 40, 850, 200);
     /* Draw the scale */
     $scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
     $myPicture->drawScale($scaleSettings);
     /* Write the chart legend */
     $myPicture->drawLegend(860, 25, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
     /* 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);
     $myPicture->drawBarChart($settings);
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput("images/barcharts/" . $points["label"] . ".png");
     //$myPicture->auto
     $myPicture->render("myfile.png");
 }
开发者ID:stitch,项目名称:HackerBar,代码行数:52,代码来源:popularProductHistoryBarchart.php


示例7: createGraphe

function createGraphe($vData, $hData, $titre, $vLabel, $hLabel)
{
    $MyData = new pData();
    /*Je présente ma série de données à utiliser pour le graphique et je détermine le titre de l'axe vertical avec setAxisName*/
    $MyData->addPoints($vData, "vertical");
    $MyData->setSerieWeight("vertical", 2);
    $MyData->setAxisName(0, $vLabel);
    /*J'indique les données horizontales du graphique. Il doit y avoir le même nombre que pour ma série de données précédentes (logique)*/
    $MyData->addPoints($hData, "horizontal");
    $MyData->setSerieDescription("horizontal", $hLabel);
    $MyData->setAbscissa("horizontal");
    $MyData->setPalette("vertical", array("R" => 255, "G" => 0, "B" => 0));
    /* Je crée l'image qui contiendra mon graphique précédemment crée */
    $myPicture = new pImage(900, 400, $MyData);
    /* Je crée une bordure à mon image */
    $myPicture->drawRectangle(0, 0, 899, 399, array("R" => 0, "G" => 0, "B" => 0));
    /* J'indique le titre de mon graphique, son positionnement sur l'image et sa police */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/Forgotte.ttf", "FontSize" => 11));
    $myPicture->drawText(200, 25, $titre, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
    /* Je choisi la font de mon graphique */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
    /* Je détermine la taille du graphique et son emplacement dans l'image */
    $myPicture->setGraphArea(60, 40, 800, 380);
    /* Paramètres pour dessiner le graphique à partir des deux abscisses */
    $scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "LabelSkip" => 4);
    $myPicture->drawScale($scaleSettings);
    /* Je dessine mon graphique en fonction des paramètres précédents */
    $myPicture->drawAreaChart();
    $myPicture->drawLineChart();
    /* J'indique le chemin où je souhaite que mon image soit créée */
    $myPicture->Render("img/" . $titre . ".png");
}
开发者ID:adib0u,项目名称:Model_math_finance,代码行数:32,代码来源:emprunt.php


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


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


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


示例11: testRemoveSeries

 public function testRemoveSeries()
 {
     $data = new pData();
     $data->addPoint(array(1, 2), 'testseries1');
     $data->addPoint(array(3, 4), 'testseries2');
     $data->addSeries('testseries1');
     $data->addSeries('testseries2');
     $this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array('testseries1', 'testseries2')), $data->getDataDescription());
     $data->removeSeries('testseries1');
     $this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array(1 => 'testseries2')), $data->getDataDescription());
 }
开发者ID:han905,项目名称:pChart-php5,代码行数:11,代码来源:pDataTest.php


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


示例13: PlotPie

function PlotPie($rowA, $rowB, $name, $cch)
{
    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($rowA, "ScoreA");
    $MyData->setSerieDescription("ScoreA", "Application A");
    /* Define the absissa serie */
    $MyData->addPoints($rowB, "Labels");
    $MyData->setAbscissa("Labels");
    /* Create the pChart object */
    $myPicture = new pImage(700, 630, $MyData);
    $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, 690);
    //$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));
    /* Create the pPie object */
    $PieChart = new pPie($myPicture, $MyData);
    /* Draw an AA pie chart */
    if ($cch == 11) {
        $PieChart->draw2DPie(160, 140, array("DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
    }
    if ($cch == 12) {
        $PieChart->draw2DRing(160, 140, array("WriteValues" => TRUE, "ValueR" => 255, "ValueG" => 255, "ValueB" => 255, "Border" => TRUE));
    }
    if ($cch == 13) {
        $PieChart->draw3DPie(160, 140, array("Radius" => 70, "DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
    }
    /* Write the legend box */
    $myPicture->setShadow(FALSE);
    $PieChart->drawPieLegend(15, 40, array("Alpha" => 20));
    /* Render the picture (choose the best way) */
    $myPicture->autoOutput("pictures/example.draw2DPie.labels.png");
}
开发者ID:tarekdjouad,项目名称:TBIMS,代码行数:41,代码来源:Plot.php


示例14: plot

function plot($lift)
{
    $MyData = new pData();
    $positivelift = array();
    $negativelift = array();
    foreach ($lift as $heading => $fpm) {
        if ($fpm > 0) {
            $positivelift[$heading] = $fpm;
            $negativelift[$heading] = 0;
        } else {
            $negativelift[$heading] = -$fpm;
            $positivelift[$heading] = 0;
        }
    }
    $MyData->addPoints($positivelift, "ScoreA");
    // green
    $MyData->addPoints($negativelift, "ScoreB");
    // red
    $MyData->addPoints(array_keys($lift), "Coord");
    $MyData->setAbscissa("Coord");
    $myPicture = new pImage(700, 700, $MyData);
    $myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
    $SplitChart = new pRadar();
    $myPicture->setGraphArea(10, 10, 690, 690);
    $Options = array("LabelPos" => RADAR_LABELS_HORIZONTAL, "BackgroundGradient" => array("StartR" => 255, "StartG" => 255, "StartB" => 255, "StartAlpha" => 50, "EndR" => 32, "EndG" => 109, "EndB" => 174, "EndAlpha" => 30), "DrawPoly" => TRUE, "PolyAlpha" => 50, "FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6);
    $SplitChart->drawPolar($myPicture, $MyData, $Options);
    $myPicture->autoOutput("lift.png");
}
开发者ID:rogerwalt,项目名称:autopilot,代码行数:29,代码来源:center.php


示例15: listadoPersonasXedadCreateChart

 /**
  * Creates a Chart Image with the count(Year(fecha_nacimiento))
  * 
  * @param DomDocument $qResult The query result
  * 
  * @return string with the binary stream of a png picture.
  * @see listadoPersonasXedad() 
  */
 public static function listadoPersonasXedadCreateChart(DomDocument $qResult)
 {
     // Todo: add chart to /result/chart
     $xPath = new DOMXPath($qResult);
     $countedNodes = $xPath->query('/result/Persona_Collection/Persona/counted/text()');
     $count = array();
     foreach ($countedNodes as $node) {
         $count[] = $node->nodeValue;
     }
     $fechaNodes = $xPath->query('/result/Persona_Collection/Persona/years/text()');
     $years = array();
     foreach ($fechaNodes as $node) {
         $years[] = $node->nodeValue;
     }
     /* Create and populate the pData object */
     $myData = new pData();
     $myData->addPoints($count, "Years");
     $myData->setSerieDescription("Years", "Año de Nacimiento de las personas");
     /* Define the absissa serie */
     $myData->addPoints($years, "Labels");
     $myData->setAbscissa("Labels");
     $myPicture = self::listadoPersonasXedadConfigChart($myData);
     /* Create the pPie object */
     $pieChart = new pPie($myPicture, $myData);
     /* Draw AA pie chart */
     $pieChart->draw2DPie(200, 100, array("Border" => TRUE));
     /* Write a legend box under the 1st chart */
     $pieChart->drawPieLegend(90, 176, array("Style" => LEGEND_BOX, "Mode" => LEGEND_HORIZONTAL));
     /* Render the picture (choose the best way) */
     $fname = PathsUtils::createChartFileName();
     $myPicture->render($fname);
     $picFile = file_get_contents($fname);
     return $picFile;
 }
开发者ID:backstageel,项目名称:neatReports,代码行数:42,代码来源:ListPersonasEdadCharts.php


示例16: createClosuresGraph

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


示例17: stacked2

function stacked2($data, $title, $filename)
{
    // Dataset definition
    $DataSet = new pData();
    $values = $data['values'];
    $keys = $data['keys'];
    $bar = new pChart(1040, 230);
    for ($i = 0; $i < count($values); $i++) {
        $DataSet->AddPoint($values[$i], "Serie" . ($i + 1));
        if ($i != 0) {
            $DataSet->AddSerie("Serie" . ($i + 1));
            $DataSet->SetSerieName($keys[$i - 1], "Serie" . ($i + 1));
        }
    }
    $DataSet->SetAbsciseLabelSerie("Serie1");
    $DataSet->SetXAxisFormat("date");
    // Initialise the graph
    $bar->setDateFormat("M.d");
    $bar->setFontProperties("Fonts/consola.ttf", 8);
    $bar->setGraphArea(80, 30, 1020, 200);
    $bar->drawFilledRoundedRectangle(2, 2, 1037, 227, 5, 240, 240, 240);
    $bar->drawRoundedRectangle(0, 0, 1039, 229, 5, 230, 230, 230);
    $bar->loadColorPalette('chartcolors.txt', ',');
    $bar->drawGraphArea(255, 255, 255, TRUE);
    $bar->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 2, TRUE);
    $bar->drawGrid(4, TRUE, 230, 230, 230, 50);
    // Draw the 0 line
    $bar->setFontProperties("Fonts/consola.ttf", 6);
    $bar->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    // Draw the bar graph
    $bar->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 100);
    $bar->drawLegend(85, 35, $DataSet->GetDataDescription(), 255, 255, 255);
    // Finish the graph
    $bar->setFontProperties("Fonts/MankSans.ttf", 10);
    $bar->drawTitle(10, 20, $title, 100, 100, 100);
    $bar->Render($filename);
}
开发者ID:mousetwentytwo,项目名称:test,代码行数:37,代码来源:charts.php


示例18: ring2d

function ring2d($x, $y, $name)
{
    $MyData = new pData();
    $MyData->addPoints($x, "ScoreA");
    $MyData->setSer 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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