本文整理汇总了PHP中pData::setSerieDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::setSerieDescription方法的具体用法?PHP pData::setSerieDescription怎么用?PHP pData::setSerieDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::setSerieDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listadoPersonasXedadCreateChart
/**
* Creates a Chart Image with the count(Year(fecha_nacimiento))
*
* @param DomDocument $qResult The query result
*
* @return string with the binary stream of a png picture.
* @see listadoPersonasXedad()
*/
public static function listadoPersonasXedadCreateChart(DomDocument $qResult)
{
// Todo: add chart to /result/chart
$xPath = new DOMXPath($qResult);
$countedNodes = $xPath->query('/result/Persona_Collection/Persona/counted/text()');
$count = array();
foreach ($countedNodes as $node) {
$count[] = $node->nodeValue;
}
$fechaNodes = $xPath->query('/result/Persona_Collection/Persona/years/text()');
$years = array();
foreach ($fechaNodes as $node) {
$years[] = $node->nodeValue;
}
/* Create and populate the pData object */
$myData = new pData();
$myData->addPoints($count, "Years");
$myData->setSerieDescription("Years", "Año de Nacimiento de las personas");
/* Define the absissa serie */
$myData->addPoints($years, "Labels");
$myData->setAbscissa("Labels");
$myPicture = self::listadoPersonasXedadConfigChart($myData);
/* Create the pPie object */
$pieChart = new pPie($myPicture, $myData);
/* Draw AA pie chart */
$pieChart->draw2DPie(200, 100, array("Border" => TRUE));
/* Write a legend box under the 1st chart */
$pieChart->drawPieLegend(90, 176, array("Style" => LEGEND_BOX, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$fname = PathsUtils::createChartFileName();
$myPicture->render($fname);
$picFile = file_get_contents($fname);
return $picFile;
}
示例2: 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");
}
示例3: 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();
}
示例4: index
function index()
{
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(getGenders($this->db), "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints(array("Female", "Male"), "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(240, 180, $MyData, TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a splitted pie chart */
$PieChart->draw3DPie(120, 90, array("Radius" => 100, "DataGapAngle" => 12, "DataGapRadius" => 10, "Border" => TRUE));
/* Write the legend box */
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/Silkscreen.ttf", "FontSize" => 6, "R" => 0, "G" => 0, "B" => 0));
$PieChart->drawPieLegend(140, 160, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->stroke();
//$myPicture->autoOutput("pictures/example.draw3DPie.transparent.png");
}
示例5: 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();
}
示例6: 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");
}
示例7: 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";
}
}
示例8: drawCompetencyExpertsRadar
public function drawCompetencyExpertsRadar($img, $points, $competences, $roles, $skale, $palettes)
{
$MyData = new \pData();
/*$palettes = array(
array("R"=>84,"G"=>85,"B"=>86),
array("R"=>21,"G"=>101,"B"=>112),
array("R"=>223,"G"=>72,"B"=>11),
array("R"=>10,"G"=>120,"B"=>40),
array("R"=>200,"G"=>150,"B"=>20),
);*/
/*$palettes = array(
0 => array('R' => 191, 'G' => 191, 'B' => 191),
1 => array('R' => 226, 'G' => 24, 'B' => 54),
2 => array('R' => 244, 'G' => 122, 'B' => 32),
3 => array('R' => 146, 'G' => 0, 'B' => 61),
4 => array('R' => 91, 'G' => 74, 'B' => 63),
5 => array('R' => 55, 'G' => 96, 'B' => 146),
6 => array('R' => 119, 'G' => 147, 'B' => 60),
);*/
$i = 0;
foreach ($points as $roleID => $data) {
$MyData->addPoints($data, "Score" . $roleID);
$MyData->setSerieDescription("Score" . $roleID, $roles[$roleID]['name']);
$MyData->setPalette("Score" . $roleID, $palettes[$i++]);
}
$labels = array();
foreach ($competences as $competency) {
$labels[] = strpos($competency, ' ') !== false ? $this->divideString($competency) : $competency;
}
$MyData->addPoints($labels, "Labels");
$MyData->setAbscissa("Labels");
$myPicture = new \pImage(460 * 1.53, 330 * 1.53, $MyData);
$myPicture->setFontProperties(array("FontName" => dirname(__FILE__) . '/fonts/calibri.ttf', "FontSize" => round(7 * 1.53), "R" => 80, "G" => 80, "B" => 80));
/* Create the pRadar object */
$SplitChart = new \pRadar();
/* Draw a radar chart */
$myPicture->setGraphArea(70 * 1.53, 30 * 1.53, 340 * 1.53, 300 * 1.53);
$Options = array("Layout" => RADAR_LAYOUT_STAR, 'SegmentHeight' => ceil($skale['max'] / 4), "FontName" => dirname(__FILE__) . '/fonts/calibri.ttf', "FontSize" => round(7 * 1.53), 'LabelPos' => RADAR_LABELS_HORIZONTAL, 'LineWidth' => 3);
$SplitChart->drawRadar($myPicture, $MyData, $Options);
$myPicture->render($img);
}
示例9: PlotPie
function PlotPie($rowA, $rowB, $name, $cch)
{
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pData.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pDraw.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pImage.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pPie.class.php";
$MyData = new pData();
$MyData->addPoints($rowA, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($rowB, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 630, $MyData);
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 252, "G" => 252, "B" => 252, "DrawBox" => 1, "BoxAlpha" => 30);
//$myPicture->drawText(350,25,$name,$TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 50, 675, 690);
//$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
//$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Draw an AA pie chart */
if ($cch == 11) {
$PieChart->draw2DPie(160, 140, array("DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
}
if ($cch == 12) {
$PieChart->draw2DRing(160, 140, array("WriteValues" => TRUE, "ValueR" => 255, "ValueG" => 255, "ValueB" => 255, "Border" => TRUE));
}
if ($cch == 13) {
$PieChart->draw3DPie(160, 140, array("Radius" => 70, "DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
}
/* Write the legend box */
$myPicture->setShadow(FALSE);
$PieChart->drawPieLegend(15, 40, array("Alpha" => 20));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.draw2DPie.labels.png");
}
示例10: ring2d
function ring2d($x, $y, $name)
{
$MyData = new pData();
$MyData->addPoints($x, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($y, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(500, 250, $MyData);
/* Draw a solid background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 500, 500, $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, 500, 500, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 500, 30, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 500, 250, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "mod/pchart/fonts/verdana.ttf", "FontSize" => 12));
$myPicture->drawText(15, 20, $name, array("R" => 255, "G" => 255, "B" => 255));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "mod/pchart/fonts/verdana.ttf", "FontSize" => 12, "R" => 80, "G" => 80, "B" => 80));
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 50));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Draw an AA pie chart */
$PieChart->draw2DRing(390, 140, array("WriteValues" => TRUE, "ValueR" => 255, "ValueG" => 255, "ValueB" => 255, "Border" => TRUE));
/* Write the legend box */
$myPicture->setShadow(FALSE);
$PieChart->drawPieLegend(10, 50, array("Alpha" => 20));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("2dring.png");
}
示例11: array
if ($p_template != "default") {
$myData->loadPalette("palettes/" . $p_template . ".color", TRUE);
}
$conn = mysqli_connect($servername, $username, $password, $dbname);
$series[] = array();
foreach ($asignaturas as $key => $value) {
$sql = "SELECT Nota FROM notas" . $cursoActivo . " WHERE N_Id_Escolar = {$alumnof} \n AND id_asignatura = '{$value}';";
$result = mysqli_query($conn, $sql) or die("Error en el sql");
$series[$value] = array();
while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
$series[$value][] = $row[0];
}
}
foreach ($series as $key => $value) {
$myData->addPoints($value, $key);
$myData->setSerieDescription($key, $key);
$myData->setSerieOnAxis($key, 0);
}
//$myData->addPoints(array(28,-19,18,4,-2,-31,17,48),"Serie1");
//$myData->setSerieDescription("Serie1","Serie 1");
//$myData->setSerieOnAxis("Serie1",0);
//
//$myData->addPoints(array(-37,37,-38,16,-4,39,29,6),"Serie2");
//$myData->setSerieDescription("Serie2","Serie 2");
//$myData->setSerieOnAxis("Serie2",0);
//
//$myData->addPoints(array(16,46,-32,35,32,-15,40,29),"Serie3");
//$myData->setSerieDescription("Serie3","Serie 3");
//$myData->setSerieOnAxis("Serie3",0);
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
$myData->setAxisName(0, "Notas");
示例12: pData
$string_perfor = $string_perfor . "<div>Assez Bien <img src=\"graphix/level2.png\" height=\"40\" width=\"40\"></div>";
} else {
if ($perfor >= 0.6 and $perfor < 0.8) {
$string_perfor = $string_perfor . "<div>Bien <img src=\"graphix/level3.png\" height=\"40\" width=\"40\"></div>";
} else {
$string_perfor = $string_perfor . "<div>Excellent <img src=\"graphix/level4.png\" height=\"40\" width=\"40\"></div>";
}
}
}
}
//preparation radar chart graph
/* Prepare some nice data & axis config */
$MyData = new pData();
$MyData->addPoints($tabMoyenne, "ScoreA");
$MyData->addPoints($tabNote, "ScoreB");
$MyData->setSerieDescription("ScoreA", "Moyenne classe");
$MyData->setSerieDescription("ScoreB", "Notes étudiant");
$MyData->setPalette("ScoreB", array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 100));
$MyData->setPalette("ScoreA", array("R" => 224, "G" => 100, "B" => 46, "Alpha" => 100));
/* Create the X serie */
$MyData->addPoints($tabModule, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1000, 460, $MyData);
/* Draw a solid background */
$Settings = array("R" => 255, "G" => 255, "B" => 255, "Dash" => 1, "DashR" => 255, "DashG" => 255, "DashB" => 255);
$myPicture->drawFilledRectangle(0, 0, 1000, 460, $Settings);
/* Overlay some gradient areas */
$Settings = array("StartR" => 255, "StartG" => 255, "StartB" => 255, "EndR" => 240, "EndG" => 255, "EndB" => 247, "Alpha" => 90);
$myPicture->drawGradientArea(0, 0, 1000, 460, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 1000, 20, DIRECTION_VERTICAL, array("StartR" => 255, "StartG" => 99, "StartB" => 71, "EndR" => 124, "EndG" => 122, "EndB" => 122, "Alpha" => 100));
示例13: 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;
}
示例14: pData
$LegendFontSize = 6;
}
if (isset($_GET['legendstyle'])) {
$LegendStyle = $_GET['legendstyle'];
} else {
$LegendStyle = "LEGEND_NOBORDER";
}
if (isset($_GET['LegendMode'])) {
$LegendMode = $_GET['LegendMode'];
} else {
$LegendMode = "LEGEND_HORIZONTAL";
}
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($Score, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($Labels, "Labels");
$MyData->setAbscissa("Labels");
$MyData->loadPalette('../palettes/MADmin.color', TRUE);
/* Create the pChart object */
$myPicture = new pImage($ImageSize[0], $ImageSize[1], $MyData, TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/" . $Font . ".ttf", "FontSize" => $FontSize, "R" => $FontR, "G" => $FontG, "B" => $FontB));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a splitted pie chart */
$PieChart->draw3DPie($ChartSize[0], $ChartSize[1], array("Radius" => $Radius, "DataGapAngle" => $DataGapAngle, "DataGapRadius" => $DataGapRadius, "Border" => TRUE));
/* Write the legend box */
示例15: min
if ($plotShape >= 0 and $plotShape < count($plotShapes)) {
$myData->setSerieShape($field, $plotShapes[$plotShape]);
} else {
$myData->setSerieShape($field, $plotShapes[array_rand($plotShapes, 1)]);
}
if (isset($palette)) {
$myData->setPalette($field, $palette['serie'][($nSerie - 1) % $palette['serie_num']]);
}
if ($nSerie == 0) {
$abscissa = $field;
$myData->setAbscissa($abscissa);
} else {
if (isset($chart_cols2) and in_array($idx, $chart_cols2)) {
$arrSeriesY2[] = $field;
$myData->setSerieOnAxis($field, 1);
$myData->setSerieDescription($field, "右){$field}");
}
}
$nSerie += 1;
}
}
if (isset($arrSeriesY2)) {
$myData->setAxisPosition(1, AXIS_POSITION_RIGHT);
}
$myData->setAxisUnit(0, $unitY);
/* Write the chart legend */
$sizeLegend = $myPicture->getLegendSize(array("Mode" => LEGEND_VERTICAL));
$widthLegend = min($sizeLegend['Width'], max(120, $width * 0.25));
if ($legend > 0) {
$myPicture->setFontProperties(array("FontName" => "./fonts/simsun.ttc", "FontSize" => $font, "R" => 0, "G" => 0, "B" => 0));
$myPicture->drawLegend($width - 5 - $widthLegend, 5 + $font_t * 3, array("Style" => LEGEND_BOX, "Mode" => LEGEND_VERTICAL, "Alpha" => 10, "Margin" => 4, "R" => 255, "G" => 255, "B" => 255));