本文整理汇总了PHP中pImage::Render方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::Render方法的具体用法?PHP pImage::Render怎么用?PHP pImage::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::Render方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/* Add a border to the picture */
//$myPicture->drawRectangle(800,350,0,0,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
// $myPicture->setFontProperties(array("FontName"=>"./fonts/simsun.ttc","FontSize"=>8,"R"=>255,"G"=>255,"B"=>255));
//$myPicture->drawText(10,16,"Average recorded temperature",array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "./fonts/simsun.ttc", "FontSize" => 10, "R" => 0, "G" => 0, "B" => 0));
/* Define the chart area */
$myPicture->drawText(200, 60, $chart_title);
$myPicture->setFontProperties(array("FontName" => "./fonts/simsun.ttc", "FontSize" => 8, "R" => 0, "G" => 0, "B" => 0));
$myPicture->setGraphArea(40, 60, 800, 400);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "Mode" => SCALE_MODE_START0, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelRotation" => 45, "LabelSkip" => $row_number / 60);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawLineChart();
//$myPicture->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80));
/* Write the chart legend */
//$myPicture->drawLegend(590,9,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL,"FontR"=>255,"FontG"=>255,"FontB"=>255));
//$myPicture->drawLegend(100,40,array("Style"=>LEGEND_FAMILY_BOX,"Mode"=>LEGEND_VERTICAL));
$myPicture->drawLegend(800, 150, 0, 255, 255, 255);
/* Render the picture (choose the best way) */
$myPicture->Render("pictures/{$chart_png}.png");
echo "<img src=\"pictures/{$chart_png}.png\" />";
?>
</body></html>
示例2: createCharts
//.........这里部分代码省略.........
//$archiveDb->addArchive($y.$ym, $dataDb, $user['clientid']);
$months[$y . $ym] = $y . '/' . $ym;
}
++$m;
if ($m > 12) {
$m = 0;
}
}
++$y;
$m = 1;
}
//Merge subcategories to main categories
foreach ($turnoverCategories as $id => $values) {
if (isset($options['categories'][$id]['childs']) && $id != $params['catid']) {
foreach ($options['categories'][$id]['childs'] as $childId) {
foreach ($values as $month => $value) {
$turnoverCategories[$id][$month] += $turnoverCategories[$childId][$month];
}
unset($turnoverCategories[$childId]);
}
}
}
//Remove empty arrays
foreach ($turnoverCategories as $key => $values) {
if (!array_sum($values)) {
unset($turnoverCategories[$key]);
}
}
require_once BASE_PATH . '/library/pChart/class/pData.class.php';
require_once BASE_PATH . '/library/pChart/class/pDraw.class.php';
require_once BASE_PATH . '/library/pChart/class/pImage.class.php';
//Turnover
/* Create your dataset object */
$turnoverData = new pData();
/* Add data in your dataset */
$turnoverData->addPoints($turnover, 'Values');
$turnoverData->setAxisName(0, '€ / Netto');
/* Create the X serie */
$turnoverData->addPoints($months, 'Labels');
$turnoverData->setSerieDescription('Labels', 'Months');
$turnoverData->setAbscissa('Labels');
/* Create a pChart object and associate your dataset */
$turnover = new pImage($width, $height, $turnoverData);
/* Turn off AA processing */
$turnover->Antialias = FALSE;
/* Choose a nice font */
$turnover->setFontProperties(array('FontName' => BASE_PATH . '/library/pChart/fonts/verdana.ttf', 'FontSize' => 10));
/* Define the boundaries of the graph area */
$turnover->setGraphArea(75, 20, $width - 30, $height - 60);
/* Draw the scale, keep everything automatic */
$turnover->drawScale(array('DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_START0, 'LabelRotation' => 45));
/* Draw the scale, keep everything automatic */
$settings = array('Gradient' => TRUE, 'GradientMode' => GRADIENT_EFFECT_CAN, 'DisplayPos' => LABEL_POS_INSIDE, 'DisplayValues' => TRUE, 'DisplayR' => 0, 'DisplayG' => 0, 'DisplayB' => 0, 'DisplayShadow' => TRUE, 'Surrounding' => 10);
$turnover->drawBarChart($settings);
/* Build the PNG file and send it to the web browser */
if (!file_exists(BASE_PATH . '/cache/chart/')) {
mkdir(BASE_PATH . '/cache/chart/');
chmod(BASE_PATH . '/cache/chart/', 0777);
}
$turnover->Render(BASE_PATH . '/cache/chart/turnover-' . $width . '-' . $height . '.png');
//Turnover by categories
/* Create your dataset object */
$turnoverCategoriesData = new pData();
/* Add data in your dataset */
$turnoverCategoriesTotal = array();
foreach ($turnoverCategories as $key => $value) {
$turnoverCategoriesTotal[$key] = array_sum($value);
}
arsort($turnoverCategoriesTotal);
foreach ($turnoverCategoriesTotal as $key => $value) {
if ($key && isset($options['categories'][$key])) {
$turnoverCategoriesData->addPoints($turnoverCategories[$key], $options['categories'][$key]['title']);
}
}
if (isset($turnoverCategories[0])) {
$turnoverCategoriesData->addPoints($turnoverCategories[0], $statisticsUncategorized);
}
$turnoverCategoriesData->setAxisName(0, '€ / Netto');
/* Create the X serie */
$turnoverCategoriesData->addPoints($months, 'Labels');
$turnoverCategoriesData->setSerieDescription('Labels', 'Months');
$turnoverCategoriesData->setAbscissa('Labels');
/* Create a pChart object and associate your dataset */
$turnoverCategories = new pImage($width, $height, $turnoverCategoriesData);
/* Turn off AA processing */
$turnoverCategories->Antialias = FALSE;
/* Choose a nice font */
$turnoverCategories->setFontProperties(array('FontName' => BASE_PATH . '/library/pChart/fonts/verdana.ttf', 'FontSize' => 10));
/* Define the boundaries of the graph area */
$turnoverCategories->setGraphArea(75, 20, $width - 30, $height - 60);
/* Draw the scale, keep everything automatic */
$turnoverCategories->drawScale(array('XMargin' => 2, 'DrawSubTicks' => TRUE, 'Mode' => SCALE_MODE_ADDALL_START0, 'LabelRotation' => 45));
/* Draw the scale, keep everything automatic */
$settings = array();
$turnoverCategories->drawStackedAreaChart($settings);
/* Write the chart legend */
$turnoverCategories->drawLegend(100, 20, array('Style' => LEGEND_NOBORDER, 'Mode' => LEGEND_VERTICAL));
/* Build the PNG file and send it to the web browser */
$turnoverCategories->Render(BASE_PATH . '/cache/chart/turnover-category-' . $width . '-' . $height . '.png');
}
示例3: array
/* Write the data bounds */
$boundSetting = array("DrawBox" => FALSE, "MaxLabelTxt" => 'Max:', "MinLabelTxt" => 'Min:', "MinDisplayR" => 0, "MinDisplayG" => 0, "MinDisplayB" => 0, "DisplayOffset" => 5);
if ($bound == 'min') {
$myPicture->writeBounds(BOUND_MIN, $boundSetting);
}
if ($bound == 'max') {
$myPicture->writeBounds(BOUND_MAX, $boundSetting);
}
if ($bound == 'both') {
$myPicture->writeBounds(BOUND_BOTH, $boundSetting);
}
}
}
/* Render the picture (choose the best way) */
if ($resultType == 'charttable') {
$myPicture->Render("pictures/chart_png_{$id}.png");
echo '<html>';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<link rel="stylesheet" type="text/css" href="./datatb.css" />';
echo '<title>pchart_config</title>';
echo '</head>';
echo '<body>';
echo "<img src='pictures/chart_png_{$id}.png' />";
if (isset($err)) {
echo $err;
} else {
echo $table_html;
}
echo '</body>';
echo '</html>';
示例4: array
$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 */
$myPicture->setFontProperties(array("FontName" => "pChart/fonts/Silkscreen.ttf", "FontSize" => 6, "R" => 255, "G" => 255, "B" => 255));
$myPicture->drawText(10, 13, "Capacite electrique disponible (kW)", array("R" => 255, "G" => 255, "B" => 255));
/* Define the default font */
$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 */
$myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayPos" => LABEL_POS_INSIDE, "Surrounding" => 30));
if ($consult_date != "Donnée actuelle") {
$myPicture->Render("images/capae_graph_render_{$consult_date}.png");
} else {
$myPicture->Render("images/capae_graph_render.png");
}
} else {
$error = 1;
}
}
} catch (Exception $e) {
// Catch des erreurs et écriture dans le fichier de log
require 'error_log.php';
}
示例5: pScatter
$myPicture->setGraphArea(75, 90, 525, 540);
/* Create the Scatter chart object */
$myScatter = new pScatter($myPicture, $myData);
/* Draw the scale */
$myScatter->drawScatterScale();
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a scatter plot chart */
$myScatter->drawScatterPlotChart();
/* Draw the legend */
$myScatter->drawScatterLegend(420, 580, array("Mode" => LEGEND_HORIZONTAL, "Style" => LEGEND_NOBORDER));
/* Draw the line of best fit */
$myScatter->drawScatterBestFit();
/* Render the picture (choose the best way) */
// $myPicture->autoOutput("pictures/example.drawScatterBestFit.png");
$myPicture->Render("attempts_pro2.png");
}
echo "<body>";
if (isset($_POST['option'])) {
echo "<div class='bigcontainer2'>";
echo "<div class='bigmain2'>";
} else {
echo "<div class='bigcontainer'>";
echo "<div class='bigmain'>";
}
echo "<table align=center style='width:50%'>";
echo "<tr>";
if (isset($_POST['option'])) {
echo $extype;
echo "<br><br>";
// echo "Quartile based on: ".$quartile;
示例6: explode
$myArray = explode(',', $string);
$i = 0;
while ($string = fgets($handler)) {
$myArray = explode(',', $string);
$components[$i] = $myArray[0];
++$i;
}
$MyData = new pData();
$MyData->importFromCSV("foundit.csv", array("GotHeader" => TRUE, "SkipColumns" => array(0)));
$MyData->setAxisName(0, "Bug Count");
$MyData->setAxisName(1, "Components");
$MyData->addPoints($components, "Components");
$MyData->setAbscissa("Components");
//$MyData->setSerieOnAxis("Component",1);
//$MyData->setAxisXY(1,AXIS_X);
/* Create the pChart object */
$myPicture = new pImage(3000, 700, $MyData);
$myPicture->drawGradientArea(0, 0, 3000, 700, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 3000, 700, 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, 3000, 680);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("Interleave" => 0.5, "Surrounding" => -15, "InnerSurrounding" => 15));
/* Write the chart legend */
$myPicture->drawLegend(800, 10, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->Render("foundit.png");
示例7: block_mystats_quiz_chart
function block_mystats_quiz_chart($avg, $high, $strAvg, $strHigh, $strTitle, $strScale, $userid)
{
$myQuizData = new pData();
$myQuizData->addPoints(array($avg), "Serie1");
$myQuizData->setSerieDescription("Serie1", $strAvg);
$myQuizData->setSerieOnAxis("Serie1", 0);
$myQuizData->addPoints(array($high), "Serie2");
$myQuizData->setSerieDescription("Serie2", $strHigh);
$myQuizData->setSerieOnAxis("Serie2", 0);
$myQuizData->addPoints(array(" "), "Absissa");
$myQuizData->setAbscissa("Absissa");
$myQuizData->setAxisPosition(0, AXIS_POSITION_LEFT);
$myQuizData->setAxisName(0, $strScale);
$myQuizData->setAxisUnit(0, "");
$myQuizPicture = new pImage(350, 230, $myQuizData);
$quizSettings = array("R" => 255, "G" => 255, "B" => 255);
$myQuizPicture->drawFilledRectangle(0, 0, 350, 230, $quizSettings);
$myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myQuizPicture->setFontProperties(array("FontName" => "../blocks/mystats/pChart2.1.3/fonts/GeosansLight.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_TOPLEFT, "R" => 0, "G" => 0, "B" => 0);
$myQuizPicture->drawText(25, 25, $strTitle, $TextSettings);
$myQuizPicture->setShadow(FALSE);
$myQuizPicture->setGraphArea(25, 70, 325, 210);
$myQuizPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8));
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 110), 1 => array("Min" => 00, "Max" => 1));
$quizSettings = array("Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "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);
$myQuizPicture->drawScale($quizSettings);
$myQuizPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$quizConfig = array("DisplayValues" => 1, "Rounded" => 1, "AroundZero" => 1);
$myQuizPicture->drawBarChart($quizConfig);
$quizConfig = array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 50, "AxisID" => 0, "Ticks" => 4, "Caption" => "Threshold");
$myQuizPicture->drawThreshold(0, $quizConfig);
$quizConfig = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "../blocks/mystats/pChart2.1.3/fonts/pf_arma_five.ttf", "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_ROUND, "Mode" => LEGEND_VERTICAL, "Family" => LEGEND_FAMILY_CIRCLE);
$myQuizPicture->drawLegend(240, 16, $quizConfig);
$imgName = sha1($userid . $strTitle) . '.png';
$myQuizPicture->Render('../blocks/mystats/img/' . $imgName);
return '<img src="../blocks/mystats/img/' . $imgName . '" alt="' . $strAvg . ': ' . $avg . ', ' . $strHigh . ': ' . $high . '">';
}
示例8: 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");
}
示例9: array
// $myPicture->drawGradientArea(0,0,1000,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(1500,450,0,0,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
// $myPicture->setFontProperties(array("FontName"=>"../fonts/simsun.ttc","FontSize"=>8,"R"=>255,"G"=>255,"B"=>255));
//$myPicture->drawText(10,16,"Average recorded temperature",array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/simsun.ttc", "FontSize" => 8, "R" => 0, "G" => 0, "B" => 0));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 1000, 400);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelRotation" => 45, "LabelSkip" => $row_number / 60);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawLineChart();
//$myPicture->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80));
/* Write the chart legend */
// $myPicture->drawLegend(590,9,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL,"FontR"=>255,"FontG"=>255,"FontB"=>255));
// $myPicture->drawLegend(100,40,array("Style"=>LEGEND_FAMILY_BOX,"Mode"=>LEGEND_VERTICAL));
$myPicture->drawLegend(1000, 60, 0, 255, 255, 255);
/* Render the picture (choose the best way) */
// $myPicture->autoOutput("pictures/example.drawLineChart.plots.png");
$myPicture->Render("pictures/example.{$chart_png}.png");
echo "<img src=\"pictures/example.{$chart_png}.png\" />";
?>
</body></html>
示例10: array
//$myPicture->drawText(10,16,"Average recorded temperature",array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/simsun.ttc", "FontSize" => 10, "R" => 0, "G" => 0, "B" => 0));
/* Define the chart area */
$myPicture->drawText(40, 60, $chart_title);
$myPicture->setFontProperties(array("FontName" => "../fonts/simsun.ttc", "FontSize" => 8, "R" => 0, "G" => 0, "B" => 0));
$myPicture->setGraphArea(40, 60, 800, 400);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelRotation" => 45, "LabelSkip" => $row_number / 60);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawLineChart();
//$myPicture->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80));
/* Write the chart legend */
// $myPicture->drawLegend(590,9,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL,"FontR"=>255,"FontG"=>255,"FontB"=>255));
// $myPicture->drawLegend(100,40,array("Style"=>LEGEND_FAMILY_BOX,"Mode"=>LEGEND_VERTICAL));
$myPicture->drawLegend(800, 150, 0, 255, 255, 255);
/* Render the picture (choose the best way) */
// $myPicture->autoOutput("pictures/example.drawLineChart.plots.png");
$filename = "pictures/" . $chart_name . ".png";
$myPicture->Render($filename);
echo "<img src={$filename} />";
//$myPicture->Render("pictures/example.drawLineChart2.plots.rand().png");
//echo "<img src=\"pictures/example.drawLineChart2.plots.png\" />";
?>
</body></html>
示例11: pImage
$filas[$indexArr] = $columnas;
$indexArr++;
}
}
for ($i = 0; $i < $indexArr; $i++) {
$DataSet->addPoints(array($filas[$i][1], $filas[$i][2], $filas[$i][3], $filas[$i][4], $filas[$i][5]), $filas[$i][0]);
$DataSet->setAxisName(0, "Valores");
}
$DataSet->addPoints(array("estrategia", "personas", "recursos", "procesos", "resultados"), "Fechas");
$DataSet->setSerieDescription("Fechas", "Fecha");
$DataSet->setAbscissa("Fechas");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $DataSet);
$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));
$myPicture->setFontProperties(array("FontName" => "wp-content/plugins/adeada/test/pChart2/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale */
$myPicture->setGraphArea(50, 30, 680, 200);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$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($settings);
/* Write the chart legend */
$myPicture->drawLegend(580, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
$myPicture->Render("holas.png");
?>
<img src='holas.png'>
示例12: drk_start
//.........这里部分代码省略.........
echo "[36mBlock: {$block_id} | Find: {$address} | Time: {$block_time} | Diff: {$diff} | Price: {$drk_price}\$ [0m \n";
$query_insert = $db->prepare("INSERT INTO `data` (`bid`, `diff`, `address`, `time`) VALUES (:bid, :diff, :address, :time)");
$query_insert->bindParam(':bid', $block_id, PDO::PARAM_STR);
$query_insert->bindParam(':diff', $diff, PDO::PARAM_STR);
$query_insert->bindParam(':address', $address, PDO::PARAM_STR);
$query_insert->bindParam(':time', $block_time, PDO::PARAM_STR);
$query_insert->execute();
$lastId = $db->lastInsertId();
}
$k = 0;
$query_select = $db->prepare("SELECT * FROM `data` WHERE `time` > UNIX_TIMESTAMP()-86400");
$query_select->execute();
$all_data = $query_select->rowCount();
$query_select = $db->prepare("SELECT SUM(diff) FROM `data` WHERE `time` > UNIX_TIMESTAMP()-86400");
$query_select->execute();
$row = $query_select->fetch();
$diff_sum = $row['SUM(diff)'];
$avg_diff = $diff_sum / $all_data;
$query_select = $db->prepare("SELECT * FROM `address`");
$query_select->execute();
if ($query_select->rowCount() == 0) {
return;
}
while ($row = $query_select->fetch()) {
$query_data = $db->prepare("SELECT * FROM `data` WHERE `address` = :address AND `time` > UNIX_TIMESTAMP()-86400");
$query_data->bindParam(':address', $row['address'], PDO::PARAM_STR);
$query_data->execute();
if ($row['address'] == 'P2Pool') {
$row['label'] = 'P2Pool';
}
if ($query_data->rowCount() / $all_data * 100 < 3 || empty($row['label'])) {
$k = $k + $query_data->rowCount();
continue;
}
$arr_count[] = $query_data->rowCount();
$arr_label[] = $row['label'];
}
if ($k > 0) {
$arr_label[] = 'Other';
$arr_count[] = $k;
}
array_multisort($arr_count, SORT_DESC, $arr_label);
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($arr_count, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($arr_label, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(720, 400, $MyData, TRUE);
$myPicture->Antialias = TRUE;
/* Draw a solid background */
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$myPicture->drawFilledRectangle(0, 0, 920, 400, $Settings);
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "/var/www/midas/root/fonts/verdana.ttf", "FontSize" => 14));
$myPicture->drawText(0, 20, "At block: {$last_block}", array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(210, 24, "Difficulty: {$diff}", array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(390, 24, "Avg difficulty: " . round($avg_diff), array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawText(600, 23, "Price: {$drk_price}\$", array("R" => 0, "G" => 0, "B" => 0));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a splitted pie chart */
$myPicture->setFontProperties(array("FontName" => "/var/www/midas/root/fonts/tahoma.ttf", "FontSize" => 10));
$PieChart->draw3DPie(340, 220, array("WriteValues" => TRUE, "ValueR" => 0, "ValueG" => 0, "ValueB" => 0, "Radius" => 225, "DataGapAngle" => 4, "DataGapRadius" => 6, "DrawLabels" => TRUE, "Border" => TRUE));
/* Render the picture (choose the best way) */
$myPicture->Render("/var/www/midas/root/stat/drk.png");
unset($data);
$data = ['num' => $last_block, 'diff' => round($avg_diff)];
$query = $db->prepare("SELECT * FROM `params` WHERE `key` = 'block'");
$query->execute();
if ($query->rowCount() != 1) {
$query = $db->prepare("INSERT INTO `params` (`key`, `value`) VALUES ('block', :value)");
$query->bindParam(':value', json_encode($data), PDO::PARAM_STR);
$query->execute();
} else {
$query = $db->prepare("UPDATE `params` SET `value` =:value WHERE `key` = 'block'");
$query->bindParam(':value', json_encode($data), PDO::PARAM_STR);
$query->execute();
}
if (!empty($lastId)) {
$j = 0;
$tx_coun = count($info_block["tx"]);
foreach ($info_block["tx"] as $value) {
$encode_tx = $darkcoin->getrawtransaction("{$value}");
$tx_info = $darkcoin->decoderawtransaction($encode_tx);
foreach ($tx_info["vout"] as $val) {
$j += $val["value"];
}
$query = $db->prepare("UPDATE `data` SET `txs` = :count, `tx_sum` = :sum WHERE `id` = :id");
$query->bindParam(':count', $tx_coun, PDO::PARAM_STR);
$query->bindParam(':sum', $j, PDO::PARAM_STR);
$query->bindParam(':id', $lastId, PDO::PARAM_STR);
$query->execute();
}
}
}
示例13: array
$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 */
$myPicture->setFontProperties(array("FontName" => "pChart/fonts/Silkscreen.ttf", "FontSize" => 6, "R" => 255, "G" => 255, "B" => 255));
$myPicture->drawText(10, 13, "Nombre de baies possible et de baies restant a installer", array("R" => 255, "G" => 255, "B" => 255));
/* Define the default font */
$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);
$myPicture->drawLegend((65 * $nbr_room + 65) / 4, 315, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayPos" => LABEL_POS_INSIDE, "Surrounding" => 30));
if ($consult_date != "Donnée actuelle") {
$myPicture->Render("images/nbrbpbr_graph_render_{$consult_date}.png");
} else {
$myPicture->Render("images/nbrbpbr_graph_render.png");
}
} else {
$error = 1;
}
}
} catch (Exception $e) {
// Catch des erreurs et écriture dans le fichier de log
require 'error_log.php';
}
示例14: sendToDisk
/**
* Save rendering to disk
*
* @param string $filename without path
* @return string path of file
*/
public function sendToDisk($filename)
{
$filePath = self::getOutputPath($filename);
$this->pImage->Render($filePath);
return $filePath;
}