本文整理汇总了PHP中pData::SetAbsciseLabelSerie方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::SetAbsciseLabelSerie方法的具体用法?PHP pData::SetAbsciseLabelSerie怎么用?PHP pData::SetAbsciseLabelSerie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::SetAbsciseLabelSerie方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeData
function writeData($data, $graph)
{
if ($data != "") {
echo "Plottong " . $graph . "\n";
$dataset1 = array();
$dataset2 = array();
foreach ($data as $key => $value) {
array_push($dataset1, $key);
array_push($dataset2, $value);
}
$DataSet = new pData();
$DataSet->AddPoint($dataset2, "Serie1");
$DataSet->AddPoint($dataset1, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$Test = new pChart(380, 200);
$Test->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, TRUE, TRUE, 50, 20, 5);
$Test->drawPieLegend(310, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("{$graph}-pie.png");
}
}
示例2: draw
/**
* Рисует график по переданным данным
*
* @param array $points
* @return string путь к файлу графика
*/
private function draw(array $points)
{
$errLevel = error_reporting();
error_reporting(0);
$newsList = $this->dataProvider->getNewsList();
$classLoader = new CPChart();
$DataSet = new pData();
foreach ($points as $news_id => $set) {
$DataSet->AddPoint($set, "news" . $news_id);
$DataSet->SetSerieName($newsList[$news_id], "news" . $news_id);
}
$DataSet->AddAllSeries();
$DataSet->AddPoint(array_values($this->dataProvider->getDates()), "dates");
$DataSet->SetAbsciseLabelSerie('dates');
// Initialise the graph
$chart = new pChart(700, 250);
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 7);
$chart->setGraphArea(60, 30, 570, 200);
$chart->drawFilledRoundedRectangle(7, 7, 693, 253, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 695, 255, 5, 230, 230, 230);
$chart->drawGraphArea(255, 255, 255, true);
$data = $DataSet->GetData();
if (!empty($data)) {
$chart->drawScale($data, $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2, true, 3);
$chart->drawGrid(4, true, 230, 230, 230, 50);
$chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 8);
$chart->drawLegend(590, 20, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Restore reporting level
error_reporting($errLevel);
return $this->render($chart, $points);
}
示例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: 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");
}
示例5: 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;
}
示例6: setArrXAxisTickLabels
/**
* Set the labels to be used for the x-axis
*
* @param array $arrXAxisTickLabels array of string to be used as labels
* @param int $intNrOfWrittenLabels the amount of x-axis labels to be printed
*/
public function setArrXAxisTickLabels($arrXAxisTickLabels, $intNrOfWrittenLabels = 12)
{
$strSerieName = generateSystemid();
if (count($arrXAxisTickLabels) > $intNrOfWrittenLabels) {
//not more than 12 labels
$intCounter = ceil(count($arrXAxisTickLabels) / $intNrOfWrittenLabels);
$arrMadeUpLabels = array();
$intKeyCount = 0;
foreach ($arrXAxisTickLabels as $strOneLabel) {
if (++$intKeyCount % $intCounter == 1) {
$arrMadeUpLabels[] = $strOneLabel;
} else {
$arrMadeUpLabels[] = "";
}
}
} else {
$arrMadeUpLabels = $arrXAxisTickLabels;
}
$this->objDataset->AddPoint($arrMadeUpLabels, $strSerieName);
$this->objDataset->SetAbsciseLabelSerie($strSerieName);
if ($this->bitAdditionalDatasetAdded) {
$this->objAdditionalDataset->AddPoint($arrMadeUpLabels, $strSerieName);
$this->objAdditionalDataset->SetAbsciseLabelSerie($strSerieName);
}
}
示例7: 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;
}
示例8: _prepareSerie
/**
* Prepare specific serie for the chart
* @access private
*/
private function _prepareSerie()
{
$this->data->AddAllSeries();
if ($this->label) {
$this->data->SetAbsciseLabelSerie($this->label);
} else {
$this->data->SetAbsciseLabelSerie();
}
}
示例9: index
function index()
{
$this->load->model('charge_model');
$revenue = $this->charge_model->GetRevenueByDay($this->user->Get('client_id'));
$data = array();
if ($this->config->item('show_dashboard_chart') !== 'no' and !empty($revenue) and count($revenue) > 1) {
$series = array();
foreach ($revenue as $day) {
$series[] = $day['revenue'];
$series2[] = date("M j", strtotime($day['day']));
}
include APPPATH . 'libraries/pchart/pData.class';
include APPPATH . 'libraries/pchart/pChart.class';
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($series, "Revenue");
$DataSet->AddPoint($series2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->RemoveSerie("Serie2");
$DataSet->SetXAxisName('Date');
$DataSet->SetYAxisName('Revenue');
//$DataSet->SetXAxisFormat('date');
// Initialise the graph
$Test = new pChart(1000, 260);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
$Test->setGraphArea(90, 30, 960, 200);
$Test->drawGraphArea(252, 252, 252);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 255);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 8);
$Test->drawLegend(45, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
//$Test->drawTitle(60,22,"Last 30 Days",50,50,50,585);
$Test->Render(BASEPATH . '../writeable/rev_chart_' . $this->user->Get('client_id') . '.png');
} else {
$data['no_chart'] = 'true';
}
// get log
$this->load->model('log_model');
$log = $this->log_model->GetClientLog($this->user->Get('client_id'));
$data['log'] = $log;
$this->load->view(branded_view('cp/dashboard'), $data);
}
示例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: generateGraph
/**
* Create graph (a .png file)
*
* @param string $file
*/
public function generateGraph($file)
{
$patientValues = Storage::getInstance()->getPatientsData($file);
/*
* pGraph work
*/
$dataSet = new pData();
if (!empty($patientValues)) {
$dataSet->AddPoint(array_keys($patientValues[$file]), 'label');
$dataSet->SetAbsciseLabelSerie('label');
$serie1 = array_values($patientValues[$file]);
$average = round(array_sum($serie1) / count($serie1), 2);
$dataSet->AddPoint($serie1, "Serie1");
$dataSet->AddSerie("Serie1");
// Initialise the graph
$graph = new MyHorBar(450, 600);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 8);
$graph->setGraphArea(120, 60, 410, 550);
$graph->drawFilledRoundedRectangle(7, 7, 443, 593, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 595, 5, 230, 230, 230);
$graph->drawGraphArea(255, 255, 255, true);
$graph->drawHorScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, true, 0, 2, true);
$graph->drawHorGrid(10, true, 230, 230, 230, 50);
// Draw the 0 line
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 6);
$graph->drawTreshold($average, 143, 55, 72, true, false, 2, null, 90);
// Draw the bar graph
$graph->drawHorBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), false);
// Finish the graph
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawLegend(15, 15, $dataSet->GetDataDescription(), 255, 255, 255);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
} else {
$graph = new pChart(450, 150);
$graph->setGraphArea(120, 60, 410, 100);
$graph->drawFilledRoundedRectangle(7, 7, 443, 143, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 145, 5, 230, 230, 230);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 36);
$graph->drawTitle(125, 90, 'No data!', 245, 50, 50, -1);
}
$graph->Render(WWW_DIR . '/images/graphs/' . $file . '.png');
}
示例12: 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;
}
示例13: createClosuresGraph
private function createClosuresGraph($queries)
{
$qb = new QueryBrowser();
$imagehashes = array();
foreach ($queries as $q) {
$DataSet = new pData();
$qResult = $qb->executeQueryToArray($q['query']);
if (sizeof($qResult) > 0) {
foreach ($qResult as $row) {
$DataSet->AddPoint($row['y'], $q['series'], $row['x']);
}
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$chartname = $this->createPathFromHash(md5(serialize($DataSet)));
$imagehashes[] = array($chartname, $q['series']);
if (!file_exists($chartname)) {
$Test = new pChart(700, 280);
$Test->setFontProperties("graph/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 273, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 275, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, true);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2);
$Test->drawGrid(4, true, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("graph/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("graph/Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, $q['series'], 50, 50, 50, 585);
$Test->Render("render/" . $chartname);
}
}
}
return $imagehashes;
}
示例14: explode
<?php
include "./includes/pdata.php";
include "./includes/pchart.php";
if (!isset($_GET['cc']) || !isset($_GET['cn'])) {
exit;
}
$cc = explode(",", $_GET['cc']);
$cn = explode(",", $_GET['cn']);
$data = new pData();
$data->AddPoint($cn, "Serie1");
$data->AddPoint($cc, "Serie2");
$data->AddAllSeries();
$data->SetAbsciseLabelSerie("Serie2");
$chart = new pChart(350, 180);
$chart->createColorGradientPalette(235, 72, 225, 6, 199, 244, 5);
$chart->setFontProperties("includes/tahoma.dat", 8);
$chart->AntialiasQuality = 0;
$chart->drawPieGraph($data->GetData(), $data->GetDataDescription(), 150, 90, 90, PIE_PERCENTAGE_LABEL, FALSE, 35, 15, 5);
$chart->drawPieLegend(300, 20, $data->GetData(), $data->GetDataDescription(), 255, 255, 255);
$chart->Stroke();
示例15: array
/**
* Generates a big graph with the number of best results
* @param array
*/
static function generate_exercise_result_graph($attempts)
{
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';
$exercise_title = strip_tags($attempts['title']);
$attempts = $attempts['data'];
$my_exercise_result_array = $exercise_result = array();
if (empty($attempts)) {
return null;
}
foreach ($attempts as $attempt) {
if (api_get_user_id() == $attempt['exe_user_id']) {
if ($attempt['exe_weighting'] != 0 ) {
$my_exercise_result_array[]= $attempt['exe_result']/$attempt['exe_weighting'];
}
} else {
if ($attempt['exe_weighting'] != 0 ) {
$exercise_result[]= $attempt['exe_result']/$attempt['exe_weighting'];
}
}
}
//Getting best result
rsort($my_exercise_result_array);
$my_exercise_result = 0;
if (isset($my_exercise_result_array[0])) {
$my_exercise_result = $my_exercise_result_array[0] *100;
}
$max = 100;
$pieces = 5 ;
$part = round($max / $pieces);
$x_axis = array();
$final_array = array();
$my_final_array = array();
for ($i=1; $i <=$pieces; $i++) {
$sum = 1;
if ($i == 1) {
$sum = 0;
}
$min = ($i-1)*$part + $sum;
$max = ($i)*$part;
$x_axis[]= $min." - ".$max;
$count = 0;
foreach($exercise_result as $result) {
$percentage = $result*100;
//echo $percentage.' - '.$min.' - '.$max."<br />";
if ($percentage >= $min && $percentage <= $max) {
//echo ' is > ';
$count++;
}
}
//echo '<br />';
$final_array[]= $count;
if ($my_exercise_result >= $min && $my_exercise_result <= $max) {
$my_final_array[] = 1;
} else {
$my_final_array[] = 0;
}
}
//Fix to remove the data of the user with my data
for($i = 0; $i<=count($my_final_array); $i++) {
if (!empty($my_final_array[$i])) {
$my_final_array[$i] = $final_array[$i] + 1; //Add my result
$final_array[$i] = 0;
}
}
$cache = new pCache();
// Dataset definition
$data_set = new pData();
$data_set->AddPoint($final_array,"Serie1");
$data_set->AddPoint($my_final_array,"Serie2");
$data_set->AddPoint($x_axis,"Serie3");
$data_set->AddAllSeries();
$data_set->SetAbsciseLabelSerie('Serie3');
$data_set->SetSerieName(get_lang('Score'),"Serie1");
$data_set->SetSerieName(get_lang('MyResults'),"Serie2");
$data_set->SetXAxisName(get_lang("Score"));
// Initialise the graph
$main_width = 500;
$main_height = 250;
$main_graph = new pChart($main_width,$main_height);
$main_graph->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf',8);
//.........这里部分代码省略.........