本文整理汇总了PHP中pImage::drawSplineChart方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawSplineChart方法的具体用法?PHP pImage::drawSplineChart怎么用?PHP pImage::drawSplineChart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::drawSplineChart方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: array
$myPicture->initialiseImageMap("ImageMapSplineChart", IMAGE_MAP_STORAGE_FILE, "SplineChart", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
/* 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" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$Settings = array("RecordImageMap" => TRUE);
$myPicture->drawSplineChart($Settings);
$myPicture->drawPlotChart(array("PlotBorder" => TRUE, "PlotSize" => 3, "BorderSize" => 1, "Surrounding" => -60, "BorderAlpha" => 80));
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("../tmp/SplineChart.png");
示例3: array
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Settings = array("Mode" => SCALE_MODE_FLOATING, "DrawSubTicks" => TRUE, "DrawArrows" => TRUE, "ArrowSize" => 6, "Pos" => SCALE_POS_LEFTRIGHT, "LabelSkip" => 0, "SkippedInnerTickWidth" => 10, "LabelingMethod" => LABELING_ALL, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 20, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 20, "LabelRotation" => 90, "DrawXLines" => 1, "DrawSubTicks" => 0, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 20, "DrawYLines" => ALL);
$myPicture->drawScale($Settings);
$Config = array("DisplayValues" => 0, "AroundZero" => 0, "BreakVoid" => 1, "RecordImageMap" => FALSE);
$GraphType = 'SplineChart';
switch ($GraphType) {
case 'AreaChart':
$myPicture->drawAreaChart($Config);
break;
case 'FilledSplineChart':
$myPicture->drawFilledSplineChart($Config);
break;
case 'SplineChart':
$myPicture->drawSplineChart($Config);
break;
case 'BarChart':
$myPicture->drawBarChart($Config, 'tetimes');
break;
case 'StackedBarChart':
$myPicture->drawStackedBarChart($Config);
break;
case 'PlotChart':
$myPicture->drawPlotChart($Config);
break;
default:
break;
}
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL);
$myPicture->drawLegend($Graphwidth - 65, 40, $Config);
示例4: pData
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(2, 7, 5, 18, 19, 22, 23, 25, 22, 12, 10, 10), "DEFCA");
$MyData->setAxisName(0, "\$ Incomes");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY);
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA", array("R" => 55, "G" => 91, "B" => 127));
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(60, 35, "2k9 Average Incomes", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60, 40, 670, 190);
$myPicture->drawFilledRectangle(60, 40, 670, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("GridR" => 180, "GridG" => 180, "GridB" => 180));
/* Draw a spline chart on top */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawFilledSplineChart();
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawSplineChart();
$myPicture->setShadow(FALSE);
/* Write the chart legend */
$myPicture->drawLegend(643, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawSimple.png");
示例5: pImage
$data->setXAxisName("Zeit");
// Create the pChart object
$picture = new pImage($width, $height, $data);
// $picture->Antialias = false;
// Draw the background
$Settings = array("R" => 00, "G" => 250, "B" => 250, "Dash" => 1, "DashR" => 0, "DashG" => 0, "DashB" => 0);
$picture->drawFilledRectangle(0, 0, $width, $height, $Settings);
// Overlay with a gradient
$Settings = array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 0, "EndG" => 0, "EndB" => 0, "Alpha" => 100);
$picture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
// Add a border to the picture
$picture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
// title
$picture->setFontProperties(array("FontName" => $fontText, "FontSize" => 14, "R" => 255, "G" => 255, "B" => 255));
// $picture->drawText(60,25,$title, array("FontSize"=>20));
$picture->drawText(70, 25, strftime("%d. %b %Y", $from) . " -> " . strftime(" %d. %b %Y %H:%M", $to), array("FontSize" => 18));
// scale
$picture->setGraphArea(70, 30, $width, $height - 100);
$picture->drawFilledRectangle(70, 30, $width, $height - 100, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 5));
$picture->drawScale(array("LabelingMethod" => LABELING_DIFFERENT, "DrawSubTicks" => false, "MinDivHeight" => $Div, "LabelSkip" => $skipTicks, "DrawXLines" => $XLines, "LabelRotation" => 45, "RemoveSkippedAxis" => TRUE));
// $picture->setShadow(true, array("X"=>1, "Y"=>1, "R"=>0, "G"=>0, "B"=>0, "Alpha"=>10));
$picture->setFontProperties(array("FontName" => $fontScale, "FontSize" => 6, "R" => 0, "G" => 0, "B" => 0));
$picture->drawSplineChart(array("DisplayValues" => false, "DisplayColor" => DISPLAY_AUTO));
// $picture->drawLineChart(array("DisplayValues"=>false,"DisplayColor"=>DISPLAY_AUTO));
$picture->setShadow(false);
$picture->drawLegend(75, $height - $height + 45, array("Style" => LEGEND_ROUND, "Family" => LEGEND_FAMILY_CIRCLE, "Mode" => LEGEND_HORIZONTAL, "FontSize" => 11));
$cache->writeToCache($chartHash, $picture);
$picture->Stroke();
}
$dd = time() - $start;
syslog(LOG_DEBUG, "p4: --------- done in {$dd} seconds");
示例6: 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();
}
示例7: array
$Test->drawText($left_border, $title_top_offset, $p, array("FontSize" => $title_fontsize, "R" => 55, "G" => 55, "B" => 55, "Align" => TEXT_ALIGN_BOTTOMLEFT));
}
} else {
if ($_GET['title']) {
$Test->drawText($left_border, $title_top_offset, $_GET['title'], array("FontSize" => $title_fontsize, "R" => 250, "G" => 250, "B" => 250, "Align" => TEXT_ALIGN_BOTTOMLEFT));
} else {
$Test->drawText($left_border, $title_top_offset, $p, array("FontSize" => $title_fontsize, "R" => 250, "G" => 250, "B" => 250, "Align" => TEXT_ALIGN_BOTTOMLEFT));
}
}
// рисуем график
if ($_GET['gtype'] == 'curve') {
//рисуем сглаженый график
//$Test->drawCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription());
//$Test->clearShadow();
//$Test->drawFilledCubicCurve($DataSet->GetData(),$DataSet->GetDataDescription(),.1,30, FALSE);
$Test->drawSplineChart(array("DisplayValues" => FALSE, "BreakVoid" => FALSE, "VoidTicks" => 0, "DisplayColor" => DISPLAY_AUTO));
$Test->drawAreaChart(array("AroundZero" => FALSE));
// заполнение снизу до кривой графика
// $Test->drawAreaChart(array("AroundZero"=>TRUE)); // заполнение от нуля до кривой графика
} elseif ($_GET['gtype'] == 'bar') {
//рисуем столбы
//$Test->drawFilledRectangle(60,60,450,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
//$Test->drawScale(array("DrawSubTicks"=>TRUE));
$Test->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
//$Test->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
$Test->drawBarChart(array("DisplayValues" => FALSE, "Interleave" => 0.2, "Gradient" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => FALSE, "AroundZero" => TRUE, "Surrounding" => 0));
} else {
//рисуем прямолинейный график
//$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
//$Test->clearShadow();
//$Test->drawFilledLineGraph($DataSet->GetData(),$DataSet->GetDataDescription(), 30);
示例8: electrique_mois
function electrique_mois()
{
//initialisation des variables tableau
$timestamp = "";
$conso = "";
$sql = mysql_query("SELECT TIMESTAMP(CONCAT(YEAR(date_histo ),'-',MONTH(date_histo ),'-',DAY(date_histo ),' ',HOUR(date_histo ),':00')),\n\t\t\t\t\tdate_histo, AVG(valeur1),MAX(valeur1),MIN(valeur1)\n\t\t\t\t\tFROM historique_donnees\n\t\t\t\t\tWHERE id_objet = 2\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, $conso_sql, $conso_sql_max, $conso_sql_min) = mysql_fetch_array($sql)) {
$timestamp[] = strtotime($date_histo);
$conso[] = $conso_sql;
$conso_max[] = $conso_sql_max;
$conso_min[] = $conso_sql_min;
}
$myData = new pData();
$myData->addPoints($timestamp, "Timestamp");
$myData->addPoints($conso, "Consommation Instantanée Moyenne");
$myData->addPoints($conso_max, "Conso. Inst. Max");
$myData->addPoints($conso_min, "Conso. Inst. Min");
$myData->setSerieOnAxis("Consommation Instantanée", 0);
$myData->setSerieOnAxis("Conso. Inst. Max", 0);
$myData->setSerieOnAxis("Conso. Inst. Min", 0);
$myData->setAbscissa("Timestamp");
$myData->setXAxisName("Time");
$myData->setXAxisDisplay(AXIS_FORMAT_TIME, "d/m");
$myData->setAxisName(0, "Consommation Instantanée");
$myData->setAxisUnit(0, "W");
$myPicture = new pImage(1250, 550, $myData);
$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->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, "Consommation éléctrique", $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->render("tmp/graphe_em.png");
echo "<img src='tmp/graphe_em.png' alt='graphe'/>";
}
示例9: array
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawSplineChart() - draw a spline chart", array("R" => 255, "G" => 255, "B" => 255));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(250, 55, "Average temperature", 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" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawSplineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
$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->drawSplineChart();
$myPicture->setShadow(FALSE);
/* Write the chart legend */
$myPicture->drawLegend(510, 205, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawSplineChart.png");
示例10: array
$scaleSettings = array("XMargin" => 10, "YMargin" => 0, "Floating" => FALSE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "LabelSkip" => 0, "Pos" => SCALE_POS_TOPBOTTOM, "MinDivHeight" => 50, "Mode" => SCALE_MODE_START0);
$format = array("DisplayPos" => LABEL_POS_OUTSIDE, "DisplayValues" => TRUE, "DisplayR" => 50, "DisplayG" => 50, "DisplayB" => 50, "Gradient" => TRUE, "GradientStartR" => 181, "GradientStartG" => 200, "GradientStartB" => 236, "GradientEndR" => 66, "GradientEndG" => 116, "GradientEndB" => 207, "GradientAlpha" => 100);
$myPicture->setGraphArea(180, 55, 760, $height - 20);
}
$myPicture->setFontProperties(array("FontName" => "../pChart/fonts/VeraMoBd.ttf", "FontSize" => 12));
$myPicture->Antialias = TRUE;
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawText(15, 15, $title, array("FontSize" => 11, "Align" => TEXT_ALIGN_TOPLEFT));
$myPicture->setShadow(FALSE);
$myPicture->Antialias = FALSE;
$myPicture->setFontProperties(array("FontName" => "../pChart/fonts/Minecraftia.ttf", "FontSize" => 6));
$myPicture->drawText(792, 7, $explanation, array("R" => 100, "G" => 100, "B" => 100, "Align" => TEXT_ALIGN_TOPRIGHT));
$myPicture->drawScale($scaleSettings);
if ($subtitle != '') {
$myPicture->setFontProperties(array("FontName" => "../pChart/fonts/Minecraftia.ttf", "FontSize" => 6));
$myPicture->drawText(16, 33, $subtitle, array("R" => 100, "G" => 100, "B" => 100, "Align" => TEXT_ALIGN_TOPLEFT));
}
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->Antialias = TRUE;
if ($type == 1) {
$myPicture->drawLegend(340, 20, array("R" => 240, "G" => 240, "B" => 240, "Mode" => LEGEND_HORIZONTAL, "Style" => LEGEND_BOX));
$myPicture->drawSplineChart($format);
} elseif ($type == 3) {
$myPicture->drawSplineChart($format);
} else {
$myPicture->setFontProperties(array("FontName" => "../pChart/fonts/verdana.ttf", "FontSize" => 5));
$myPicture->drawBarChart($format);
}
$myPicture->setShadow(FALSE);
$myPicture->Antialias = FALSE;
$myPicture->Stroke();
示例11: transferGraph
function transferGraph($queryInfo, $uid = 0, $label) {
global $db, $MyData, $query, $info, $myCache;
function YFormat($size) {
if ($size > (1024*1024)) {
return round($size/1024/1024, 0).' MB';
} else {
return round($size/1014, 0).' KB/s';
}
}
calculatePoints($query, $queryInfo, 'tx', "Transmitted", "/s", true);
$query->execute();
calculatePoints($query, $queryInfo, 'rx', "Received", "/s", false);
$MyData->loadPalette("pchart/palettes/openstatus.color", TRUE);
$MyData->setSerieDescription("Labels","Time");
$MyData->setAbscissa("Labels");
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME, $queryInfo[3]);
$MyData->setAxisDisplay(0, AXIS_FORMAT_CUSTOM, "YFormat");
$MyData->setAxisName(0, "");
$myPicture = new pImage(700,230,$MyData);
$ChartHash = $myCache->getHash($MyData);
if ($myCache->isInCache($ChartHash)) {
$myCache->strokeFromCache($ChartHash);
} else {
$myPicture->Antialias = TRUE;
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setFontProperties(array("FontName"=>"pchart/fonts/calibri.ttf","FontSize"=>11));
$myPicture->drawText(350,35, $label." - ".$queryInfo[1],array("FontSize"=>14,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
$myPicture->drawText(350,15,"Server: ".$info['hostname'], array("FontSize"=>14, "Align"=>TEXT_ALIGN_MIDDLEMIDDLE));
$myPicture->setFontProperties(array("FontName"=>"pchart/fonts/calibri.ttf","FontSize"=>8));
$myPicture->setGraphArea(60,40,650,200);
if ($MyData->getMax("Transmitted") > $MyData->getMax("Received")) {
$scalemax = ceil($MyData->getMax("Transmitted") / 1024) * 1024;
} else {
$scalemax = ceil($MyData->getMax("Received") / 1024) * 1024;
}
if ($scalemax < 5) {
$scalemax = 5;
}
$AxisBoundaries = array(0=>array("Min"=>0,"Max"=>$scalemax));
$scaleSettings = array(
"XMargin"=>10,
"YMargin"=>10,
"Floating"=>TRUE,
"CycleBackground"=>FALSE,
"LabelSkip"=>$queryInfo[2],
"Mode"=>SCALE_MODE_MANUAL,
"ManualScale"=>$AxisBoundaries,
"DrawSubTicks"=>TRUE,
"SkippedTickAlpha"=>0,
"SubTickR"=>0,
"SubTickG"=>0,
"SubTickB"=>0
);
$myPicture->drawLegend(510,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
$myPicture->drawScale($scaleSettings);
$myPicture->drawSplineChart(array("BreakVoid"=>TRUE, "BreakR"=>255, "BreakG"=>255, "BreakB"=>255));
$myCache->writeToCache($ChartHash,$myPicture);
}
$myPicture->autoOutput("cache/".$info['uid']."/transfer-".$queryInfo[4].".png");
}