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


PHP pChart::Render方法代码示例

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


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

示例1: writeData

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

示例2: saveGraph

 /**
  * Does the magic. Creates all necessary stuff and finally
  * saves the graph to the specified filename
  *
  */
 public function saveGraph($strFilename)
 {
     $this->preGraphCreation();
     if (strpos($strFilename, _realpath_) === false) {
         $strFilename = _realpath_ . $strFilename;
     }
     if (strtolower(substr($strFilename, -3) != "png")) {
         throw new class_exception("Filename must be a png-file", class_exception::$level_ERROR);
     }
     $this->objChart->Render($strFilename);
 }
开发者ID:jinshana,项目名称:kajonacms,代码行数:16,代码来源:class_graph_pchart.php

示例3: _showGraph_pChart

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

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

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

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

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

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

示例9: _createSourcesGraph

 protected function _createSourcesGraph()
 {
     // load pChart graphic library
     $this->_loadLibs();
     // définition des données à afficher
     $dataSet = new pData();
     // need config, to know which data user wants to display : visits, unique visitors, pageviews
     $sefConfig = Sh404sefFactory::getConfig();
     // Google does not allow combining dimension=ga:medium with metric = unique visitors
     $dataType = $sefConfig->analyticsDashboardDataType == 'ga:visitors' ? 'ga:visits' : $sefConfig->analyticsDashboardDataType;
     $dataTypeString = str_replace('ga:', '', $dataType);
     // sort data for proper display
     usort($this->_rawData['sources'], array($this, '_sortSourcesDataCompareFunction'));
     // we walk the array, pulling out alternatively
     // the first and last items
     // making the new array having the largest item
     // followed by the smallest, then second largest
     // then second smallest, ...
     // which makes drawing labels much easier
     $tmpArray = array();
     $even = false;
     $max = count($this->_rawData['sources']);
     for ($i = 0; $i < $max; $i++) {
         if ($even) {
             // pull last item in sorted array
             $tmpArray[] = array_pop($this->_rawData['sources']);
         } else {
             // pull array first item
             $tmpArray[] = array_shift($this->_rawData['sources']);
         }
         // flag inversion
         $even = !$even;
     }
     // get data from response
     $data = array();
     $types = array();
     foreach ($tmpArray as $entry) {
         $value = $entry->{$dataTypeString};
         // do not add empty values, as pChart would choke on that and display a warning
         if (!empty($value)) {
             $data[] = $value;
             $types[] = Sh404sefHelperAnalytics::getReferralLabel($entry->dimension['medium']);
         }
     }
     $dataSet->AddPoint($data, "visits");
     $dataSet->AddPoint($types, "types");
     $dataSet->addSerie('visits');
     $dataSet->SetAbsciseLabelSerie("types");
     $label = JText::_('COM_SH404SEF_ANALYTICS_REPORT_SOURCES') . JText::_('COM_SH404SEF_ANALYTICS_REPORT_BY_LABEL') . Sh404sefHelperAnalytics::getDataTypeTitle();
     $dataSet->SetSerieName($label, "visits");
     // Initialise the graph
     $w = intval(0.45 * $this->_options['cpWidth']);
     $w = empty($w) ? 160 : $w;
     $radius = intval($w * 0.22);
     $margin = 5;
     $h = intval($w * 0.8);
     $centreX = intval(0.5 * $w);
     $centreY = intval(0.5 * $h);
     $chart = new pChart($w, $h);
     $fontSize = 8;
     // prepare graph
     $chart->setFontProperties($this->_baseChartPath . DS . 'Fonts/arial.ttf', $fontSize);
     $chart->loadColorPalette($this->_baseChartPath . DS . 'palettes' . DS . 'tones-2-green-soft.php');
     $chart->setGraphArea($margin, $margin, $w - $margin, $h - $margin);
     // This will draw a shadow under the pie chart
     $chart->drawFilledCircle($centreX + 4, $centreY + 4, $radius, 200, 200, 200);
     // Draw the pie chart
     $d = $dataSet->GetData();
     if (!empty($d)) {
         $chart->drawBasicPieGraph($d, $dataSet->GetDataDescription(), $centreX, $centreY, $radius, PIE_PERCENTAGE_LABEL_VALUE, 255, 255, 218);
     }
     // create a temporary file for
     $user =& JFactory::getUser();
     // make sure the root tmp dir exists
     $rootDir = 'tmp' . DS . 'sh404sef_analytics';
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $rootDir);
     // file name is variable to avoid browser cache
     $basePath = $rootDir . DS . md5('useless_' . $user->id . '_hashing') . DS;
     // create path and make sure there's an index.html file in it
     Sh404sefHelperFiles::createDirAndIndex(JPATH_ROOT . DS . $basePath);
     $imageFileName = Sh404sefHelperAnalytics::createTempFile($basePath, $this->_options['report'] . '.' . $this->_options['accountId'] . '.sources.' . $dataTypeString);
     $chart->Render(JPATH_ROOT . DS . $imageFileName);
     // need cleaning up, so let's remove all report files for that user older than an hour or so
     Sh404sefHelperAnalytics::cleanReportsImageFiles(JPATH_ROOT . DS . $basePath, $age = 4000);
     return JURI::root() . $imageFileName;
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:86,代码来源:analyticsgareportdashboard.php

示例10: pData

/*
    Example10 : A 3D exploded pie graph
*/
// Standard inclusions
require_once "../pChart/pData.class";
require_once "../pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$data = array(10, 2, 3, 5, 3, 11, 13, 12, 11, 15, 5, 16);
$sum = array_sum($data);
$DataSet->AddPoint($data, "Serie1");
$DataSet->AddPoint(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(420, 250);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 210, 200, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 0, 230, 230);
$Test->createColorGradientPalette(195, 204, 56, 223, 110, 41, 5);
// Draw the pie chart
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->AntialiasQuality = 0;
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 180, 130, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
$Test->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
// Write the title
$Test->setFontProperties("../Fonts/tahoma.ttf", 13);
$Test->drawTitle(10, 20, "Firewood Usage in 2015", 114, 16, 46);
$Test->drawTitle(320, 220, 'Total :' . $sum . 'kg', 224, 46, 147);
$Test->Render("firewood.png");
开发者ID:bettirosengugi,项目名称:My-Web-Projects,代码行数:29,代码来源:firewoodGraph.php

示例11: pchartAction

 public function pchartAction()
 {
     //		$this->_helper->layout->disableLayout();
     $this->_helper->layout->setLayout("layout_admin");
     include "pData.class";
     include "pChart.class";
     $this->view->showArray = $this->testdemoAction();
     $showdate = array();
     $showreport = array();
     foreach ($this->view->showArray as $show) {
         array_push($showdate, substr($show['date'], strlen($show['date']) - 4, 4));
         array_push($showreport, $show['count']);
     }
     // Dataset definition
     $DataSet = new pData();
     $DataSet->AddPoint(array_slice($showreport, 0, 26), "Serie1");
     $DataSet->AddPoint(array_slice($showdate, 0, 26), "Serie2");
     $DataSet->AddSerie("Serie1");
     $DataSet->SetAbsciseLabelSerie("Serie2");
     $DataSet->SetSerieName("Reports", "Serie1");
     $DataSet->SetYAxisName('Report Count');
     $DataSet->SetXAxisName('Date');
     // Initialise the graph
     $Test = new pChart(900, 250);
     $Test->setFontProperties("xihei.ttf", 8);
     $Test->setGraphArea(50, 30, 780, 200);
     $Test->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
     $Test->drawRoundedRectangle(5, 5, 795, 249, 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("xihei.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("xihei.ttf", 8);
     $Test->drawLegend(596, 50, $DataSet->GetDataDescription(), 255, 255, 255);
     $Test->setFontProperties("xihei.ttf", 10);
     $Test->drawTitle(200, 22, "Reports by Day in Jue.", 50, 50, 50, 585);
     $Test->Render("Naked1.png");
     //=====================================================================================
     // Dataset definition
     $DataSet2 = new pData();
     $DataSet2->AddPoint(array(38, 22, 606), "Serie1");
     $DataSet2->AddPoint(array("Male", "Female", "Unkown"), "Serie2");
     $DataSet2->AddAllSeries();
     $DataSet2->SetAbsciseLabelSerie("Serie2");
     // Initialise the graph
     $Test2 = new pChart(300, 200);
     $Test2->loadColorPalette("softtones.txt");
     $Test2->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 255, 255, 255);
     $Test2->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
     // This will draw a shadow under the pie chart
     $Test2->drawFilledCircle(122, 102, 70, 200, 200, 200);
     // Draw the pie chart
     $Test2->setFontProperties("tahoma.ttf", 8);
     $Test2->drawBasicPieGraph($DataSet2->GetData(), $DataSet2->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
     $Test2->drawPieLegend(230, 15, $DataSet2->GetData(), $DataSet2->GetDataDescription(), 250, 250, 250);
     $Test2->Render("Naked2.png");
     //=====================================================================================
     // select province
     $db = Zend_Registry::get('db');
     $selectprovince = $db->select();
     $selectprovince->from('consumer', array("province", "count(*) as count"))->where("pest is null")->group("consumer.province")->order("count desc");
     $provinceArray = $db->fetchAll($selectprovince);
     $this->view->showprovince = '';
     $this->view->showprovincecount = '';
     $showprovince = array();
     $showprovincecount = array();
     foreach ($provinceArray as $province) {
         if ($province['province'] == null || $province['province'] == '') {
             array_push($showprovince, 'Unkown');
         } else {
             array_push($showprovince, $province['province']);
         }
         array_push($showprovincecount, $province['count']);
     }
     // Dataset definition
     $DataSet3 = new pData();
     $DataSet3->AddPoint(array_slice($showprovincecount, 0, 20), "Serie1");
     $DataSet3->AddPoint(array_slice($showprovince, 0, 20), "Serie2");
     $DataSet3->AddSerie("Serie1");
     $DataSet3->SetAbsciseLabelSerie("Serie2");
     $DataSet3->SetSerieName("Spark Count", "Serie1");
     $DataSet3->SetYAxisName('Spark Count');
     $DataSet3->SetXAxisName('Province');
     Zend_Debug::dump($DataSet3->GetDataDescription());
     // Initialise the graph
     $Test3 = new pChart(900, 250);
     $Test3->setFontProperties("xihei.ttf", 8);
     $Test3->setGraphArea(50, 30, 780, 200);
     $Test3->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
     $Test3->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
     $Test3->drawGraphArea(255, 255, 255, TRUE);
     $Test3->drawScale($DataSet3->GetData(), $DataSet3->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
     $Test3->drawGrid(4, TRUE, 230, 230, 230, 50);
     // Draw the 0 line
     $Test3->setFontProperties("xihei.ttf", 6);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:TestController.php

示例12: pData

<?php

/*
    SmallGraph: Let's go fast, draw small!
*/
// Standard inclusions
include "src/pData.php";
include "src/pChart.php";
// 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->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
// Initialise the graph
$Test = new pChart(100, 30);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawFilledRoundedRectangle(2, 2, 98, 28, 2, 230, 230, 230);
$Test->setGraphArea(5, 5, 95, 25);
$Test->drawGraphArea(255, 255, 255);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 220, 220, 220, FALSE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$Test->Render("SmallGraph.png");
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:25,代码来源:SmallGraph.php

示例13:

    $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, $res['treinador'], 50, 50, 50, 585);
    $Test->Render("example" . $res['id_treinador'] . ".png");
    ?>
					<img src="example<?php 
    echo $res['id_treinador'];
    ?>
.png" alt="<?php 
    echo $res['id_treinador'];
    ?>
" width="670"/>
					<b>Média: </b> <?php 
    echo number_format($questao, 2);
    ?>
					<br><br><b>Questões</b><br>
					<label style="color:#0000FF">Pergunta 1: O Treinamento foi eficiente?</label> <?php 
    echo number_format($questao1, 2);
    ?>
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:31,代码来源:index.php

示例14:

$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

示例15: pData

$DataSet = new pData();
$canvas = new GDCanvas(700, 230);
$Chart = new pChart(700, 230, $canvas);
// Dataset definition
CSVImporter::ImportFromCSV($DataSet, "../sample/datawithtitle.csv", ",", array(1, 2, 3), TRUE, 0);
$DataSet->AddAllSeries();
$DataSet->setAbscissaLabelSeries();
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(60, 30, 680, 200);
$canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow());
$canvas->drawRoundedRectangle(new Point(5, 5), new Point(695, 225), 5, new Color(230), 1, 0, ShadowProperties::NoShadow());
$Chart->drawGraphBackground(new BackgroundStyle(new Color(255), TRUE));
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(230, 230, 230), TRUE));
// Draw the 0 line
$Chart->setFontProperties("../Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the area
$Chart->drawArea($DataSet, "Serie 1", "Serie 3", new Color(239, 238, 227));
// Draw the line graph
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255));
// Finish the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->drawLegend(65, 35, $DataSet->GetDataDescription(), new Color(250));
$Chart->setFontProperties("../Fonts/tahoma.ttf", 10);
$Chart->drawTitle(60, 22, "Example 4", new Color(50), 585);
$Chart->Render("Example4.png");
header("Content-Type:image/png");
readfile("Example4.png");
开发者ID:rbraband,项目名称:pChart,代码行数:31,代码来源:Example4.php


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