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


PHP pData::SetXAxisFormat方法代码示例

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


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

示例1: prepareData

function prepareData($scaleX, $scaleY, $SQL, $scaleType)
{
    global $conn;
    $DataSet = new pData();
    $result = pg_query($conn, $SQL);
    if (!$result) {
        echo "An error occured.\n";
    }
    while ($row = pg_fetch_row($result)) {
        $DataSet->AddPoint($row[1], "Serie2");
        $DataSet->AddPoint(mktime(0, 0, 0, substr($row[0], 5, 2), substr($row[0], 8, 2), substr($row[0], 0, 4)), "Serie1");
    }
    $DataSet->SetAbsciseLabelSerie("Serie1");
    $DataSet->AddSerie("Serie2");
    $DataSet->SetYAxisName($scaleY);
    $DataSet->SetXAxisFormat($scaleType);
    return $DataSet;
}
开发者ID:rootree,项目名称:vk-footboller-content-system,代码行数:18,代码来源:graph.php

示例2: pData

// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(100, 320, 200, 10, 43), "Serie1");
$DataSet->AddPoint(array(23, 432, 43, 153, 234), "Serie2");
$DataSet->AddPoint(array(1217541600, 1217628000, 1217714400, 1217800800, 1217887200), "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Incoming", "Serie1");
$DataSet->SetSerieName("Outgoing", "Serie2");
$DataSet->SetYAxisName("Call duration");
$DataSet->SetYAxisFormat("time");
$DataSet->SetXAxisFormat("date");
// Initialise the graph
$Test = new pChart(700, 230);
$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);
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:Example17.php

示例3: generateGraphImage

 protected function generateGraphImage($finalData, $hourflag, $title = 'Sticky Charts', $x_axis_format = 'date')
 {
     $path = $this->config->item('csv_upload_path');
     if (!empty($finalData['data'])) {
         $DataSet = new pData();
         $in = 0;
         foreach ($finalData['data'] as $seriesData) {
             $in++;
             $seriesIndex = 'Serie' . $in;
             $DataSet->AddPoint($seriesData['data'], $seriesIndex);
             $DataSet->SetSerieName($seriesData['name'], $seriesIndex);
             $DataSet->AddSerie($seriesIndex);
         }
         $xAxisArray = array();
         $in++;
         $seriesIndex = 'Serie' . $in;
         $catCount = count($finalData['cat']);
         if ($catCount <= 10) {
             $DataSet->SetXAxisFormat($x_axis_format);
         }
         foreach ($finalData['cat'] as $catD) {
             if ($catCount > 10) {
                 $xAxisArray[] = '';
             } else {
                 $xAxisArray[] = strtotime($catD);
             }
         }
         $DataSet->SetYAxisFormat("number");
         $DataSet->AddPoint($xAxisArray, $seriesIndex);
         $DataSet->SetAbsciseLabelSerie($seriesIndex);
         $DataSet->SetYAxisName($finalData['y_title']);
         $DataSet->SetXAxisName($finalData['x_title']);
         // Initialise the graph
         $Test = new pChart(985, 458);
         $Test->drawBackground(247, 226, 180);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
         $Test->setGraphArea(40, 30, 950, 400);
         $Test->drawGraphArea(109, 110, 114, false);
         $Test->drawGrid(4, false, 0, 0, 0, 50);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 6);
         // Draw the line graph
         if ($title == 'Violation Report') {
             //!$hourflag &&
             $sCount = count($finalData['data']);
             if ($sCount > 0) {
                 for ($m = 0; $m < $sCount; $m++) {
                     $color = Color_handler::get_next($m);
                     $rgb = $color->get_rgb();
                     $Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
                 }
             }
             $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 0, 0, 0, TRUE, 0, 0, TRUE);
             $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
         } else {
             $sCount = count($finalData['data']);
             if ($sCount > 0) {
                 for ($m = 0; $m < $sCount; $m++) {
                     $color = Color_handler::get_next($m % 3);
                     $rgb = $color->get_rgb();
                     $Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
                 }
             }
             $Test->setLineStyle(2);
             $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 0, 0, 0, TRUE, 0, 2);
             $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
             $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2);
         }
         // Finish the graph
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 10);
         $imgName = uniqid('graph_') . '.png';
         $Test->Render($path . $imgName);
         return upload_to_amazon_graphImage($imgName, $path);
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:75,代码来源:schedule_cron.php

示例4: showGraph

 function showGraph($searchInfo = '')
 {
     $conditions = empty($searchInfo['keywordId']) ? "" : " and s.keyword_id=" . intval($searchInfo['keywordId']);
     $conditions .= empty($searchInfo['seId']) ? "" : " and s.searchengine_id=" . intval($searchInfo['seId']);
     $sql = "select s.*,se.domain \r\n\t\t\t\t\tfrom searchresults s,searchengines se  \r\n\t\t\t\t\twhere s.searchengine_id=se.id \r\n\t\t\t\t\tand time>= " . intval($searchInfo['fromTime']) . " and time<" . intval($searchInfo['toTime']) . " {$conditions}  \r\n\t\t\t\t\torder by s.time";
     $repList = $this->db->select($sql);
     $reportList = array();
     $seList = array();
     foreach ($repList as $repInfo) {
         $var = $repInfo['searchengine_id'] . $repInfo['keyword_id'] . $repInfo['time'];
         if (empty($reportList[$var])) {
             $reportList[$var] = $repInfo;
         } else {
             if ($repInfo['rank'] < $reportList[$var]['rank']) {
                 $reportList[$var] = $repInfo;
             }
         }
         if (empty($seList[$repInfo['searchengine_id']])) {
             $seList[$repInfo['searchengine_id']] = $repInfo['domain'];
         }
     }
     asort($seList);
     $dataList = array();
     $maxValue = 0;
     foreach ($reportList as $repInfo) {
         $seId = $repInfo['searchengine_id'];
         $dataList[$repInfo['time']][$seId] = $repInfo['rank'];
         $maxValue = $repInfo['rank'] > $maxValue ? $repInfo['rank'] : $maxValue;
     }
     // check whether the records are available for drawing graph
     if (empty($dataList) || empty($maxValue)) {
         $kpText = $_SESSION['lang_code'] == 'ja' ? $_SESSION['text']['common']['No Records Found'] . "!" : "No Records Found!";
         $this->showMessageAsImage($kpText);
     }
     # Dataset definition
     $dataSet = new pData();
     foreach ($dataList as $dataInfo) {
         $i = 1;
         foreach ($seList as $seId => $seVal) {
             $val = empty($dataInfo[$seId]) ? 0 : $dataInfo[$seId];
             $dataSet->AddPoint($val, "Serie" . $i++);
         }
     }
     $i = 1;
     foreach ($seList as $seDomain) {
         $dataSet->AddSerie("Serie{$i}");
         $dataSet->SetSerieName($seDomain, "Serie{$i}");
         $i++;
     }
     $serieCount = count($seList) + 1;
     $dataSet->AddPoint(array_keys($dataList), "Serie{$serieCount}");
     $dataSet->SetAbsciseLabelSerie("Serie{$serieCount}");
     # if language is japanese
     if ($_SESSION['lang_code'] == 'ja') {
         $fontFile = "fonts/M+1P+IPAG.ttf";
         $dataSet->SetXAxisName($_SESSION['text']['common']["Date"]);
         $dataSet->SetYAxisName($_SESSION['text']['common']["Rank"]);
     } else {
         $fontFile = "fonts/tahoma.ttf";
         $dataSet->SetXAxisName("Date");
         $dataSet->SetYAxisName("Rank");
     }
     $dataSet->SetXAxisFormat("date");
     # Initialise the graph
     $chart = new pChart(720, 520);
     $chart->setFixedScale($maxValue, 1);
     $chart->setFontProperties($fontFile, 8);
     $chart->setGraphArea(85, 30, 670, 425);
     $chart->drawFilledRoundedRectangle(7, 7, 713, 513, 5, 240, 240, 240);
     $chart->drawRoundedRectangle(5, 5, 715, 515, 5, 230, 230, 230);
     $chart->drawGraphArea(255, 255, 255, TRUE);
     $chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 90, 2);
     $chart->drawGrid(4, TRUE, 230, 230, 230, 50);
     # Draw the 0 line
     $chart->setFontProperties($fontFile, 6);
     $chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     # Draw the line graph
     $chart->drawLineGraph($dataSet->GetData(), $dataSet->GetDataDescription());
     $chart->drawPlotGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 3, 2, 255, 255, 255);
     $j = 1;
     $chart->setFontProperties($fontFile, 10);
     foreach ($seList as $seDomain) {
         $chart->writeValues($dataSet->GetData(), $dataSet->GetDataDescription(), "Serie" . $j++);
     }
     # Finish the graph
     $chart->setFontProperties("fonts/tahoma.ttf", 8);
     $chart->drawLegend(90, 35, $dataSet->GetDataDescription(), 255, 255, 255);
     $chart->setFontProperties($fontFile, 10);
     $kpText = $_SESSION['lang_code'] == 'ja' ? $this->spTextKeyword["Keyword Position Report"] : "Keyword Position Report";
     $chart->drawTitle(60, 22, $kpText, 50, 50, 50, 585);
     $chart->stroke();
 }
开发者ID:codegooglecom,项目名称:seopanel,代码行数:92,代码来源:report.ctrl.php

示例5: main


//.........这里部分代码省略.........
     $report_day = $kms_senc;
     $report_year = array();
     /** ALERT Save the result for Display in the view
      */
     //2
     $this->autoRender = false;
     //3
     App::import('Vendor', 'pData', array('file' => 'pchart' . DS . 'pData.class'));
     App::import('Vendor', 'pChart', array('file' => 'pchart' . DS . 'pChart.class'));
     //4
     $fontFolder = APP . 'vendors' . DS . 'pchart' . DS . 'Fonts';
     $fontFolder = '..' . DS . '..' . DS . 'vendors' . DS . 'pchart' . DS . 'Fonts';
     //5
     // Dataset definition
     $DataSet = new pData();
     $MaxKms = max($report_day);
     $MaxKms = $MaxKms + 100;
     foreach ($report_day as $key => $value) {
         $MyDay[] = (int) $key;
     }
     // 	$this->out(pr($MyDay));
     $DataSet->AddPoint($report_day, "Serie1");
     // 	$DataSet->AddPoint('4',"Serie2");
     // 	$DataSet->AddPoint('20',"Serie3");
     // 	$DataSet->AddPoint($MyDay,"Name");
     // exit();
     //         $this->out(pr($DataSet->GetData()));
     // 	$idx=0;
     //         foreach($MyDay as $key => $value){
     // 	  $DataSet->AddPoint($value,"Serie1");
     // 	  $DataSet->AddPoint((int)$key,"Name");
     //         }
     // 	    $this->out(pr($MyDay));
     //         $DataSet->GetData()['0']['Name']=;
     // 	  $DataSet->GetData()['0']['Name']=1;
     $this->out(pr($DataSet->GetData()));
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie();
     $key = $value = null;
     $DataSet->SetSerieName("Kilometros", "Serie1");
     $DataSet->SetSerieName("Dia", "Serie2");
     $DataSet->SetYAxisName("Kilometros Dias");
     $DataSet->SetYAxisUnit("Kms");
     $DataSet->SetXAxisName("Dias");
     $DataSet->SetXAxisFormat("number");
     // Initialise the graph
     //          pr($SchemaFolder);
     $Test = new pChart(820, 260);
     $Test->setFixedScale(1, $MaxKms, 5, 0, $NumDays, 5);
     $Test->setDateFormat("H:m");
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     // 	$Test->setColorPalette(0,115,173,207);
     // 	$Test->setColorPalette(1,144,196,226);
     $Test->setColorPalette(2, 174, 216, 240);
     $Test->setColorPalette(3, 64, 140, 195);
     $Test->setColorPalette(4, 104, 188, 209);
     $Test->setColorPalette(5, 99, 200, 226);
     $Test->setColorPalette(6, 82, 124, 148);
     $Test->setColorPalette(7, 97, 152, 183);
     $Test->setColorPalette(8, 105, 210, 231);
     $Test->setColorPalette(9, 167, 219, 216);
     $Test->setColorPalette(10, 224, 228, 204);
     $Test->setColorPalette(11, 243, 134, 48);
     // 	$Test->loadColorPalette("/tmp/schema/blue.txt",",");
     $Test->setGraphArea(100, 30, 790, 200);
     //       $Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
     $Test->drawRoundedRectangle(5, 5, 810, 225, 5, 230, 230, 230);
     $Test->drawGraphArea(255, 255, 255, TRUE);
     // 	dibujar la grafica
     $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 line graph
     // Draw the 0 line
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     // Draw the bar graph
     $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
     //  $Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription());
     //     $Test->drawXYPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2");
     //     $Test->drawXYPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie3");
     //     $Test->drawXYGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2");
     // Finish the graph
     $today = date('Y-m-d');
     // 	$Test->setFontProperties($fontFolder.DS."tahoma.ttf",8);
     //  	$Test->drawLegend(820,150,$DataSet->GetDataDescription(),255,255,255);
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     // 	$_today =
     if (isset($KeyArea)) {
         $area = "_" . $KeyArea;
     } else {
         $area = "_0";
     }
     if (isset($Fraccion)) {
         $fraction = "_" . $Fraccion;
     } else {
         $fraction = "_0";
     }
     $Test->drawTitle(220, 22, "Kilometros {$ThisArea[$KeyArea]} {$MyMonth} {$CurrentYear}", 50, 50, 50, 585);
     $Test->Render("../../app/webroot/img/thumbs/graph_kms_" . $today . $area . $fraction . ".png");
 }
开发者ID:ambagasdowa,项目名称:projections,代码行数:101,代码来源:reportkms.php

示例6: showGraph

 function showGraph($searchInfo = '')
 {
     $conditions = empty($searchInfo['keywordId']) ? "" : " and s.keyword_id=" . $searchInfo['keywordId'];
     $conditions .= empty($searchInfo['seId']) ? "" : " and s.searchengine_id=" . $searchInfo['seId'];
     $sql = "select s.*,se.domain \r\n\t\t\t\t\tfrom searchresults s,searchengines se  \r\n\t\t\t\t\twhere s.searchengine_id=se.id \r\n\t\t\t\t\tand time>= {$searchInfo['fromTime']} and time<{$searchInfo['toTime']} {$conditions}  \r\n\t\t\t\t\torder by s.time";
     $repList = $this->db->select($sql);
     $reportList = array();
     $seList = array();
     foreach ($repList as $repInfo) {
         $var = $repInfo['searchengine_id'] . $repInfo['keyword_id'] . $repInfo['time'];
         if (empty($reportList[$var])) {
             $reportList[$var] = $repInfo;
         } else {
             if ($repInfo['rank'] < $reportList[$var]['rank']) {
                 $reportList[$var] = $repInfo;
             }
         }
         if (empty($seList[$repInfo['searchengine_id']])) {
             $seList[$repInfo['searchengine_id']] = $repInfo['domain'];
         }
     }
     asort($seList);
     $dataList = array();
     foreach ($reportList as $repInfo) {
         $seId = $repInfo['searchengine_id'];
         $dataList[$repInfo['time']][$seId] = $repInfo['rank'];
     }
     # Dataset definition
     $dataSet = new pData();
     foreach ($dataList as $dataInfo) {
         $i = 1;
         foreach ($seList as $seId => $seVal) {
             $val = empty($dataInfo[$seId]) ? 0 : $dataInfo[$seId];
             $dataSet->AddPoint($val, "Serie" . $i++);
         }
     }
     $i = 1;
     foreach ($seList as $seDomain) {
         $dataSet->AddSerie("Serie{$i}");
         $dataSet->SetSerieName($seDomain, "Serie{$i}");
         $i++;
     }
     $serieCount = count($seList) + 1;
     $dataSet->AddPoint(array_keys($dataList), "Serie{$serieCount}");
     $dataSet->SetAbsciseLabelSerie("Serie{$serieCount}");
     $dataSet->SetXAxisName("Date");
     $dataSet->SetYAxisName("Rank");
     $dataSet->SetXAxisFormat("date");
     # Initialise the graph
     $chart = new pChart(720, 520);
     $chart->setFontProperties("fonts/tahoma.ttf", 8);
     $chart->setGraphArea(85, 30, 670, 425);
     $chart->drawFilledRoundedRectangle(7, 7, 713, 513, 5, 240, 240, 240);
     $chart->drawRoundedRectangle(5, 5, 715, 515, 5, 230, 230, 230);
     $chart->drawGraphArea(255, 255, 255, TRUE);
     $chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 90, 2);
     $chart->drawGrid(4, TRUE, 230, 230, 230, 50);
     # Draw the 0 line
     $chart->setFontProperties("fonts/tahoma.ttf", 6);
     $chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     # Draw the line graph
     $chart->drawLineGraph($dataSet->GetData(), $dataSet->GetDataDescription());
     $chart->drawPlotGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 3, 2, 255, 255, 255);
     $j = 1;
     $chart->setFontProperties("fonts/tahoma.ttf", 10);
     foreach ($seList as $seDomain) {
         $chart->writeValues($dataSet->GetData(), $dataSet->GetDataDescription(), "Serie" . $j++);
     }
     # Finish the graph
     $chart->setFontProperties("fonts/tahoma.ttf", 8);
     $chart->drawLegend(90, 35, $dataSet->GetDataDescription(), 255, 255, 255);
     $chart->setFontProperties("fonts/tahoma.ttf", 10);
     $chart->drawTitle(60, 22, "Keyword Position Report", 50, 50, 50, 585);
     $chart->stroke();
 }
开发者ID:codegooglecom,项目名称:seopanel,代码行数:75,代码来源:report.ctrl.php

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

示例8: main


//.........这里部分代码省略.........
     $this->autoRender = false;
     //3
     App::import('Vendor', 'pData', array('file' => 'pchart' . DS . 'pData.class'));
     App::import('Vendor', 'pChart', array('file' => 'pchart' . DS . 'pChart.class'));
     //4
     $fontFolder = APP . 'vendors' . DS . 'pchart' . DS . 'Fonts';
     $fontFolder = '..' . DS . '..' . DS . 'vendors' . DS . 'pchart' . DS . 'Fonts';
     //          $SchemaFolder = APP.'vendors'.DS.'pchart'.DS.'schema';
     //5
     // Dataset definition
     $DataSet = new pData();
     $MaxTons = max($report_day);
     $MaxTons = $MaxTons + 100;
     foreach ($report_day as $key => $value) {
         $MyDay[] = (int) $key;
     }
     // 	$this->out(pr($MyDay));
     $DataSet->AddPoint($report_day, "Serie1");
     // 	$DataSet->AddPoint('4',"Serie2");
     // 	$DataSet->AddPoint('20',"Serie3");
     // 	$DataSet->AddPoint($MyDay,"Name");
     // exit();
     //         $this->out(pr($DataSet->GetData()));
     // 	$idx=0;
     //         foreach($MyDay as $key => $value){
     // 	  $DataSet->AddPoint($value,"Serie1");
     // 	  $DataSet->AddPoint((int)$key,"Name");
     //         }
     // 	    $this->out(pr($MyDay));
     //         $DataSet->GetData()['0']['Name']=;
     // 	  $DataSet->GetData()['0']['Name']=1;
     $this->out(pr($DataSet->GetData()));
     $DataSet->AddAllSeries();
     $DataSet->SetAbsciseLabelSerie();
     $key = $value = null;
     $DataSet->SetSerieName("Toneladas", "Serie1");
     $DataSet->SetSerieName("Dia", "Serie2");
     $DataSet->SetYAxisName("Toneladas Dias");
     $DataSet->SetYAxisUnit("Ton");
     $DataSet->SetXAxisName("Dias");
     $DataSet->SetXAxisFormat("number");
     // Initialise the graph
     //          pr($SchemaFolder);
     $Test = new pChart(820, 260);
     $Test->setFixedScale(1, $MaxTons, 5, 0, $NumDays, 5);
     $Test->setDateFormat("H:m");
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     $Test->setColorPalette(0, 115, 173, 207);
     $Test->setColorPalette(1, 144, 196, 226);
     $Test->setColorPalette(2, 174, 216, 240);
     $Test->setColorPalette(3, 64, 140, 195);
     $Test->setColorPalette(4, 104, 188, 209);
     $Test->setColorPalette(5, 99, 200, 226);
     $Test->setColorPalette(6, 82, 124, 148);
     $Test->setColorPalette(7, 97, 152, 183);
     $Test->setColorPalette(8, 105, 210, 231);
     $Test->setColorPalette(9, 167, 219, 216);
     $Test->setColorPalette(10, 224, 228, 204);
     $Test->setColorPalette(11, 243, 134, 48);
     // 	$Test->loadColorPalette("/tmp/schema/blue.txt",",");
     $Test->setGraphArea(100, 30, 790, 200);
     //       $Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
     $Test->drawRoundedRectangle(5, 5, 810, 225, 5, 230, 230, 230);
     $Test->drawGraphArea(255, 255, 255, TRUE);
     // 	dibujar la grafica
     $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 line graph
     // Draw the 0 line
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     // Draw the bar graph
     $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
     //  $Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription());
     //     $Test->drawXYPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2");
     //     $Test->drawXYPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie3");
     //     $Test->drawXYGraph($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1","Serie2");
     // Finish the graph
     $today = date('Y-m-d');
     // 	$Test->setFontProperties($fontFolder.DS."tahoma.ttf",8);
     //  	$Test->drawLegend(820,150,$DataSet->GetDataDescription(),255,255,255);
     $Test->setFontProperties($fontFolder . DS . "tahoma.ttf", 10);
     if (empty($all) && !empty($KeyArea) && !empty($CurrentMonth)) {
         // CurrentMonth Area
         $Test->drawTitle(220, 22, "Toneladas {$ThisArea[$KeyArea]} {$MyMonth} {$CurrentYear}", 50, 50, 50, 585);
         $Test->Render("../../app/webroot/img/thumbs/graph_" . $today . "_" . $KeyArea . "_" . $Fraccion . ".png");
     }
     if ($all == true && $KeyArea == false && $CurrentMonth == false) {
         // AllYear
         $Test->drawTitle(220, 22, "Toneladas {$CurrentYear}", 50, 50, 50, 585);
         $Test->Render("../../app/webroot/img/thumbs/graph_" . $CurrentYear . "_" . $KeyArea . ".png");
     }
     if ($all == true && $KeyArea > 0 && $CurrentMonth == false) {
         // AllYearArea
         $Test->drawTitle(220, 22, "Toneladas {$ThisArea[$KeyArea]} {$CurrentYear}", 50, 50, 50, 585);
         $Test->Render("../../app/webroot/img/thumbs/graph_" . $CurrentYear . "_" . $KeyArea . ".png");
     }
     // 	$Test->drawTitle(220,22,"Toneladas $MyMonth $CurrentYear",50,50,50,585);
     // 	$Test->Render("../../app/webroot/img/thumbs/graph_".$today."_".$KeyArea."_".$Fraccion.".png");
 }
开发者ID:ambagasdowa,项目名称:projections,代码行数:101,代码来源:report.php

示例9: date

        if ($i == 0) {
            $XAxis[] = date("H:i", $data_server[$i]);
        } else {
            $OLNum[] = $data_server[$i];
        }
    }
}
$pChartDataSet = new pData();
$pChartDataSet->AddPoint($XAxis, "Serie1");
$pChartDataSet->AddPoint($OLNum, "Serie2");
$pChartDataSet->AddSerie("Serie2");
$pChartDataSet->RemoveSerie("Serie1");
$pChartDataSet->SetAbsciseLabelSerie("Serie1");
$pChartDataSet->SetYAxisName("在\n线\n人\n数\n//\n人");
$pChartDataSet->SetYAxisFormat("floor");
$pChartDataSet->SetXAxisFormat("number");
// 设置作图区域
$pChartGraph = new pChart($imgWidth, 253);
$pChartGraph->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
$pChartGraph->setGraphArea(70, 30, $imgWidth + 70 - 90, 253 + 30 - 80);
$pChartGraph->setFontProperties(DRAWFONE_PATH, 8);
$pChartGraph->drawScale($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), SCALE_NORMAL, 250, 250, 250, TRUE, 0, 0, FALSE, 1);
// 开始作图
$pChartGraph->setColorPalette(0, 0, 255, 255);
$pChartGraph->drawGraphAreaGradient(40, 40, 40, -50);
$pChartGraph->drawGrid(1, TRUE, 115, 115, 115, 10);
$pChartGraph->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$pChartGraph->drawFilledLineGraph($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), 25);
$pChartGraph->clearShadow();
$pChartGraph->setFontProperties(DRAWFONE_PATH, 10);
$pChartGraph->drawTitle($imgWidth / 2, 22, "实时在线人数查询(" . $dateTime . ") 峰值( " . $maxNumberIndex . ", " . $maxNumber . "人 )", 255, 255, 255, 585);
开发者ID:longceng,项目名称:honingwon,代码行数:31,代码来源:OnlineLogDraw.php

示例10: cartesianChart

 function cartesianChart($type, $x, $y, $w, $h, $imgname = '', $config = array())
 {
     $w -= 4;
     $h -= 4;
     $settings = array('FontName' => 'tahoma.ttf', 'FontSize' => 8, 'LegendFontSize' => 8, 'LegendFontName' => 'tahoma.ttf', 'Logo' => '', 'LogoTransparency' => 20, 'XAxisFormat' => 'number', 'XAxisUnit' => '', 'YAxisFormat' => 'number', 'YAxisUnit' => '', 'XLogo' => 0, 'YLogo' => 0, 'Xlabel' => 'x label', 'XAngle' => 0, 'Ylabel' => 'y label', 'Legend' => '', 'Textbox' => '', 'TextboxFontSize' => 8, 'TextboxFontName' => 'tahoma.ttf', 'ImgR' => 132, 'ImgG' => 173, 'ImgB' => 131, 'Decay' => 80, 'BGR' => 163, 'BGG' => 203, 'BGB' => 167, 'Decay2' => 80, 'Filled' => '', 'DataR' => 191, 'DataG' => 120, 'DataB' => 71, 'LBR' => 226, 'LBG' => 228, 'LBB' => 230, 'LR' => 0, 'LG' => 0, 'LB' => 0);
     // Get the custom settings
     if (is_array($config)) {
         foreach ($config as $key => $val) {
             $settings[$key] = $val;
         }
     }
     $DataSet = new pData();
     $DataSet->AddPoint($y, "Serie1");
     $DataSet->AddPoint($x, "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->RemoveSerie("Serie2");
     $DataSet->SetAbsciseLabelSerie("Serie2");
     $DataSet->SetSerieName($settings['Legend'], "Serie1");
     $DataSet->SetYAxisName($settings['Ylabel']);
     $DataSet->SetXAxisName($settings['Xlabel']);
     $DataSet->SetXAxisFormat($settings['XAxisFormat']);
     if (strlen($settings['XAxisUnit'])) {
         $DataSet->SetXAxisUnit($settings['XAxisUnit']);
     }
     if (strlen($settings['YAxisUnit'])) {
         $DataSet->SetYAxisUnit($settings['YAxisUnit']);
     }
     $DataSet->SetYAxisFormat($settings['YAxisFormat']);
     // Initialise the graph
     $Test = new pChart($w, $h);
     $Test->drawGraphAreaGradient($settings['ImgR'], $settings['ImgG'], $settings['ImgB'], $settings['Decay'], TARGET_BACKGROUND);
     $FontSize = $settings['FontSize'];
     $FontName = $this->_ext_path . "/fonts/" . $settings['FontName'];
     $Test->setFontProperties($FontName, $FontSize);
     //Calc Textbox Height
     if (strlen($settings['Textbox'])) {
         $TextboxFontSize = $settings['TextboxFontSize'];
         $TextboxFontName = $this->_ext_path . "/fonts/" . $settings['TextboxFontName'];
         $Position = imageftbbox($TextboxFontSize, 0, $TextboxFontName, $settings['Textbox']);
         $TextboxHeight = $Position[1] - $Position[7] + 8;
     } else {
         $TextboxHeight = 0;
     }
     // Maximize The graph area
     //on Y axis
     if ($settings['XAxisFormat'] == 'time') {
         $xdata = "99:99:99";
         $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
         $WXmax = $Position[2] - $Position[0];
         $TextHeightX = $Position[1] - $Position[7];
     } elseif ($settings['XAxisFormat'] == 'date') {
         $xdata = "99/99/9999";
         $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
         $WXmax = $Position[2] - $Position[0];
         $TextHeightX = $Position[1] - $Position[7];
     } else {
         $WXmax = 0;
         foreach ($x as $xdata) {
             $xdata .= $settings['XAxisUnit'];
             $Position = imageftbbox($FontSize, 0, $FontName, $xdata);
             $TextWidth = $Position[2] - $Position[0];
             $TextHeightX = $Position[1] - $Position[7];
             $WXmax = $TextWidth > $WXmax ? $TextWidth : $WXmax;
         }
     }
     if ($settings['XAngle'] > 0) {
         $sin = abs(sin(deg2rad($settings['XAngle'])));
         $cos = abs(cos(deg2rad($settings['XAngle'])));
         $HXmax = $WXmax * $sin + $TextHeightX * $cos;
     } else {
         $HXmax = $TextHeightX;
     }
     //on Y axis...
     if ($settings['YAxisFormat'] == 'time') {
         $ydata = "99:99:99";
         $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
         $WYmax = $Position[2] - $Position[0];
         $TextHeightY = $Position[1] - $Position[7];
     } elseif ($settings['YAxisFormat'] == 'date') {
         $ydata = "99/99/9999";
         $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
         $WYmax = $Position[2] - $Position[0];
         $TextHeightY = $Position[1] - $Position[7];
     } else {
         $WYmax = 0;
         foreach ($y as $ydata) {
             $ydata .= $settings['YAxisUnit'];
             //echo $ydata."<br>";
             $Position = imageftbbox($FontSize, 0, $FontName, $ydata);
             $TextWidth = $Position[2] - $Position[0];
             $TextHeightY = $Position[1] - $Position[7];
             $WYmax = $TextWidth > $WYmax ? $TextWidth : $WYmax;
         }
     }
     $Test->setGraphArea($WYmax + $TextHeightY + 35, 20, $w - 25, $h - $HXmax - $TextHeightX - $TextboxHeight - 20);
     //$Test->setGraphArea(60,20,$w-25,($settings['XAngle']==0)?$h-70:$h-100);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, $settings['XAngle'], 0, TRUE);
     $Test->drawGraphAreaGradient($settings['BGR'], $settings['BGG'], $settings['BGB'], $settings['Decay2']);
     $Test->drawGrid(4, TRUE, 230, 230, 230, 20);
     // This will put the picture "logo.png" with transparency
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:mallerp_standard,代码行数:101,代码来源:Charts.php


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