本文整理汇总了PHP中pChart::drawTreshold方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawTreshold方法的具体用法?PHP pChart::drawTreshold怎么用?PHP pChart::drawTreshold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawTreshold方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawChart
function drawChart($title, $DataSet, $names, $colors, $legend = false)
{
// Initialise the graph
$Chart = new pChart(1300, 750);
$Chart->setFontProperties("Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 25, 1200, 725);
$Chart->drawGraphArea(255, 255, 255, TRUE);
$Chart->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "ally", "allx", 150, 150, 150, TRUE, 45);
$Chart->setLineStyle(4);
// Draw the 0 line
$Chart->setFontProperties("Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
foreach ($colors as $idx => $color) {
$Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
}
$i = 0;
foreach ($names as $name) {
$Chart->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $name . "y", $name . "x", $i);
$i++;
}
if ($legend) {
$Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Finish the graph
$Chart->setFontProperties("Fonts/tahoma.ttf", 10);
// $Chart->drawTitle(60,22,$title,50,50,50,530);
$Chart->Stroke();
}
示例2: pData
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// 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->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->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->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 50);
// 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, "Example 7", 50, 50, 50, 585);
$Test->Render("example7.png");
示例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");
}
示例4: drawChart
function drawChart($title, $DataSet, $type, $colors, $legend = false)
{
// Initialise the graph
$Chart = new pChart(1300, 700);
$Chart->setFontProperties("Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 50, 1200, 600);
$Chart->drawGraphArea(255, 255, 255, TRUE);
$Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 0, TRUE);
// Draw the 0 line
$Chart->setFontProperties("Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
foreach ($colors as $idx => $color) {
$Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
}
if ($type == "bar") {
$Chart->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
} else {
if ($type == "line") {
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
}
}
if ($legend) {
$Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Finish the graph
$Chart->setFontProperties("Fonts/tahoma.ttf", 10);
$Chart->drawTitle(60, 22, $title, 50, 50, 50, 530);
$Chart->Stroke();
}
示例5: 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();
}
示例6: 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");
}
示例7: makeGraph
function makeGraph($values, $labels)
{
$values[] = '0';
$labels[] = '';
// Standard inclusions
include_once "charts/pChart.class";
include_once "charts/pData.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($values, "Serie2");
$DataSet->AddPoint($labels, "Xlabel");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie('Xlabel');
$DataSet->SetSerieName("No Of Births", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$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, 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, "Change in name popularity", 50, 50, 50, 585);
ob_start();
$Test->Stroke();
$img = ob_get_clean();
$img = base64_encode($img);
return $img;
}
示例8: line
function line($valores, $titulo, $label = array())
{
$nombre = tempnam('/tmp', 'g') . '.png';
$DataSet = new pData();
$ind = 1;
$DataSet->AddPoint($valores, 'Serie' . $ind);
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName($titulo, 'Serie' . $ind);
if (count($label) > 0) {
$ID = 0;
foreach ($label as $val) {
$DataSet->Data[$ID]["Name"] = $val;
$ID++;
}
}
$Test = new pChart(300, 200);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->setGraphArea(70, 30, 280, 170);
$Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 0);
$Test->drawGrid(4, TRUE, 200, 200, 200, 50);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->drawLegend(200, 9, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 10);
//$Test->drawTitle(10,22,$titulo,50,50,50,300);
$Test->Render($nombre);
return $nombre;
}
示例9: writeBarData
function writeBarData($data, $graph)
{
if ($data != "") {
echo "Plottong " . $graph . "\n";
$dataset1 = array();
$dataset2 = array();
$counter = 0;
$toggle = true;
$data = array_reverse($data, TRUE);
ksort($data);
foreach ($data as $key => $value) {
if ($counter % 5 != 0) {
$key = " ";
}
array_push($dataset1, $key);
array_push($dataset2, $value);
$counter++;
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($dataset2, "Serie1");
$DataSet->AddPoint($dataset1, "XLabel");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("XLabel");
$DataSet->RemoveSerie("XLabel");
$DataSet->SetSerieName("Membership", "Serie1");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 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("Fonts/tahoma.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("Fonts/tahoma.ttf", 8);
$Test->drawLegend(596, 150, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, "Membership by Month", 50, 50, 50, 585);
$Test->Render("{$graph}-bar.png");
}
}
示例10: 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;
}
示例11: createChart
//.........这里部分代码省略.........
} else {
foreach ($lbl as $kkey => $kval) {
$lblout[] = $kkey . ' (' . $kval . ')';
}
}
$counter = 0;
foreach ($lblout as $sLabelName) {
$DataSet->SetSerieName(html_entity_decode($sLabelName, null, 'UTF-8'), "Serie{$counter}");
$counter++;
}
if ($cache->IsInCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()) && Yii::app()->getConfig('debug') < 2) {
$cachefilename = basename($cache->GetFileFromCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()));
} else {
$graph = new pChart(1, 1);
$graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
$legendsize = $graph->getLegendBoxSize($DataSet->GetDataDescription());
if ($legendsize[1] < 320) {
$gheight = 420;
} else {
$gheight = $legendsize[1] + 100;
}
$graph = new pChart(690 + $legendsize[0], $gheight);
$graph->drawFilledRectangle(0, 0, 690 + $legendsize[0], $gheight, 254, 254, 254, false);
$graph->loadColorPalette($homedir . DIRECTORY_SEPARATOR . 'styles' . DIRECTORY_SEPARATOR . $admintheme . DIRECTORY_SEPARATOR . 'limesurvey.pal');
$graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
$graph->setGraphArea(50, 30, 500, $gheight - 60);
$graph->drawFilledRoundedRectangle(7, 7, 523 + $legendsize[0], $gheight - 7, 5, 254, 255, 254);
$graph->drawRoundedRectangle(5, 5, 525 + $legendsize[0], $gheight - 5, 5, 230, 230, 230);
$graph->drawGraphArea(254, 254, 254, TRUE);
$graph->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 90, 0, TRUE, 5, false);
$graph->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
$graph->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$graph->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), FALSE);
//$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie4","1","Important point!");
// Finish the graph
$graph->setFontProperties($rootdir . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR . $chartfontfile, $chartfontsize);
$graph->drawLegend(510, 30, $DataSet->GetDataDescription(), 250, 250, 250);
$cache->WriteToCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData(), $graph);
$cachefilename = basename($cache->GetFileFromCache("graph" . $iSurveyID . $language . $iQuestionID, $DataSet->GetData()));
unset($graph);
}
} else {
// this block is to remove the items with value == 0
// and an inelegant way to remove comments from List with Comments questions
$i = 0;
$j = 0;
$labelTmp = array();
while (isset($gdata[$i])) {
$aHelperArray = array_keys($lbl);
if ($gdata[$i] == 0 || $sQuestionType == "O" && substr($aHelperArray[$i], 0, strlen($oLanguage->gT("Comments"))) == $oLanguage->gT("Comments")) {
array_splice($gdata, $i, 1);
} else {
$i++;
$labelTmp = $labelTmp + array_slice($lbl, $j, 1, true);
// Preserve numeric keys for the labels!
}
$j++;
}
$lbl = $labelTmp;
if ($language == 'ar') {
if (!class_exists('I18N_Arabic_Glyphs', false)) {
$Arabic = new I18N_Arabic('Glyphs');
} else {
示例12: 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);
}
示例13: 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();
}
示例14: 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;
}
示例15: 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();
}