本文整理汇总了PHP中pChart::setFixedScale方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::setFixedScale方法的具体用法?PHP pChart::setFixedScale怎么用?PHP pChart::setFixedScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::setFixedScale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render graph
*
*@return nothing
**/
function render($p_stack = FALSE)
{
// declare the graph
$Test = new pChart(800, 250);
$Test->tmpFolder = $this->tmpPath;
$fileId = time() . '_' . rand(1, 1000);
$fontFile = "tahoma.ttf";
// prepare the map
echo '<SCRIPT TYPE="text/javascript" SRC="' . $this->pChartPath . 'overlib.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="' . $this->pChartPath . 'pMap.js"></SCRIPT>';
$MapID = "map_" . $fileId . ".map";
$Test->setImageMap(TRUE, $MapID);
$Map = new pChart(800, 250);
$Map->tmpFolder = $this->tmpPath;
$imgName = "img_" . $fileId . ".png";
$img = $this->tmpPath . $imgName;
$imgLink = GLPI_ROOT . "/plugins/fusioninventory/front/send.php?file=" . urlencode("tmp/" . $imgName);
$mapLink = GLPI_ROOT . "/plugins/fusioninventory/front/send.php?file=" . urlencode("tmp/" . $MapID);
echo '<DIV ID="overDiv" STYLE="position:absolute; visibility:hidden; z-index:1000;"></DIV>';
echo "<IMG ID='fusioninventory_graph_{$fileId}' SRC='{$imgLink}' WIDTH=800 HEIGHT=250 BORDER=0 OnMouseMove='fusioninventory_graph(event);' OnMouseOut='nd();'>";
echo '<SCRIPT>
function fusioninventory_graph(event) {
LoadImageMap("fusioninventory_graph_' . $fileId . '","' . $mapLink . '");
getMousePosition(event);
}
</SCRIPT>';
// configure the graph
$Test->setFontProperties($this->fontsPath . $fontFile, 8);
$Test->setGraphArea(80, 30, 580, 185);
// graph size : keep place for titles on X and Y axes
$Test->drawFilledRoundedRectangle(7, 7, 793, 243, 5, 240, 240, 240);
// background rectangle
$Test->drawRoundedRectangle(5, 5, 795, 245, 5, 230, 230, 230);
// 3D effect
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->setFixedScale(0, $this->getMaxY($this->maxValue), $this->divisionsY);
// to see values from 0
$Test->drawScale($this->pData->GetData(), $this->pData->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties($this->fontsPath . $fontFile, 6);
// Draw the bar graph
if ($p_stack) {
$Test->drawStackedBarGraph($this->pData->GetData(), $this->pData->GetDataDescription(), 100);
} else {
$Test->drawBarGraph($this->pData->GetData(), $this->pData->GetDataDescription(), FALSE, 100);
}
// Finish the graph
$Test->setFontProperties($this->fontsPath . $fontFile, 8);
$Test->drawLegend(590, 30, $this->pData->GetDataDescription(), 255, 255, 255);
// take care of legend text size
$Test->setFontProperties($this->fontsPath . $fontFile, 10);
$Test->drawTitle(50, 22, $this->title . ' (/ ' . $this->timeUnitName . ')', 50, 50, 50, 585);
$Test->Render($img);
}
示例2: pData
$data[$s['day']] = $s['u_pro'];
}
}
// Standard inclusions
include 'pChart/pData.class';
include 'pChart/pChart.class';
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($data, 'S1');
$DataSet->AddPoint(array_keys($data), 'S2');
$DataSet->AddSerie('S1');
$DataSet->SetAbsciseLabelSerie('S2');
// Initialise the graph
$Test = new pChart(700, 230);
if ($is_null) {
$Test->setFixedScale(0, 1, 1);
}
$Test->setFontProperties('Fonts/tahoma.ttf', 8);
$Test->setGraphArea(50, 30, 665, 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 cubic curve graph
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$Test->setFontProperties('Fonts/tahoma.ttf', 10);
$Test->drawTitle(50, 22, 'Пользователи PRO', 50, 50, 50, 585);
$Test->Stroke();
?>
示例3: componentLineGraph
public function componentLineGraph()
{
$DataSet = new pData();
$maxvals = array();
foreach ($this->datasets as $ds_id => $dataset) {
$DataSet->AddPoint($dataset['values'], "Serie" . $ds_id, array_keys($dataset['values']));
$maxvals[] = max($dataset['values']);
if (isset($dataset['burndown'])) {
$amount = count($dataset['values']) > 1 ? $dataset['burndown']['maxEstimation'] / (count($dataset['values']) - 1) : 0;
for ($i = 0; $i < count($dataset['values']); $i++) {
$burndownValues[] = $dataset['burndown']['maxEstimation'] - $i * $amount;
}
$DataSet->AddPoint($burndownValues, "Burndown" . $ds_id, $dataset['burndown']['maxEstimation']);
}
}
$DataSet->AddAllSeries();
if (isset($this->labels)) {
$DataSet->AddPoint($this->labels, "Labels");
$DataSet->SetAbsciseLabelSerie("Labels");
} else {
$DataSet->SetAbsciseLabelSerie();
}
foreach ($this->datasets as $ds_id => $dataset) {
$DataSet->SetSerieName($dataset['label'], "Serie" . $ds_id);
if (isset($dataset['burndown'])) {
$DataSet->SetSerieName($dataset['burndown']['label'], "Burndown" . $ds_id);
}
}
if (isset($this->values_title)) {
$DataSet->SetYAxisName($this->values_title);
}
if (isset($this->labels_title)) {
$DataSet->SetXAxisName($this->labels_title);
}
// Initialise the graph
$Test = new pChart($this->width, $this->height);
$Test->setFixedScale(0, ceil(max($maxvals) / 5) * 5);
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
if (isset($this->labels_title)) {
$Test->setGraphArea(50, 30, $this->width - 30, $this->height - 45);
} else {
$Test->setGraphArea(50, 30, $this->width - 30, $this->height - 30);
}
$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);
$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(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the cubic curve graph
if (isset($this->style) && $this->style == 'curved') {
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
} elseif (isset($this->style) && $this->style == 'filled_line') {
$Test->drawFilledLineGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true);
} elseif (isset($this->style) && $this->style == 'stacked_bar') {
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 50, true);
} elseif (isset($this->style) && $this->style == 'single_bar') {
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
} else {
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
}
if (isset($this->include_plotter) && $this->include_plotter) {
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
}
// Finish the graph
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
//$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->drawLegend(55, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', 10);
$Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30);
$Test->Stroke();
//("example2.png");
}
示例4: pChart
// Initialise the graph
$Test = new pChart(700,400);
$Test->setFontProperties("../lib/Fonts/tahoma.ttf",8);
$Test->setGraphArea(50,30,670,370);
$Test->drawFilledRoundedRectangle(5,5,695,395,5,191,191,191);
/*
$Test->drawRoundedRectangle(0,0,700,400,5,33,33,33);
$Test->drawRoundedRectangle(1,1,699,399,5,33,33,33);
$Test->drawRoundedRectangle(2,2,698,398,5,33,33,33);
$Test->drawRoundedRectangle(3,3,697,397,5,33,33,33);
*/
$Test->drawGraphArea(150,150,150);
$nb_joueurs_graph = ($nb_joueurs - $nb_joueurs % 10) + 10;
$Test->setFixedScale($nb_joueurs_graph,0,$nb_joueurs_graph/5,0,38,1);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,20,20,20,TRUE,0,2);
$Test->drawGrid(4,FALSE,0,0,0);
// Draw the 0 line
$Test->setFontProperties("../lib/Fonts/tahoma.ttf",6);
$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the line graph
//$Test->setLineStyle(3);
$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),2,0,255,0,0);
//$Test->writeValues($DataSet->GetData(),$DataSet->GetDataDescription(),"SerieClassement");
// Finish the graph
$Test->setFontProperties("../lib/Fonts/tahoma.ttf",8);
示例5: pData
Example2 : A cubic curve graph
*/
// Standard inclusions
include "../lib/pData.php";
include "../lib/pChart.php";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 4, 3, 4, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1");
$DataSet->AddPoint(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFixedScale(-2, 8);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 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 cubic curve graph
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
示例6: pCache
/**
* Generates an histogram
*
* @param array list of exercise names
* @param array my results 0 to 100
* @param array average scores 0-100
*/
static function generate_session_exercise_graph($names, $my_results, $average)
{
require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php';
require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php';
$cache = new pCache();
// Dataset definition
$data_set = new pData();
// Dataset definition
$data_set->AddPoint($average, "Serie1");
$data_set->AddPoint($my_results, "Serie2");
$data_set->AddPoint($names, "Serie3");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie('Serie3');
$data_set->SetSerieName(get_lang('AverageScore'),"Serie1");
$data_set->SetSerieName(get_lang('MyResults'), "Serie2");
//$data_set->SetYAxisName(get_lang("Percentage"));
$data_set->SetYAxisUnit("%");
// Initialise the graph
$main_width = 860;
$main_height = 500;
$y_label_angle = 50;
$data_set->RemoveSerie("Serie3");
$graph = new pChart($main_width, $main_height);
//See 3.2 BT#2797
$graph->setFixedScale(0,100);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
$graph->setGraphArea(65,50,$main_width-20, $main_height-140);
$graph->drawFilledRoundedRectangle(7,7,$main_width-7,$main_height-7,5,240,240,240);
$graph->drawRoundedRectangle(5,5,$main_width-5,$main_height -5,5,230,230,230);
$graph->drawGraphArea(255,255,255,TRUE);
//SCALE_NORMAL, SCALE_START0, SCALE_ADDALLSTART0, SCALE_ADDALL
$graph->drawScale($data_set->GetData(),$data_set->GetDataDescription(),SCALE_NORMAL ,150,150,150,TRUE,$y_label_angle,1, TRUE);
$graph->drawGrid(4,TRUE,230,230,230,70);
// Draw the 0 line
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$graph->drawTreshold(0,143,55,72,TRUE,TRUE);
// Draw the cubic curve graph
$graph->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$graph->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),1,1,230,255,255);
// Finish the graph
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',10);
$graph->drawLegend($main_width - 150,70,$data_set->GetDataDescription(),255,255,255);
$graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',11);
$graph->drawTitle(50, 30, get_lang('ExercisesInTimeProgressChart'), 50,50,50,$main_width-110, true);
// $main_graph = new pChart($main_width,$main_height);
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
$graph_id = 'generate_session_exercise_graph'.$courseCode.'-'.intval($_GET['session_id']).'-'.api_get_user_id();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if (0) {
//if we already created the img
//echo 'in cache';
$img_file = $cache->GetHash($graph_id,$data_set->GetData());
} else {
$cache->WriteToCache($graph_id, $data_set->GetData(), $graph);
ob_start();
$graph->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
$html = '<img src="'.api_get_path(WEB_ARCHIVE_PATH).$img_file.'">';
return $html;
}
示例7: get_evaluations_courses_in_sessions_graph
/**
* This method return a graph containing information about evaluations
* inside courses in sessions, it's used inside get_block method for
* showing it inside dashboard interface
* @return string img html
*/
public function get_evaluations_courses_in_sessions_graph()
{
$graphs = array();
if (!empty($this->sessions)) {
$session_ids = array_keys($this->sessions);
foreach ($session_ids as $session_id) {
$courses_code = array_keys(Tracking::get_courses_list_from_session($session_id));
$courses_graph = array();
foreach ($courses_code as $course_code) {
$cats = Category::load(null, null, $course_code, null, null, $session_id);
if (isset($cats) && isset($cats[0])) {
$alleval = $cats[0]->get_evaluations(null, true, $course_code);
$alllinks = $cats[0]->get_links(null, true);
$users = get_all_users($alleval, $alllinks);
$datagen = new FlatViewDataGenerator ($users, $alleval, $alllinks);
$evaluation_sumary = $datagen->get_evaluation_sumary_results();
if (!empty($evaluation_sumary)) {
$items = array_keys($evaluation_sumary);
$max = $min = $avg = array();
foreach ($evaluation_sumary as $evaluation) {
$max[] = $evaluation['max'];
$min[] = $evaluation['min'];
$avg[] = $evaluation['avg'];
}
// Dataset definition
$data_set = new pData;
$data_set->AddPoint($max, "Max");
$data_set->AddPoint($avg, "Avg");
$data_set->AddPoint($min, "Min");
$data_set->AddPoint($items, "Items");
$data_set->SetXAxisName(get_lang('EvaluationName'));
$data_set->SetYAxisName(get_lang('Percentage'));
$data_set->AddAllSeries();
$data_set->RemoveSerie("Items");
$data_set->SetAbsciseLabelSerie("Items");
$graph_id = $this->user_id.'StudentEvaluationGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data)) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data);
} else {
// Initialise the graph
$angle = -30;
$test = new pChart($this->bg_width, $this->bg_height);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->fixHeightByRotation(
$data_set->GetData(),
$data_set->GetDataDescription(),
$angle
);
$test->setGraphArea(50, 30, $this->bg_width - 75, $this->bg_height - 75);
$test->drawFilledRoundedRectangle(
7,
7,
$this->bg_width - 20,
$test->YSize - 20,
5,
240,
240,
240
);
$test->drawRoundedRectangle(
5,
5,
$this->bg_width - 18,
$test->YSize - 18,
5,
230,
230,
230
);
$test->drawGraphArea(255,255,255,TRUE);
$test->setFixedScale(0,100,5);
$test->drawScale(
$data_set->GetData(),
$data_set->GetDataDescription(),
SCALE_ADDALL,
150,
150,
150,
TRUE,
$angle,
2,
TRUE
);
$test->setColorPalette(0,105,221,34);
$test->setColorPalette(1,255,135,30);
$test->setColorPalette(2,255,0,0);
$test->drawGrid(4,TRUE,230,230,230,50);
// Draw the 0 line
$test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',6);
$test->drawTreshold(0,143,55,72,TRUE,TRUE);
//.........这里部分代码省略.........
示例8: foreach
$DataSet->AddAllSeries("Serie{$key}");
$lastid = $key;
}
if (!empty($abciselabel)) {
$nk = $lastid + 1;
$DataSet->AddPoint($abciselabel, "Serie{$nk}");
$DataSet->SetAbsciseLabelSerie("Serie{$nk}");
} else {
$DataSet->SetAbsciseLabelSerie();
}
foreach ($series as $key => $val) {
$DataSet->SetSerieName($val['name'], "Serie{$key}");
}
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFixedScale($min, $max);
$Test->setFontProperties($CFG->dirroot . "/report/configreports/lib/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(70, 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);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties($CFG->dirroot . "/report/configreports/lib/Fonts/tahoma.ttf", 10);
$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($CFG->dirroot . "/report/configreports/lib/Fonts/tahoma.ttf", 8);
示例9: pChart
// Build Chart
$Test = new pChart(600, 280);
$Test->loadColorPalette("pChart/hardtones.pal");
// Make Evenly Disable Ranks (No Real Numbers) - optimizing by making sure $max is not prime
$max = max($max_rank);
$max = $max + (7 - $max % 7);
for ($divs = 5; ($max - 1) % $divs != 0 && $max % $divs != 0; $divs += 1) {
}
if ($max % $divs == 0) {
$max = $max + 1;
}
if ($divs > 15) {
$divs = 15;
}
// Set Y Scale
$Test->setFixedScale($max, 1, $divs, 0, 0, 1);
// Draw Graph Area
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->setGraphArea(45, 30, 450, 200);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
// Scale grid and background
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 80, 80, 80, TRUE, 50, 100, FALSE, $time_label_hours);
$Test->drawGrid(4, FALSE, 210, 210, 210);
// Draw Data
$Test->drawTreshold(1, 100, 100, 100);
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
//$Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),1);
// Draw Legend
$Test->drawLegend(465, 75, $DataSet->GetDataDescription(), 225, 225, 225, 0, 0, 0, 100, 100, 100, FALSE);
// Draw Title
示例10: Used
$DataSet->SetSerieName("Kerosene", "Serie3");
$DataSet->SetYAxisName("Amount Used (kg)");
$DataSet->SetXAxisName("Month of the year");
$DataSet->SetSerieSymbol("Serie1", "../Sample/Point_Asterisk.gif");
$DataSet->SetSerieSymbol("Serie2", "../Sample/Point_Cd.gif");
// Initialise the graph
$Test = new pChart(890, 250);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
$Test->setGraphArea(60, 40, 595, 190);
//$RectangleSettings = array("R"=>209,"G"=>31,"B"=>27,"Alpha"=>50,"Surrounding"=>30);
//$Test->drawRoundedFilledRectangle(10,25,70,55,5,$RectangleSettings);
//$RectangleSettings = array("R"=>209,"G"=>31,"B"=>27,"Alpha"=>50,"Surrounding"=>30);
//$Test->drawGraphAreaGradient(132,173,131,50, TARGET_BACKGROUND);
//$Test->drawGraphAreaGradient(132,173,131,50, $RectangleSettings);
$Test->reportWarnings("GD");
$Test->setFixedScale(0, 18, 5);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
//$Test->setGraphArea(65, 30, 570, 185);
//$Test->drawFilledRoundedRectangle(7, 7, 800, 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, 0, 0, 0, TRUE, 0, 2, TRUE, 1);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 0);
//$Test->drawGraphAreaGradient(162, 183, 202, 50);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
//$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$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);
示例11: 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");
}
示例12: build
public function build()
{
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pData.php';
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pChart.php';
$dataSet = new pData();
foreach ($this->lines as $name => $ordinateValues) {
if (count($ordinateValues) != count($this->absciseValues)) {
throw new Exception('Count of line "' . $name . '" ordinate points "' . count($ordinateValues) . '" mismatch to abscise points "' . count($this->absciseValues) . '"');
}
$dataSet->AddPoint($ordinateValues, $name);
}
$dataSet->AddPoint($this->absciseValues, 'Abscise');
$dataSet->AddAllSeries();
$dataSet->RemoveSerie('Abscise');
$dataSet->SetAbsciseLabelSerie('Abscise');
foreach ($this->lines as $name => $ordinateValues) {
$dataSet->SetSerieName($name, $name);
}
$dataSet->SetYAxisUnit($this->ordinateStepTitle);
$dataSet->SetXAxisUnit($this->absciseStepTitle);
$chart = new pChart($this->maxWidth, $this->maxHeight);
$chart->drawGraphAreaGradient(132, 153, 172, 50, TARGET_BACKGROUND);
// Graph area setup
$chart->setFontProperties(PCHART_FONTS_DIR . DIRECTORY_SEPARATOR . 'tahoma.ttf', 10);
$chart->setGraphArea($this->graphMargins[0], $this->graphMargins[1], $this->maxWidth - $this->graphMargins[2], $this->maxHeight - $this->graphMargins[3]);
$chart->drawGraphArea(213, 217, 221, FALSE);
$ordinateScaleMargin = ($this->getMaxOrdinateValue() - $this->getMinOrdinateValue()) / $this->ordinateDevisions;
$chart->setFixedScale($this->getMinOrdinateValue() - $ordinateScaleMargin, $this->getMaxOrdinateValue() + $ordinateScaleMargin, $this->ordinateDevisions);
$chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 2);
$chart->drawGraphAreaGradient(162, 183, 202, 50);
$chart->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the line chart
// $chart->setShadowProperties(1, 1, 0, 0, 0, 30, 4);
$chart->drawLineGraph($dataSet->GetData(), $dataSet->GetDataDescription());
$chart->clearShadow();
$chart->drawPlotGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 5, 3, -1, -1, -1, TRUE);
// Draw the legend
$chart->drawLegend($this->maxWidth - $this->graphMargins[2] + 10, $this->graphMargins[1], $dataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
// Draw chart title
if ($this->chartTitle) {
$chart->drawTextBox(0, $this->maxHeight - 20, $this->maxWidth, $this->maxHeight, $this->chartTitle, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
}
// Render the picture
$chart->addBorder(2);
$chart->Render($this->outputFilepath);
}
示例13: 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");
}
示例14: pChart
}
while ($rowHistoJournees = mysql_fetch_array($resultHistoJournees)) {
$tabVals[$rowHistoJournees[0]] = $rowHistoJournees[1];
}
$dataSet->AddPoint($tabVals, "Serie1");
$dataSet->AddPoint($tabDays, "Serie2");
$dataSet->AddSerie("Serie1");
$dataSet->SetAbsciseLabelSerie("Serie2");
// Graph width
$width = 800;
// Graph height
$height = 230;
$heightForAngle = 0;
$absLabelAngle = 0;
// Initialize the graph
$chart = new pChart($width, $height + $heightForAngle);
$chart->setGraphArea(40, 30, $width - 20, $height - 30);
$chart->setFontProperties("../lib/Fonts/tahoma.ttf", 10);
$chart->drawFilledRoundedRectangle(7, 7, $width - 7, $height - 7 + $heightForAngle, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, $width - 5, $height - 5 + $heightForAngle, 5, 230, 230, 230);
$chart->drawGraphArea(252, 252, 252);
// definition of drawScale method : drawScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE)
$chart->setFixedScale(0, 10);
$chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, $absLabelAngle, 2, TRUE);
$chart->drawGrid(4, TRUE, 230, 230, 230, 255);
// Draw the bar graph
$chart->drawBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), TRUE);
// Finish the graph
$chart->setFontProperties("../lib/Fonts/tahoma.ttf", 10);
$chart->drawTitle(0, 0, "", 50, 50, 50, $width, 35);
$chart->Stroke();
示例15: pChart
$DataSet->AddPoint($x_lable_arr, "x_lable_name");
$DataSet->SetAbsciseLabelSerie("x_lable_name");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("x_lable_name");
$DataSet->SetSerieName("", "Serie3");
// $DataSet->SetYAxisName("Kg");
// $DataSet->SetXAxisName("week");
$DataSet->SetSerieSymbol("Serie3", $normal_circle);
$DataSet->SetSerieSymbolLastOne("Serie3", $last_circle);
// Initialise the graph
$Test = new pChart($width, $height);
$Test->setFontPropertiesDir("{$pChart_dir}/Fonts");
// Add an image
$Test->drawFromPNG($background, 0, 0);
$Test->reportWarnings("GD");
$Test->setFixedScale($min_y_value, $max_y_value, 5);
$Test->setFontProperties("{$pChart_dir}/Fonts/tahoma.ttf", 14);
$Test->setGraphArea($area_margin_left, 20, $width - 30, $height - 55);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 255, 255, 255, TRUE, 0, 2, TRUE, 1);
$Test->drawGrid(4, TRUE, 233, 218, 213, 0);
//画网格
// Draw the area
$Test->drawArea($DataSet->GetData(), "Serie3", "Serie4", 239, 238, 227, 40);
$DataSet->RemoveSerie("Serie4");
// Draw the line graph
$Test->setColorPalette(0, 255, 237, 237);
$Test->setLineStyle(2, 0);
//设置虚线的宽度
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setColorPalette(0, 243, 247, 252);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 5, 3, 255, 255, 255);