本文整理汇总了PHP中pData::setPalette方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::setPalette方法的具体用法?PHP pData::setPalette怎么用?PHP pData::setPalette使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::setPalette方法的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: renderChart
function renderChart($chartType, $title, $prepData, $legend)
{
$width = 800;
$height = 500;
$titleHeight = 20;
/*
* Create a dataset we can use
*/
$dataSet = array_values($prepData);
$imgData = new pData();
if ($chartType == "bar") {
$imgData->addPoints($dataSet, "data");
$imgData->addPoints($legend, "legend");
$imgData->setAbscissa("legend");
$imgData->setPalette("data", array("R" => 0, "G" => 108, "B" => 171, "Alpha" => 100));
$img = new pImage($width, $height, $imgData);
$img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
$img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
$img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
$img->setFontProperties(array("R" => 255, "G" => 255, "B" => 255, "FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
$img->setGraphArea(60, $titleHeight + 20, $width - 50, $height - 30);
$img->drawScale(array("GridR" => 200, "GridG" => 200, "GridB" => 200, "Mode" => SCALE_MODE_START0));
$img->drawBarChart(array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Surrounding" => 10));
} elseif ($chartType == "3Dpie") {
$imgData->addPoints($dataSet, "data");
$imgData->addPoints($legend, "legend");
$imgData->setAbscissa("legend");
$img = new pImage($width, $height, $imgData, TRUE);
$PieChart = new pPie($img, $imgData);
$img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
$img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
$img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
$PieChart->setSliceColor(0, array("R" => 0, "G" => 108, "B" => 171));
$PieChart->setSliceColor(1, array("R" => 205, "G" => 159, "B" => 0));
$PieChart->setSliceColor(2, array("R" => 0, "G" => 171, "B" => 0));
$PieChart->setSliceColor(3, array("R" => 171, "G" => 28, "B" => 0));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
$PieChart->draw3DPie($width / 2, $height / 2 + $titleHeight, array("Radius" => $width / 2 - 100, "SecondPass" => TRUE, "DrawLabels" => TRUE, "WriteValues" => TRUE, "Precision" => 2, "ValueR" => 0, "ValueG" => 0, "ValueB" => 0, "ValueAlpha" => 100, "SkewFactor" => 0.6, "LabelR" => 255, "LabelG" => 255, "LabelB" => 255, "LabelAlpha" => 100));
}
# if
if (isset($img)) {
ob_start();
$img->render(NULL);
$imageString = ob_get_clean();
$dimensions = $this->_svcImageUtil->getImageDimensions($imageString);
return array('metadata' => $dimensions, 'content' => $imageString);
} else {
return false;
}
# else
}
示例4: 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);
}
示例5: array
////////////////////////////////////////////////////////////////
// Minimum Values
//
/* Get minimum Temperature value */
$temp = $MyData->getMin("Temperature");
/* Get minimum Temperature value */
$T_Minimum = number_format($temp, 1);
/* Get minimum Humidity value */
$temp = $MyData->getMin("Humidity");
/* Format Min to 1 decimal place */
$H_Minimum = number_format($temp, 1);
////////////////////////////////////////////////////////////////
// Plotting Line Colours
//
/* Set Temperature Line Colour */
$MyData->setPalette("Temperature", array("R" => 0, "G" => 0, "B" => 255));
/* Set Humidity Line Colour */
$MyData->setPalette("Humidity", array("R" => 255, "G" => 0, "B" => 0));
////////////////////////////////////////////////////////////////
// Prepare and create Graph
//
/* Set graph area */
$myPicture = new pImage(1080, 460, $MyData);
/* Turn an AA */
$myPicture->Antialias = TRUE;
/* Rectangle Border */
$myPicture->drawRectangle(0, 0, 1079, 459, array("R" => 0, "G" => 0, "B" => 0));
////////////////////////////////////////////////////////////////
// Headings
//
/* Font Setup */
示例6: pData
include "statistics_tile_and_colour.php";
include "statistics_series_total_sum.php";
include "statistics_description_years.php";
include "pChart/class/pData.class.php";
include "pChart/class/pDraw.class.php";
include "pChart/class/pImage.class.php";
include "statistics_description_text.php";
$width = 760;
$height = 500;
$pChart = new pData();
$chart_tile_colours = array("0" => array("R" => 246, "G" => 113, "B" => 53, "Alpha" => 100), "1" => array("R" => 211, "G" => 60, "B" => 29, "Alpha" => 100), "2" => array("R" => 80, "G" => 94, "B" => 97, "Alpha" => 100), "3" => array("R" => 131, "G" => 137, "B" => 129, "Alpha" => 100), "4" => array("R" => 42, "G" => 43, "B" => 45, "Alpha" => 100), "5" => array("R" => 116, "G" => 82, "B" => 73, "Alpha" => 100), "6" => array("R" => 190, "G" => 93, "B" => 72, "Alpha" => 100), "7" => array("R" => 95, "G" => 83, "B" => 84, "Alpha" => 100), "8" => array("R" => 220, "G" => 220, "B" => 220, "Alpha" => 100));
for ($i = 0; $i < count($colours); $i++) {
$pChart->addPoints(array($tile_colour_results[0][$i], $tile_colour_results[1][$i], $tile_colour_results[2][$i], $tile_colour_results[3][$i], $tile_colour_results[4][$i], $tile_colour_results[5][$i], $tile_colour_results[6][$i], $tile_colour_results[7][$i], $tile_colour_results[8][$i], $tile_colour_results[9][$i], $tile_colour_results[10][$i], $tile_colour_results[11][$i], $tile_colour_results[12][$i]), "Serie{$i}");
$pChart->setSerieDescription("Serie{$i}", $colours[$i][0]);
$pChart->setSerieOnAxis("Serie{$i}", 0);
$pChart->setPalette("Serie{$i}", $chart_tile_colours[$i]);
}
$pChart->addPoints(array(get_tile_total_count($tile_colour_results, 0), get_tile_total_count($tile_colour_results, 1), get_tile_total_count($tile_colour_results, 2), get_tile_total_count($tile_colour_results, 3), get_tile_total_count($tile_colour_results, 4), get_tile_total_count($tile_colour_results, 5), get_tile_total_count($tile_colour_results, 6), get_tile_total_count($tile_colour_results, 7), get_tile_total_count($tile_colour_results, 8), get_tile_total_count($tile_colour_results, 9), get_tile_total_count($tile_colour_results, 10), get_tile_total_count($tile_colour_results, 11), get_tile_total_count($tile_colour_results, 12)), "Serie10");
$pChart->setSerieDrawable("Serie10", FALSE);
$pChart->setPalette("Serie10", array("Alpha" => 0));
$pChart->addPoints(array("Ormax", "Protector", "Polar", "Minster", "Turmalin", "Granat", "E13", "T11", "Nova", "Rubin", "Nortegl", "Hollander", "KDN"), "Absissa");
$pChart->setAbscissa("Absissa");
$pChart->setAxisPosition(0, AXIS_POSITION_LEFT);
$pChart->setAxisName(0, "Laskentamäärät kpl");
$pChart->setAxisUnit(0, "");
$pChartPicture = new pImage($width, $height, $pChart);
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$pChartPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
$pChartPicture->setFontProperties(array("FontName" => "pChart/fonts/arial.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_BOTTOMMIDDLE, "R" => 0, "G" => 0, "B" => 0);
$pChartPicture->drawText($width / 2, 25, ucfirst($table) . " - Tiilet / Värit", $TextSettings);
示例7: displayGraph
//.........这里部分代码省略.........
$mydatat[$name] = array();
}
array_push($mydatat[$name], $value);
}
}
$ret = $pmServiceevent->getRef($rrdtool_template);
$a_ref = $ret[0];
break;
case '1y':
$begin = date('Y-m-d H:i:s', date('U') - 365 * 24 * 3600);
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_services_id`='" . $items_id . "'\n AND `type`='10d'\n ORDER BY `date`";
$result = $DB->query($query);
while ($edata = $DB->fetch_array($result)) {
$dat = importArrayFromDB($edata['data']);
if (count($dat) > 0) {
$datemod = $edata['date'];
$daynum = date('m', PluginMonitoringServiceevent::convert_datetime_timestamp($edata['date']));
$daynum = $daynum - 1;
$split = explode(' ', $datemod);
$day = explode("-", $split[0]);
array_push($a_labels, $LANG['calendarM'][$daynum] . " " . $day[2]);
}
foreach ($dat as $name => $value) {
if (!isset($mydatat[$name])) {
$mydatat[$name] = array();
}
array_push($mydatat[$name], $value);
}
}
$ret = $pmServiceevent->getRef($rrdtool_template);
$a_ref = $ret[0];
break;
}
$i = 0;
foreach ($mydatat as $name => $data) {
$i++;
if ($i == '2') {
$datat = $data;
$data = array();
foreach ($datat as $val) {
array_push($data, -$val);
}
}
if (empty($data)) {
array_push($data, 0);
}
$MyData->addPoints($data, $name);
$color = str_split($a_ref[$name]);
$MyData->setPalette($name, array("R" => hexdec($color[0] . $color[1]), "G" => hexdec($color[2] . $color[3]), "B" => hexdec($color[4] . $color[5])));
}
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC, 1);
// $MyData->setSerieTicks("Probe 2",4);
// $MyData->setAxisName(0,"Temperatures");
$MyData->addPoints($a_labels, "Labels");
// $MyData->setSerieDescription("Labels","Months");
$MyData->setAbscissa("Labels");
$myPicture = new pImage(700, 230, $MyData);
$myPicture->Antialias = FALSE;
$Settings = array("R" => 225, "G" => 204, "B" => 123);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$myPicture->drawFilledRectangle(60, 40, 650, 200, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 11));
$myPicture->drawText(350, 20, $a_jsong->data[0]->labels[0]->title, array("FontSize" => 13, "Align" => TEXT_ALIGN_MIDDLEMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 7));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$labelskip = round(count($a_labels) / 8);
if ($time == '1d') {
$labelskip = 3;
} else {
if ($time == '1m') {
$labelskip = 3;
} else {
if ($time == '0y6m') {
$labelskip = 4;
} else {
if ($time == '1y') {
$labelskip = 3;
}
}
}
}
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 158, "GridG" => 158, "GridB" => 158, "GridAlpha" => 80, "DrawSubTicks" => TRUE, "CycleBackground" => FALSE, "LabelSkip" => $labelskip);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
$Config = array("ForceTransparency" => 60);
/* Draw the area chart */
$myPicture->drawAreaChart($Config);
$myPicture->render(GLPI_PLUGIN_DOC_DIR . "/monitoring/" . $itemtype . "-" . $items_id . "-" . $time . $timezonefile . ".png");
return;
}
示例8: array
$chart_limit = 1000;
}
$plotShapes = array(SERIE_SHAPE_FILLEDCIRCLE, SERIE_SHAPE_FILLEDTRIANGLE, SERIE_SHAPE_FILLEDSQUARE, SERIE_SHAPE_FILLEDDIAMOND);
reset($arrFields);
while (list($idx, $field) = each($arrFields)) {
if (!isset($chart_cols) or $idx == 0 or in_array($idx, $chart_cols)) {
$arrSeries[] = $field;
$myData->addPoints(array_reverse(array_slice($arrCols[$field], 0, $chart_limit)), $field);
$myData->setSerieWeight($field, $weight);
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)) {
示例9: pData
<?php
/* CAT:Spline 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), "Probe 1");
$MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Probe 2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Probe 3");
$MyData->setPalette("Probe 1", array("R" => 220, "G" => 60, "B" => 20));
$MyData->setSerieTicks("Probe 2", 4);
$MyData->setSerieWeight("Probe 3", 2);
$MyData->setAxisName(0, "Temperatures");
$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);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw a background */
$Settings = array("R" => 190, "G" => 213, "B" => 107, "Dash" => 1, "DashR" => 210, "DashG" => 223, "DashB" => 127);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Add a border to the picture */
$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, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
示例10: array
if (array_key_exists($dateStr, $arrFin)) {
$pts = $arrFin[$dateStr];
$myData->AddPoints($pts, "Finished");
} else {
$myData->AddPoints(VOID, "Finished");
}
if (array_key_exists($dateStr, $arrUnfin)) {
$pts = $arrUnfin[$dateStr];
$myData->AddPoints($pts, "Unfinished");
} else {
$myData->AddPoints(VOID, "Unfinished");
}
$myData->AddPoints($dateStr, "Date");
}
$myData->setAbscissa("Date");
$myData->setPalette("Finished", array("R" => 66, "G" => 116, "B" => 207));
$myData->setPalette("Unfinished", array("R" => 243, "G" => 168, "B" => 16));
$labelskip = floor($days / 10);
$scaleSettings = array("XMargin" => 0, "YMargin" => 0, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelSkip" => $labelskip, "Mode" => SCALE_MODE_START0);
$format = array("Gradient" => TRUE, "GradientEndR" => 181, "GradientEndG" => 200, "GradientEndB" => 236, "GradientStartR" => 66, "GradientStartG" => 116, "GradientStartB" => 207, "GradientAlpha" => 100);
$myPicture->setGraphArea(40, 50, 760, $height - 30);
} elseif ($type == 2) {
$title = "Games per Lobby";
$explanation = "Last " . $days . " days";
$sql = "SELECT count( * ) AS cnt, lobbyName\n FROM " . $tableName . " \n WHERE lobbyName <> ''\n AND " . $dateField . " > date_sub( date( now( ) ) , INTERVAL " . $days . " DAY )\n GROUP BY lobbyName \n ORDER BY cnt DESC";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$myData->AddPoints($row['cnt'], "Games");
$myData->AddPoints($row['lobbyName'], "Lobby");
}
$myData->setAbscissa("Lobby");
示例11: pData
<?php
/* CAT:Polar and radars */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pRadar.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(4, 4, 10, 10, 4, 4, 15, 15, 4, 4, 10, 10, 4, 4, 15, 15, 4, 4, 10, 10, 4, 4, 15, 15), "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
$MyData->setPalette("ScoreA", array("R" => 150, "G" => 5, "B" => 217));
/* Define the absissa serie */
$MyData->addPoints(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24), "Time");
$MyData->setAbscissa("Time");
/* Create the pChart object */
$myPicture = new pImage(300, 300, $MyData);
$myPicture->drawGradientArea(0, 0, 300, 300, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 240, "EndG" => 240, "EndB" => 240, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 300, 20, DIRECTION_HORIZONTAL, array("StartR" => 30, "StartG" => 30, "StartB" => 30, "EndR" => 100, "EndG" => 100, "EndB" => 100, "Alpha" => 100));
$myPicture->drawLine(0, 20, 300, 20, array("R" => 255, "G" => 255, "B" => 255));
$RectangleSettings = array("R" => 180, "G" => 180, "B" => 180, "Alpha" => 100);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 299, 299, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "pRadar - Draw radar charts", array("R" => 255, "G" => 255, "B" => 255));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
示例12: pch_threshold_graph
function pch_threshold_graph($graph_type, $index, $data, $width, $height, $font, $antialiasing, $xaxisname = "", $yaxisname = "", $title = "", $show_values = false, $show_legend = false, $font_size)
{
/* CAT:Threshold Chart */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data, "DEFCA");
$MyData->setAxisName(0, $yaxisname);
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY);
$MyData->addPoints($index, "Labels");
$MyData->setSerieDescription("Labels", $xaxisname);
$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" => $font, "FontSize" => $font_size));
$myPicture->drawText(60, 35, $title, array("FontSize" => $font_size, "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, "Mode" => SCALE_MODE_START0));
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->setFontProperties(array("FontName" => $font, "FontSize" => $font_size));
$settings = array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayValues" => $show_values, "DisplayZeroValues" => FALSE, "DisplayR" => 100, "DisplayG" => 100, "DisplayB" => 100, "DisplayShadow" => TRUE, "Surrounding" => 5, "AroundZero" => FALSE);
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);
if ($show_legend) {
/* Write the chart legend */
$myPicture->drawLegend(643, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
}
/* Render the picture */
$myPicture->stroke();
}
示例13: pData
$stat_avg = $stats_data[2];
$stat_stdev = $stats_data[3];
$stat_count = $stats_data[4];
///////////////////////////////////////////////////////////////////////////////////////////////////////
// THIS DRAWS THE GRAPH
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Create and populate the pData object
$MyData = new pData();
$MyData->addPoints($histogram_data, "histogram_data");
$MyData->setAxisName(0, "Count");
$MyData->addPoints($bin_labels, "Labels");
$MyData->setSerieDescription("Labels", $runner);
$MyData->setAbscissa("Labels");
// change bar colour
$serieSettings = array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 100);
$MyData->setPalette("histogram_data", $serieSettings);
// Create the pChart object
$myPicture = new pImage(700, 500, $MyData);
// Add a border to the picture
$myPicture->drawRectangle(0, 0, 699, 499, array("R" => 0, "G" => 0, "B" => 0));
// Write the picture title
$myPicture->setFontProperties(array("FontName" => "../pchart/fonts/verdana.ttf", "FontSize" => 6));
$myPicture->drawText(500, 150, "Min:" . $stat_min, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(500, 160, "Max:" . $stat_max, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(500, 170, "Avg:" . $stat_avg, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(500, 180, "St. Dev:" . $stat_stdev, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(500, 190, "Count:" . $stat_count, array("R" => 0, "G" => 0, "B" => 0));
// Write the chart title
$myPicture->setFontProperties(array("FontName" => "../pchart/fonts/verdana.ttf", "FontSize" => 11));
$myPicture->drawText(350, 55, $runner . " Histogram", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
// Draw the info
示例14: array
$myPicture->setFontProperties(array("FontName" => "pChart/fonts/verdana.ttf", "FontSize" => 10));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Set the graph area */
$myPicture->setGraphArea(50, 40, 65 * $nbr_room + 35, 290);
$myPicture->drawGradientArea(50, 40, 65 * $nbr_room + 35, 290, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 30));
/* Draw the chart scale */
$scaleSettings = array("AxisAlpha" => 10, "TickAlpha" => 10, "DrawXLines" => FALSE, "Mode" => SCALE_MODE_START0, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10);
$myPicture->drawScale($scaleSettings);
/* Draw the chart */
$MyData->setSerieDrawable("Objectif", FALSE);
$myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayPos" => LABEL_POS_INSIDE, "Surrounding" => 30));
$MyData->setSerieDrawable("Objectif", TRUE);
$MyData->setSerieDrawable("Consomation moyenne des baies (kW)", FALSE);
$MyData->setSerieDrawable("Salles", FALSE);
$serieSettings = array("R" => 229, "G" => 11, "B" => 11);
$MyData->setPalette("Objectif", $serieSettings);
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawSplineChart();
if ($consult_date != "Donnée actuelle") {
$myPicture->Render("images/consoe_graph_render_{$consult_date}.png");
} else {
$myPicture->Render("images/consoe_graph_render.png");
}
} else {
$error = 1;
}
}
} catch (Exception $e) {
// Catch des erreurs et écriture dans le fichier de log
require 'error_log.php';
}
示例15: array
$ColorPalete = array("R" => 220, "G" => 140, "B" => 100);
} elseif ($_GET['gcolor'] == 'blue') {
$ColorPalete = array("R" => 100, "G" => 140, "B" => 220);
} elseif ($_GET['gcolor'] == 'green') {
$ColorPalete = array("R" => 69, "G" => 139, "B" => 16);
} elseif ($_GET['gcolor'] == 'orange') {
$ColorPalete = array("R" => 255, "G" => 140, "B" => 0);
} else {
if (SETTINGS_THEME == 'light' || $_GET['bg'] == 'light') {
$ColorPalete = array("R" => 150, "G" => 150, "B" => 150);
} else {
$ColorPalete = array("R" => 250, "G" => 250, "B" => 250);
}
}
//$ColorPalete["Alpha"] = 100; //прозрачность
$DataSet->setPalette("Serie1", $ColorPalete);
// Initialise the graph
/* Create a pChart object and associate your dataset */
$Test = new pImage($w, $h, $DataSet);
/* Define the boundaries of the graph area */
$Test->setGraphArea($left_border, $top_border, $w - $right_border, $h - $bottom_border);
//градиентная заливка фона
if (SETTINGS_THEME == 'light' || $_GET['bg'] == 'light') {
$Settings = array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 160, "EndG" => 160, "EndB" => 160, "Alpha" => 100);
} else {
$Settings = array("StartR" => 132, "StartG" => 153, "StartB" => 172, "EndR" => 82, "EndG" => 103, "EndB" => 122, "Alpha" => 100);
}
$Test->drawGradientArea(0, 0, $w, $h, DIRECTION_VERTICAL, $Settings);
//градиентная заливка поля графика
$Settings["StartR"] = $Settings["StartR"] + 40;
$Settings["StartG"] = $Settings["StartG"] + 40;