本文整理汇总了PHP中pChart::setDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::setDateFormat方法的具体用法?PHP pChart::setDateFormat怎么用?PHP pChart::setDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::setDateFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createGraphToFile
/**
* Генерация графика
* @param DataSet $DataSet
* @param String $GraphTitle
* @param String $safeToFile
*/
function createGraphToFile($DataSet, $GraphTitle, $safeToFile, $scaleFormat)
{
// Rotrate
$rotate = 30;
// Initialise the graph
$GraphImage = new pChart(594, 344);
$GraphImage->setDateFormat($scaleFormat);
// $GraphImage->loadColorPalette(DIR_FONT.'/tones-3.txt');
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 8);
$GraphImage->setGraphArea(80, 50, 580, 300);
$GraphImage->drawFilledRectangle(3, 3, 590, 340, 240, 240, 240);
$GraphImage->drawRectangle(0, 0, 593, 343, 230, 230, 230);
$GraphImage->drawGraphArea(255, 255, 255, TRUE);
$GraphImage->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, $rotate, 0, FALSE);
$GraphImage->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 6);
$GraphImage->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Просто пунктирная линия
// Draw the cubic curve graph
$GraphImage->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Draw the line graph
//$GraphImage->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$GraphImage->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$GraphImage->setFontProperties(DIR_FONT . "/segoepr.ttf", 12);
$GraphImage->drawTitle(60, 32, $GraphTitle, 50, 50, 50, 600);
//$GraphImage->Render(DIR_CACHE . './' . $safeToFile . '.png');
$GraphImage->Stroke();
}
示例2: pCache
$DataSet->AddPoint($points, "points");
$DataSet->AddPoint($rank, "rank");
$DataSet->AddPoint($time, "time");
$DataSet->AddSerie("points");
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("Punkte", "points");
$DataSet->SetSerieName("Rank", "rank");
$DataSet->SetYAxisName("Punkte");
$DataSet->SetAbsciseLabelSerie("time");
//$DataSet->SetXAxisFormat("date");
// Cache definition
$Cache = new pCache('../charts/Cache/');
if ($use_cache && !$Cache->GetFromCache(md5($user['name']), $DataSet->GetData(), $FileName) or !$use_cache) {
// Initialise the graph
$Test = new pChart(715, 230);
$Test->setDateFormat('d.m H:i');
$Test->setFontProperties("../charts/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 30, 650, 150);
$Test->drawFilledRoundedRectangle(7, 7, 708, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 710, 225, 5, 163, 203, 167);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale);
$Test->drawGrid(4, TRUE, 230, 230, 230, 40);
// Draw the graph
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
if ($scale_hours <= 48) {
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2, 1, 255, 255, 255);
}
// Draw labels
if (!empty($ccities)) {
示例3: 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");
}
示例4: 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);
}
示例5: 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");
}