本文整理汇总了PHP中pData::setAxisPosition方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::setAxisPosition方法的具体用法?PHP pData::setAxisPosition怎么用?PHP pData::setAxisPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::setAxisPosition方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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");
}
$myData->setAxisName(0, "X-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(sin(deg2rad(30 - $i)) * 20, "Probe 2");
}
$myData->setSerieOnAxis("Probe 2", 1);
$myData->setAxisName(1, "Y-Index");
$myData->setAxisXY(1, AXIS_Y);
$myData->setAxisPosition(1, AXIS_POSITION_RIGHT);
/* Create the 1st scatter chart binding */
$myData->setScatterSerie("Probe 1", "Probe 2", 0);
$myData->setScatterSerieDescription(0, "Trigonometric function");
$myData->setScatterSerieTicks(0, 4);
$myData->setScatterSerieColor(0, array("R" => 180, "G" => 0, "B" => 0));
$myData->setScatterSeriePicture(0, "resources/chart_line.png");
/* Create the pChart object */
开发者ID:josepabloapu,项目名称:statistical-analysis-tools-lamp,代码行数:30,代码来源:example.drawScatterLineChart.trigo.php
示例2: buildCostPerKmChartData
protected function buildCostPerKmChartData($cd = array())
{
if (!$cd) {
$cd = parent::buildCostPerKmChartData();
}
if (!$cd) {
return $cd;
}
$this->setOption('title', $cd['title']);
$myData = new pData();
$x_id = $cd['x']['id'];
$myData->addPoints($cd['x']['values'], $x_id);
$myData->setAxisName(0, $cd['x']['description']);
$myData->setAxisXY(0, AXIS_X);
$myData->setAxisPosition(0, AXIS_POSITION_BOTTOM);
$is_date = $this->getParameter('range_type') == 'date' ? true : false;
$display_mode = $is_date ? AXIS_FORMAT_DATE : AXIS_FORMAT_DEFAULT;
$display_format = $is_date ? 'd-M-Y' : null;
$myData->setAxisDisplay(0, $display_mode, $display_format);
foreach ($cd['y']['series'] as $key => $serie) {
$values = $this->filterNulls($cd['y']['series'][$key]['values']);
if (!$values) {
continue;
}
$y_id = $cd['y']['series'][$key]['id'];
$myData->addPoints($values, $y_id);
$myData->setSerieOnAxis($y_id, 1);
$myData->setScatterSerie($x_id, $y_id, $key);
$myData->setScatterSerieDescription($key, $cd['y']['series'][$key]['label']);
$myData->setScatterSerieWeight($key, 0.7);
}
$myData->setAxisName(1, $cd['y']['description']);
$myData->setAxisXY(1, AXIS_Y);
$myData->setAxisPosition(1, AXIS_POSITION_LEFT);
return $myData;
}
示例3: pImage
$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");
$myData->setAxisUnit(0, "");
$myData->addPoints(array("1er Trimestre", "2ndo Trimestre", "3er Trimestre"), "Absissa");
$myData->setAbscissa("Absissa");
//$myData->addPoints(array("1","2","3"),"Labels");
//$myData->setSerieDescription("Labels","Evaluaciones");
//$myData->setAbscissa("Labels");
$myPicture = new pImage($anchura, $altura, $myData);
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, $anchura, $altura, $Settings);
if ($g_enabled == "on") {
list($StartR, $StartG, $StartB) = extractColors($g_gradient_start);
list($EndR, $EndG, $EndB) = extractColors($g_gradient_end);
$Settings = array("StartR" => $StartR, "StartG" => $StartG, "StartB" => $StartB, "EndR" => $EndR, "EndG" => $EndG, "EndB" => $EndB, "Alpha" => 50);
//$Settings = array("StartR"=>125, "StartG"=>92, "StartB"=>231, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
示例4: PlotLine
function PlotLine($rowX, $rowY, $name, $ch)
{
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($rowX, "Serie1");
$myData->setSerieDescription("Serie1", $name);
//$myData->setSerieOnAxis("Serie1",0);
$myData->addPoints($rowY, "Absissa");
$myData->setAbscissa("Absissa");
//$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa");
//$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
//$myData->setAxisName(0,"1st axis");
$myData->setAxisUnit(0, "");
$myPicture = new pImage(700, 230, $myData);
$Settings = array("R" => 240, "G" => 242, "B" => 241, "Dash" => 1, "DashR" => 260, "DashG" => 262, "DashB" => 261);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
$Settings = array("StartR" => 252, "StartG" => 255, "StartB" => 254, "EndR" => 252, "EndG" => 255, "EndB" => 254, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$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, 190);
//$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));
$Config = "";
if ($ch == 1) {
$myPicture->drawSplineChart($Config);
}
if ($ch == 2) {
$myPicture->drawBarChart($Config);
}
if ($ch == 3) {
$myPicture->drawLineChart($Config);
}
if ($ch == 4) {
$myPicture->drawPlotChart($Config);
}
if ($ch == 5) {
$myPicture->drawStepChart($Config);
}
if ($ch == 6) {
$myPicture->drawAreaChart($Config);
}
if ($ch == 7) {
$myPicture->drawFilledSplineChart($Config);
}
if ($ch == 8) {
$myPicture->drawFilledStepChart($Config);
}
if ($ch == 9) {
$myPicture->drawStackedAreaChart($Config);
}
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
$myPicture->drawLegend(563, 16, $Config);
$myPicture->stroke();
}
示例5: min
}
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));
}
$myPicture->setFontProperties(array("FontName" => "./fonts/simhei.ttf", "FontSize" => $font, "R" => 0, "G" => 0, "B" => 0));
/* Define the chart area */
$width_offset = 0;
if ($legend > 0) {
$width_offset += max($widthLegend, 50);
}
示例6: columnChart
/**
*
* @param array $data
* @param string $title
* @return resource
*/
public static function columnChart(array $data, $title, $scaleConfig = array(), $legendConfig = array())
{
$fontsChart = APPLICATION_PATH . '/../library/pChart/fonts/verdana.ttf';
App_Util_Chart::loadClass(array('pData', 'pDraw', 'pImage'));
$myData = new pData();
foreach ($data['series'] as $c => $serie) {
$serieId = 'Serie' . $c;
$myData->addPoints($serie, $serieId);
$myData->setSerieDescription($serieId, $data['names'][$c]);
$myData->setSerieOnAxis($serieId, 0);
}
$myData->addPoints($data['labels'], 'Absissa');
$myData->setAbscissa('Absissa');
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
$myPicture = new pImage(700, 500, $myData);
$Settings = array("R" => 250, "G" => 250, "B" => 250);
$myPicture->drawFilledRectangle(0, 0, self::$_width, self::$_height, $Settings);
$myPicture->drawRectangle(0, 0, self::$_width - 1, self::$_height - 1, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => $fontsChart . "verdana.ttf", "FontSize" => 14));
$myPicture->setGraphArea(50, 50, self::$_width - 1, self::$_height - 100);
$myPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => $fontsChart, "FontSize" => 10));
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_START0, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "CycleBackground" => 1, "LabelRotation" => 45, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
foreach ($scaleConfig as $c => $v) {
$Settings[$c] = $v;
}
$myPicture->drawScale($Settings);
$Config = array("DisplayValues" => 1, "AroundZero" => 1, "Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN);
$myPicture->drawBarChart($Config);
$pos = floor(strlen($title) / 2);
$start = 350 - $pos * 9;
$myPicture->setFontProperties(array('FontName' => $fontsChart, 'FontSize' => 14));
$myPicture->drawText($start, 25, $title, array('R' => 0, 'G' => 0, 'B' => 0));
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => $fontsChart, "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
foreach ($legendConfig as $c => $v) {
$Config[$c] = $v;
}
$myPicture->drawLegend(480, 40, $Config);
ob_start();
imagepng($myPicture->Picture);
$image = ob_get_clean();
return $image;
}
示例7: pData
<?php
/* 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 */
$myData->addPoints(array(3, 12, 15, 8, 5, -5), "X Values");
$myData->setAxisName(0, "X Values");
$myData->setAxisXY(0, AXIS_X);
$myData->setAxisDisplay(0, AXIS_FORMAT_TIME, "i:s");
$myData->setAxisPosition(0, AXIS_POSITION_BOTTOM);
/* Create the Y axis and the binded series */
$myData->addPoints(array(2, 7, 5, 18, 19, 22), "Y Values");
$myData->setSerieOnAxis("Y Values", 1);
$myData->setAxisName(1, "Y Values");
$myData->setAxisXY(1, AXIS_Y);
/* Create the pChart object */
$myPicture = new pImage(400, 400, $myData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 400, 400, $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, 400, 400, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 400, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Write the picture title */
示例8: 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 . '">';
}
示例9: pData
$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);
$description .= GetYearsDescription($years);
$description .= " - (" . GetSeriesTotalSum($pChart, "Half") . "kpl)";
if (strlen($description) > 120) {
$description = substr($description, strpos($description, "joissa"));
}
$pChartPicture->setFontProperties(array("FontSize" => 11));
$pChartPicture->drawText($width / 2, 45, $description, $TextSettings);
示例10: foreach
if ($Mode == "Source") {
$Data = "";
foreach ($Values as $key => $Value) {
if ($Value == "") {
$Value = "VOID";
}
$Data = $Data . "," . toString($Value);
}
$Data = right($Data, strlen($Data) - 1);
echo '$myData->addPoints(array(' . $Data . '),"Absissa");' . "\r\n";
echo '$myData->setAbscissa("Absissa");' . "\r\n\r\n";
}
}
if (isset($Axis[0])) {
if ($d_axis0_position == "left") {
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
} else {
$myData->setAxisPosition(0, AXIS_POSITION_RIGHT);
}
$myData->setAxisName(0, $d_axis0_name);
$myData->setAxisUnit(0, $d_axis0_unit);
if ($d_axis0_format == "AXIS_FORMAT_METRIC") {
$myData->setAxisDisplay(0, 680004);
}
if ($d_axis0_format == "AXIS_FORMAT_CURRENCY") {
$myData->setAxisDisplay(0, 680005, "\$");
}
if ($Mode == "Source") {
if ($d_axis0_position == "left") {
echo '$myData->setAxisPosition(0,AXIS_POSITION_LEFT);' . "\r\n";
} else {
示例11: temperatures_mois
function temperatures_mois()
{
//initialisation des variables tableau
$timestamp = "";
$temperature_dehors = "";
$temperature_chambre = "";
$hygro_chambre = "";
$temperature_sejour = "";
$hygro_sejour = "";
$pression_sejour = "";
$sql = mysql_query("SELECT TIMESTAMP( CONCAT( YEAR( date_histo ) , '-', MONTH( date_histo ) , '-', DAY( date_histo ) , ' ', HOUR( date_histo ) , ':00' ) ) , date_histo, id_objet, AVG( valeur1 ) , AVG( valeur2 ) , AVG( valeur3 ) \n\t\t\t\t\tFROM historique_donnees\n\t\t\t\t\tWHERE id_objet IN ( 1, 3, 4 ) \n\t\t\t\t\tAND date_histo > DATE_SUB(NOW( ), INTERVAL 31 DAY)\n\t\t\t\t\tGROUP BY YEAR( date_histo ) , MONTH( date_histo ) , DAY( date_histo ), HOUR( date_histo ), id_objet\n\t\t\t\t\tHAVING HOUR( date_histo ) IN ( 00, 06, 12, 18 ) \n\t\t\t\t\tORDER BY date_histo");
while (list($date_histo, $date_histo2, $id_objet, $temp, $hygro, $pression) = mysql_fetch_array($sql)) {
$timestamp[$date_histo] = strtotime($date_histo);
switch ($id_objet) {
case 1:
//chambre
$temperature_chambre[$date_histo] = $temp;
$hygro_chambre[$date_histo] = $hygro;
break;
case 3:
//dehors
$temperature_dehors[$date_histo] = $temp;
break;
case 4:
//sejour
$temperature_sejour[$date_histo] = $temp;
$hygro_sejour[$date_histo] = $hygro;
$pression_sejour[$date_histo] = $pression;
break;
}
}
//on garde les trous en cas de pertes d'informations
$temperature_chambre = combler_les_trous($timestamp, $temperature_chambre);
$hygro_chambre = combler_les_trous($timestamp, $hygro_chambre);
$temperature_dehors = combler_les_trous($timestamp, $temperature_dehors);
$temperature_sejour = combler_les_trous($timestamp, $temperature_sejour);
$hygro_sejour = combler_les_trous($timestamp, $hygro_sejour);
$pression_sejour = combler_les_trous($timestamp, $pression_sejour);
$myData = new pData();
$myData->addPoints($timestamp, "Timestamp");
$myData->addPoints($temperature_dehors, "T° Exterieure");
$myData->addPoints($temperature_sejour, "T° Séjour");
$myData->addPoints($temperature_chambre, "T° Chambre");
$myData->addPoints($hygro_chambre, "Hygro Chambre");
$myData->addPoints($hygro_sejour, "Hygro Séjour");
$myData->addPoints($pression_sejour, "Pression Atmo");
$myData->setSerieOnAxis("T° Exterieure", 0);
$myData->setSerieOnAxis("T° Séjour", 0);
$myData->setSerieOnAxis("T° chambre", 0);
$myData->setSerieOnAxis("Hygro Séjour", 1);
$myData->setSerieOnAxis("Hygro Chambre", 1);
$myData->setSerieTicks("Hygro Séjour", 4);
$myData->setSerieTicks("Hygro Chambre", 4);
$myData->setSerieOnAxis("Pression Atmo", 2);
$myData->setAbscissa("Timestamp");
$myData->setXAxisName("Time");
// $myData->setXAxisDisplay(AXIS_FORMAT_TIME,"H:i");
$myData->setXAxisDisplay(AXIS_FORMAT_TIME, "d/m");
//$myData->setXAxisDisplay(0,AXIS_FORMAT_CUSTOM,"format_absisse_jour");
$myData->setAxisName(0, "Temperatures en °C");
$myData->setAxisUnit(0, "°");
//temperature
$bornes_axe_ordonnees[0] = array("Min" => -8, "Max" => 35);
//humidite
$bornes_axe_ordonnees[1] = array("Min" => 30, "Max" => 90);
$myData->setAxisName(1, "Humidite");
$myData->setAxisUnit(1, "%");
$myData->setAxisName(2, "Pression Atmosphérique");
$myData->setAxisUnit(2, "HPa");
$myData->setAxisPosition(2, AXIS_POSITION_RIGHT);
$myPicture = new pImage(1250, 550, $myData);
//$Settings = array("R"=>48, "G"=>124, "B"=>183, "Dash"=>1, "DashR"=>68, "DashG"=>144, "DashB"=>203);
//$myPicture->drawFilledRectangle(0,0,1200,500,$Settings);
$Settings = array("StartR" => 48, "StartG" => 124, "StartB" => 183, "EndR" => 33, "EndG" => 86, "EndB" => 128, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 1250, 550, DIRECTION_VERTICAL, $Settings);
//$myPicture->drawRectangle(0,0,1199,499,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 18));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255);
$myPicture->drawText(350, 25, "Météo Nantaise", $TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(110, 50, 1160, 500);
$myPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$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" => 45, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL, "LabelSkip" => 3);
$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Config = "";
$myPicture->drawSplineChart($Config);
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/Forgotte.ttf", "FontSize" => 14, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
$myPicture->drawLegend(563, 16, $Config);
//$myPicture->stroke();
$myPicture->render("tmp/graphe_tm.png");
echo "<img src='tmp/graphe_tm.png' alt='graphe'/>";
}
示例12: makeChartArticle
static function makeChartArticle($type, $data, $events, $colors, $lang = "en")
{
global $wt, $I18N;
$font = PCHART_FONTS_PATH . "/LiberationSans-Regular.ttf";
if (in_array($wt->uselang, array("zh", "ja", "jp", "ko"))) {
$font = PCHART_FONTS_PATH . "/wqy-microhei.ttf";
}
if (in_array($wt->uselang, array("he", "bn", "vi", "fa", "ar", "th", "ta", "ka", "hi", "hy", "ml"))) {
$font = PCHART_FONTS_PATH . "/unifont.ttf";
}
$maxsizeTotal = 0;
$maxeditTotal = 0;
$u = 0;
foreach ($data as $year => $values) {
$years[] = $year;
$all[] = $values["all"];
$minor[] = $values["minor"];
$anon[] = $values["anon"];
$maxsize = 0;
//get the max size of each month
foreach ($values["months"] as $i => $mdetails) {
if ($mdetails["size"] > $maxsize) {
$maxsize = $mdetails["size"];
}
}
$tmpssize[] = $maxsize ? $maxsize : $tmpssize[$u - 1];
$linemarker[] = 1;
$eventmarker[] = isset($events[$year]["protect"]) ? 10 + $events[$year]["protect"] * 3 : 0;
$u++;
}
$msgAll = $I18N->msg('all');
$msgMinor = $I18N->msg('minor');
$msgPagesize = $I18N->msg('pagesize');
$MyData = new pData();
$MyData->addPoints($all, "all");
$MyData->addPoints($minor, "minor");
$MyData->addPoints($anon, "anon");
$MyData->addPoints($tmpssize, "size");
$MyData->addPoints($eventmarker, "protect");
$MyData->setSerieOnAxis("all", 0);
$MyData->setSerieOnAxis("minor", 0);
$MyData->setSerieOnAxis("anon", 0);
$MyData->setSerieOnAxis("size", 1);
$MyData->setSerieOnAxis("protect", 1);
$MyData->setAxisPosition(1, AXIS_POSITION_RIGHT);
$MyData->setAxisName(0, "Edits");
$MyData->setAxisName(1, "Size (kb)");
$MyData->Data["Series"]["all"]["Color"] = self::hex2rgb($colors["all"], 200, true);
$MyData->Data["Series"]["minor"]["Color"] = self::hex2rgb($colors["minor"], 200, true);
$MyData->Data["Series"]["anon"]["Color"] = self::hex2rgb($colors["anon"], 200, true);
$MyData->Data["Series"]["size"]["Color"] = self::hex2rgb($colors["size"], 200, true);
$MyData->Data["Series"]["protect"]["Color"] = self::hex2rgb($colors["protect"], 200, true);
$MyData->addPoints($years, "Labels");
$MyData->setAbscissa("Labels");
$myPicture = new pImage(1000, 300, $MyData, TRUE);
$myPicture->setFontProperties(array("FontName" => $font, "FontSize" => 12, "R" => 34, "G" => 34, "B" => 34));
$myPicture->setGraphArea(50, 30, 820, 270);
$myPicture->setFontProperties(array("FontName" => $font, "FontSize" => 8));
$scaleSettings = array("AxisR" => 134, "AxisG" => 134, "AxisB" => 134, "AxisAplha" => 40, "DrawSubTicks" => TRUE, "CycleBackground" => false, "LabelRotation" => 0, "LabelSkip" => 0, "Mode" => SCALE_MODE_START0);
$myPicture->drawScale($scaleSettings);
$settings = array("Surrounding" => -30, "InnerSurrounding" => 10, "RecordImageMap" => false, "DisplayValues" => false);
$MyData->setSerieDrawable('size', false);
$MyData->setSerieDrawable('protect', false);
$myPicture->drawBarChart($settings);
$MyData->setSerieDrawable('size', true);
$MyData->setSerieDrawable('all', false);
$MyData->setSerieDrawable('minor', false);
$MyData->setSerieDrawable('anon', false);
$MyData->setSerieDrawable('protect', false);
$myPicture->drawLineChart();
$MyData->setSerieDrawable('protect', true);
$MyData->setSerieDrawable('size', true);
$myBubbleChart = new pBubble($myPicture, $MyData);
$bubbleDataSeries = array("size");
$bubbleWeightSeries = array("protect");
$myBubbleChart->bubbleScale($bubbleDataSeries, $bubbleWeightSeries);
$myBubbleChart->drawBubbleChart($bubbleDataSeries, $bubbleWeightSeries, array("ForceAlpha" => true));
$myPicture->setFontProperties(array("FontName" => $font, "FontSize" => 11, "R" => 34, "G" => 34, "B" => 34));
$MyData->setSerieDrawable('size', true);
$MyData->setSerieDrawable('all', true);
$MyData->setSerieDrawable('minor', true);
$MyData->setSerieDrawable('anon', true);
$MyData->setSerieDrawable('protect', true);
$myPicture->drawLegend(900, 55, array("Style" => LEGEND_NOBORDER, "BoxWidth" => 10, "BoxHeight" => 10, "Mode" => LEGEND_VERTICAL));
ob_start();
imagepng($myPicture->Picture);
$imgdata = ob_get_contents();
ob_end_clean();
$rimg = "data:image/png;base64," . base64_encode($imgdata);
return $rimg;
}