本文整理汇总了PHP中pData::setAxisName方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::setAxisName方法的具体用法?PHP pData::setAxisName怎么用?PHP pData::setAxisName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::setAxisName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createGraphe
function createGraphe($vData, $hData, $titre, $vLabel, $hLabel)
{
$MyData = new pData();
/*Je présente ma série de données à utiliser pour le graphique et je détermine le titre de l'axe vertical avec setAxisName*/
$MyData->addPoints($vData, "vertical");
$MyData->setSerieWeight("vertical", 2);
$MyData->setAxisName(0, $vLabel);
/*J'indique les données horizontales du graphique. Il doit y avoir le même nombre que pour ma série de données précédentes (logique)*/
$MyData->addPoints($hData, "horizontal");
$MyData->setSerieDescription("horizontal", $hLabel);
$MyData->setAbscissa("horizontal");
$MyData->setPalette("vertical", array("R" => 255, "G" => 0, "B" => 0));
/* Je crée l'image qui contiendra mon graphique précédemment crée */
$myPicture = new pImage(900, 400, $MyData);
/* Je crée une bordure à mon image */
$myPicture->drawRectangle(0, 0, 899, 399, array("R" => 0, "G" => 0, "B" => 0));
/* J'indique le titre de mon graphique, son positionnement sur l'image et sa police */
$myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(200, 25, $titre, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Je choisi la font de mon graphique */
$myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Je détermine la taille du graphique et son emplacement dans l'image */
$myPicture->setGraphArea(60, 40, 800, 380);
/* Paramètres pour dessiner le graphique à partir des deux abscisses */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "LabelSkip" => 4);
$myPicture->drawScale($scaleSettings);
/* Je dessine mon graphique en fonction des paramètres précédents */
$myPicture->drawAreaChart();
$myPicture->drawLineChart();
/* J'indique le chemin où je souhaite que mon image soit créée */
$myPicture->Render("img/" . $titre . ".png");
}
示例2: grafico
/**
* Gera um gráfico de linha
* @param array $dados Array no formato array('Label' => array(pontos))
* @param string $tipo linha ou barra
*/
function grafico($dados, $tipo = 'linha')
{
require_once 'exemplos/graficos/pChart/class/pDraw.class.php';
require_once 'exemplos/graficos/pChart/class/pImage.class.php';
require_once 'exemplos/graficos/pChart/class/pData.class.php';
// precisamos ter dados para montar os gráficos
$DataSet = new pData();
// Adicionando os pontos de um gráfico de linha
// horas de trabalho na semana
foreach ($dados as $label => $pontos) {
$DataSet->addPoints($pontos, $label);
}
$DataSet->setAxisName(0, 'Horas');
// unidade
$DataSet->setAxisUnit(0, 'h');
$settings = array("R" => 229, "G" => 11, "B" => 11, "Alpha" => 80);
$DataSet->setPalette("Joao", $settings);
// Labels
$DataSet->addPoints(array('Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'), 'Dias');
$DataSet->setSerieDescription('Dias', 'Dias da Semana');
$DataSet->setAbscissa('Dias');
$Graph = new pImage(700, 230, $DataSet);
$Graph->setFontProperties(array('FontName' => 'exemplos/graficos/pChart/fonts/verdana.ttf', 'FontSize' => 8));
$Graph->setGraphArea(50, 40, 670, 190);
$scale = array('GridR' => 150, 'GridG' => 150, 'GridB' => 150, 'DrawSubTicks' => true, 'CycleBackground' => true);
$Graph->drawScale($scale);
if ($tipo == 'linha') {
$Graph->drawLineChart();
} else {
$Graph->drawBarChart();
}
$Graph->drawLegend(540, 25, array('Style' => LEGEND_ROUND, 'Mode' => LEGEND_VERTICAL));
$Graph->drawText(60, 20, "Horas Trabalhadas");
$Graph->autoOutput();
}
示例3: index
function index()
{
$width = 600;
$height = 230;
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(-4, VOID, VOID, 12, 8, 3), "Female");
$MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Male");
//$MyData->addPoints(array(2,0,5,18,19,22),"Probe 3");
$MyData->setSerieTicks("Male", 4);
$MyData->setAxisName(0, "Number of males, females");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width, $height, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
//$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
//$myPicture->setFontProperties(array("FontName"=>pClass."fonts/Silkscreen.ttf","FontSize"=>6));
//$myPicture->drawText(10,13,"drawBarChart() - draw a bar chart",array("R"=>255,"G"=>255,"B"=>255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(250, 55, "Average time to find a set", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Draw the scale and the 1st chart */
$myPicture->setGraphArea(60, 60, 450, 190);
$myPicture->drawFilledRectangle(60, 60, 450, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("DrawSubTicks" => TRUE));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/pf_arma_five.ttf", "FontSize" => 10));
$myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => TRUE, "Surrounding" => 30));
//$myPicture->drawBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Surrounding"=>30));
$myPicture->setShadow(FALSE);
/* Draw the scale and the 2nd chart */
/*
$myPicture->setGraphArea(500,60,670,190);
$myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE));
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->drawBarChart();
$myPicture->setShadow(FALSE);
*/
/* Write the chart legend */
//$myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
$myPicture->drawLegend(500, 105, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
/* Render the picture (choose the best way) */
$myPicture->stroke();
}
示例4: drawBarChart
protected function drawBarChart(ChartDataset $CDs)
{
if (!extension_loaded("gd") && !extension_loaded("gd2")) {
/* Extension not loaded */
// NO BARCHARTS AND ERRORS FOR YOU!
return;
}
/* Create and populate the pData object */
$MyData = new pData();
if (empty($CDs->data)) {
return;
}
//print_r($CDs->data);
foreach ($CDs->data as $points) {
//print_r($points);
$MyData->addPoints($points["points"], $points["label"]);
}
$MyData->setAxisName(0, "Amount Sold");
$MyData->setSerieDescription($points["label"], $points["label"]);
$MyData->setAbscissa($points["label"]);
/* Create the pChart object */
$myPicture = new pImage(1000, 230, $MyData);
// the horrible way to add fonts is just one bunch of fucked up shit, not making sense. bullshit parameters and paths.
//$myPicture->setFontProperties(array("FontName"=>"Bedizen"));
$myPicture->setFontProperties(array("FontName" => "pChart2.1.4//fonts/calibri.ttf", "FontSize" => 11));
//print_r(is_file("C:/xampp_jan2015/htdocs/hackerbar/web/fonts/GeosansLight.ttf"));
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
$myPicture->drawRectangle(0, 0, 999, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
//$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 850, 200);
/* Draw the scale */
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(860, 25, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$settings = array("Surrounding" => -30, "InnerSurrounding" => 30);
$myPicture->drawBarChart($settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("images/barcharts/" . $points["label"] . ".png");
//$myPicture->auto
$myPicture->render("myfile.png");
}
示例5: RenderValueChart
function RenderValueChart(&$debug2)
{
$conditions = [["BETWEEN 1 AND 19"], ["BETWEEN 20 AND 49"], ["BETWEEN 50 AND 99"], ["BETWEEN 100 AND 199"], ["BETWEEN 200 AND 299"], ["BETWEEN 300 AND 499"], ["BETWEEN 500 AND 999"], ["> 999"]];
$label = ["1-19", "20-49", "50-99", "100-199", "200-299", "300-499", "500-999", ">1000"];
coinValueCount($conditions, $array_result);
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($array_result, "Värde (kr)");
$MyData->setAxisName(0, "Antal");
$MyData->addPoints($label, "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the cache object */
$myCache1 = new pCache(array("CacheFolder" => PCHART_PATH . "/class/cache"));
/* Compute the hash linked to the chart data */
$ChartHash1 = $myCache1->getHash($MyData);
/* Test if we got this hash in our cache already */
if ($myCache1->isInCache($ChartHash1)) {
/* If we have it, get the picture from the cache! */
$myCache1->saveFromCache($ChartHash1, WWW_PATH . "/tmp/valuechart.png");
$debug2 = "Old image";
} else {
/* Create the pChart object */
$myPicture = new pImage(700, 400, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = TRUE;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 399, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => PCHART_PATH . "/fonts/Forgotte.ttf", "FontSize" => 15, "R" => 80, "G" => 80, "B" => 80));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 350);
/* Draw the scale */
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_START0);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(340, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$settings = array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "DisplayR" => 255, "DisplayG" => 255, "DisplayB" => 255, "DisplayShadow" => TRUE, "Surrounding" => 10);
$myPicture->drawBarChart();
/* Push the rendered picture to the cache */
$myCache1->writeToCache($ChartHash1, $myPicture);
/* Render the picture (choose the best way) */
$myPicture->Render(WWW_PATH . "/tmp/valuechart.png");
$debug2 = "Picture rendered";
}
}
示例6: drawBarChart
/**
* Desenha um gráfico de barras
* @param $title título do graico
* @param $data matriz contendo as séries de dados
* @param $xlabels vetor contendo os rótulos do eixo X
* @param $ylabel rótulo do eixo Y
* @param $width largura do gráfico
* @param $height altura do gráfico
* @param $outputPath caminho de saída do gráfico
*/
public function drawBarChart($title, $data, $xlabels, $ylabel, $width, $height, $outputPath)
{
// cria o modelo de dados
$modelo = new pData();
foreach ($data as $legend => $serie) {
$newdata = array();
foreach ($serie as $value) {
$newdata[$legend][] = $value == NULL ? VOID : $value;
}
$modelo->addPoints($newdata[$legend], $legend);
}
$modelo->setAxisName(0, $ylabel);
$modelo->addPoints($xlabels, "Labels");
$modelo->setAbscissa("Labels");
// cria o objeto que irá conter a imagem do gráfico
$imagem = new pImage($width, $height, $modelo);
// desliga a suavização de linhas
$imagem->Antialias = FALSE;
// adiciona uma borda na forma de um retângulo dentro da imagem
$imagem->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
// escreve um título dentro do gráfico
$imagem->setFontProperties(array("FontName" => "app/lib/pchart/fonts/Forgotte.ttf", "FontSize" => 11));
$imagem->drawText(60, 35, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
// define a fonte dos dados do gráfico
$imagem->setFontProperties(array("FontName" => "app/lib/pchart/fonts/pf_arma_five.ttf", "FontSize" => 6));
// define a área do gráfico
$imagem->setGraphArea(60, 40, $width - 50, $height - 30);
// define a escala do gráfico
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "CycleBackground" => TRUE);
$imagem->drawScale($scaleSettings);
// desenha a legenda do gráfico
$imagem->drawLegend(60, $height - 13, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
// cria uma sombra nas barras do gráfico
$imagem->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
// desenha o gráfico de barras
$imagem->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Surrounding" => 200));
// grava o gráfico em um arquivo
$imagem->render($outputPath);
}
示例7: pData
// print_r($csvdata_point);
// echo "</pre>\r\n";
// // // -----------------
//=============================================================================================
// $MyData = new pData();
// for($i=0;$i<=30;$i++) { $MyData->addPoints(rand(1,15),"Probe 1"); }
// $MyData->setSerieTicks("Probe 2",4);
// $MyData->setAxisName(0,"Temperatures");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($csvdata_values, "Temperature");
$MyData->addPoints($csvdata_point, "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setSerieTicks("Probe 1", 4);
$MyData->setAxisName(0, "Spanung in [mV]");
/* Create the pChart object */
$myPicture = new pImage(800, 400, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
//$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100));
//$myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 799, 399, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "libs/pChart2.1.4/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Spannungsverlauf seit Ladung", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "libs/pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
示例8: array
$sth = $db->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$sth->execute(array(':consult_date' => $consult_date . "%"));
$datas = $sth->fetchAll();
}
if (count($datas) > 0) {
$room_value = array();
$room_name = array();
$nbr_room = count($datas);
foreach ($datas as $data) {
$room_value[] = $data['room_usable_power'] - $data['room_used_power'];
$room_name[] = $data['room_name'];
}
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($room_value, "Capacite electrique disponible (kW)");
$MyData->setAxisName(0, "Capacite electrique disponible (kW)");
$MyData->addPoints($room_name, "Salles");
$MyData->setAbscissa("Salles");
/* Create the pChart object */
$myPicture = new pImage(65 * $nbr_room + 65, 330, $MyData);
// Taille dynamique de l'image en fonction du nombre de réponse SQL
/* Draw the background */
$Settings = array("R" => 39, "G" => 43, "B" => 48, "Dash" => 1, "DashR" => 122, "DashG" => 130, "DashB" => 136);
$myPicture->drawFilledRectangle(0, 0, 65 * $nbr_room + 65, 330, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 39, "StartG" => 43, "StartB" => 48, "EndR" => 122, "EndG" => 130, "EndB" => 136, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 65 * $nbr_room + 65, 330, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 65 * $nbr_room + 65, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 65 * $nbr_room + 64, 329, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
示例9: buildTripChartData
protected function buildTripChartData($options)
{
$data = parent::buildTripChartData($options);
if (!$data) {
return $data;
}
$this->setOption('title', $data['title']);
$myData = new pData();
// x-axis
$x_id = $data['x']['id'];
$myData->addPoints($data['x']['values'], $x_id);
$myData->setSerieDescription($x_id, $data['x']['description']);
$myData->setAbscissa($x_id);
// Y-axis
$myData->setAxisName(0, $data['y']['description']);
foreach ($data['y']['series'] as $key => $serie) {
$values = $this->filterNulls($serie['values']);
if (!$values) {
continue;
}
$y_id = $serie['id'];
$myData->addPoints($values, $y_id);
$myData->setSerieDescription($y_id, $serie['label']);
}
return $myData;
}
示例10: pData
<?php
/* CAT:Stacked chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(4, VOID, VOID, 12, 8, 3), "Frontend #1");
$MyData->addPoints(array(3, 12, 15, 8, 5, 5), "Frontend #2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Frontend #3");
$MyData->setAxisName(0, "Average Usage");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 680, 190);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("Surrounding" => -15, "InnerSurrounding" => 15));
/* Write a label */
$myPicture->writeLabel(array("Frontend #1", "Frontend #2", "Frontend #3"), 1, array("DrawVerticalLine" => TRUE));
/* Write the chart legend */
$myPicture->drawLegend(480, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
示例11: array
function func_bargraphGenerate($student_id, $time, $type, $basepath, $success, $r = "", $g = "", $b = "", $name)
{
$bookIdResult = $this->func_getBookId('1,2');
$bookID = array();
foreach ($bookIdResult as $book) {
$bookID[] = $book['book_id'];
}
$getActivityTypeIdResult = $this->func_getActivityTypeId('WORD HUNT');
foreach ($getActivityTypeIdResult as $activityTypeId) {
$activityTypeId = $activityTypeId['activity_type_id'];
}
$getActivityIdResult = $this->func_getActivityId($bookID, $activityTypeId);
$actId = array();
foreach ($getActivityIdResult as $activityId) {
$actId[] = $activityId['activity_id'];
}
$actNewId = implode(',', $actId);
$k = 0;
$j = 0;
for ($i = 0; $i < 5; $i = $i + 1) {
$date[$k] = date("Y-m-d", strtotime("-{$i} day"));
$dateRec[] = date('M d', strtotime("-{$i} day"));
$k = $k + 1;
}
$successaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", $success);
$totalaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", '0,1');
for ($i = 0; $i < 5; $i = $i + 1) {
$j = $i;
if ($totalaccessmentResult['0']['count_' . $j] == "0") {
$totalaccessmentResult['0']['count_' . $j] = 1;
}
$per[$i] = $successaccessmentResult['0']['count_' . $j] / $totalaccessmentResult['0']['count_' . $j] * 100;
}
$MyData = new pData();
$MyData->addPoints($per, "Server A");
$MyData->setAxisName(0, "Percentage");
$MyData->addPoints(array_reverse($dateRec), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
$myPicture = new pImage(350, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawGradientArea(0, 0, 400, 230, DIRECTION_VERTICAL, array("StartR" => 255, "StartG" => 255, "StartB" => 255, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
// $myPicture->drawRectangle(0,0,400,229,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => $basepath . "Silkscreen.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 350, 200);
/* Draw the scale */
$scaleSettings = array("GridR" => 300, "GridG" => 300, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => FALSE, "Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_MANUAL, "LabelingMethod" => LABELING_ALL);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$settings = array("Surrounding" => -30, "InnerSurrounding" => 30, "Mode" => 0);
$myPicture->drawBarChart($settings, $r, $g, $b);
/* Render the picture (choose the best way) */
$picname = $student_id . '_' . $name . '_' . $time . '.png';
$this->fun_getImageLog($student_id, $picname, $type, $time, $name);
$myPicture->render("uploads/graph/" . $picname);
}
示例12: pData
<?php
/* CAT:Misc */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
for ($i = 0; $i <= 10; $i = $i + 0.2) {
$MyData->addPoints(log($i + 1) * 10, "Bounds 1");
$MyData->addPoints(log($i + 3) * 10 + rand(0, 2) - 1, "Probe 1");
$MyData->addPoints(log($i + 6) * 10, "Bounds 2");
$MyData->addPoints($i * 10, "Labels");
}
$MyData->setAxisName(0, "Size (cm)");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setAbscissaName("Time (years)");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background and the border */
$myPicture->drawFilledRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 100, "EndG" => 100, "EndB" => 100, "Alpha" => 30));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Size by time generations", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
示例13: pData
<?php
/* CAT:Scaling */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(1700, 2500, 7800, 4500, 3150), "Distance");
$MyData->setAxisName(0, "Maximum distance");
$MyData->setAxisUnit(0, "m");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
/* Create the abscissa serie */
$MyData->addPoints(array(1230768000, 1233446400, 1235865600, 1238544000, 1241136000, 1243814400), "Timestamp");
$MyData->setSerieDescription("Timestamp", "Sampled Dates");
$MyData->setAbscissa("Timestamp");
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE);
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
示例14: pData
<?php
/* CAT:Misc */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(2, 7, 5, 18, 19, 22, 23, 25, 22, 12, 10, 10), "DEFCA");
$MyData->setAxisName(0, "\$ Incomes");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY);
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA", array("R" => 55, "G" => 91, "B" => 127));
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(60, 35, "2k9 Average Incomes", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60, 40, 670, 190);
$myPicture->drawFilledRectangle(60, 40, 670, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("GridR" => 180, "GridG" => 180, "GridB" => 180));
/* Draw a spline chart on top */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawFilledSplineChart();
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
示例15: pData
/* CAT:Scatter chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
include "../class/pScatter.class.php";
/* Create the pData object */
$myData = new pData();
/* Create the X axis and the binded series */
for ($i = 0; $i <= 360; $i = $i + 10) {
$myData->addPoints(cos(deg2rad($i)) * 20, "Probe 1");
}
for ($i = 0; $i <= 360; $i = $i + 10) {
$myData->addPoints(sin(deg2rad($i)) * 20, "Probe 2");
}
$myData->setAxisName(0, "Index");
$myData->setAxisXY(0, AXIS_X);
$myData->setAxisPosition(0, AXIS_POSITION_BOTTOM);
/* Create the Y axis and the binded series */
for ($i = 0; $i <= 360; $i = $i + 10) {
$myData->addPoints($i, "Probe 3");
}
$myData->setSerieOnAxis("Probe 3", 1);
$myData->setAxisName(1, "Degree");
$myData->setAxisXY(1, AXIS_Y);
$myData->setAxisUnit(1, "°");
$myData->setAxisPosition(1, AXIS_POSITION_RIGHT);
/* Create the 1st scatter chart binding */
$myData->setScatterSerie("Probe 1", "Probe 3", 0);
$myData->setScatterSerieDescription(0, "This year");
$myData->setScatterSerieColor(0, array("R" => 0, "G" => 0, "B" => 0));
开发者ID:josepabloapu,项目名称:statistical-analysis-tools-lamp,代码行数:31,代码来源:example.drawScatterPlotChart.php