本文整理汇总了PHP中PHPlot::EncodeImage方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::EncodeImage方法的具体用法?PHP PHPlot::EncodeImage怎么用?PHP PHPlot::EncodeImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::EncodeImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_case
function test_case($case)
{
global $cases, $test_verbose, $n_tests, $n_pass, $n_fail, $test_save;
$n_tests++;
extract($cases[$case]);
$title = "Test case {$n_tests}: {$data_type} (should match {$like})";
# Make a data array that is valid (but not necessarily reasonable)
# for any data type. One works for all except pie chart.
if (!empty($pie)) {
$plot_type = 'pie';
$data = array(array('', 1), array('', 1), array('', 2));
} else {
$plot_type = 'lines';
# Valid for text-data, data-data, and data-data-error:
$data = array(array('', 1, 2, 2, 2), array('', 2, 4, 1, 1), array('', 3, 5, 2, 2));
}
$p1 = new PHPlot(400, 300);
$p1->SetFailureImage(False);
$p1->SetPrintImage(False);
$p1->SetDataValues($data);
$p1->SetDataType($data_type);
// Alias data type
$p1->SetPlotType($plot_type);
$p1->DrawGraph();
$p1_image = $p1->EncodeImage('raw');
if ($test_save) {
file_put_contents("dta-{$case}a_{$data_type}.png", $p1_image);
}
$p2 = new PHPlot(400, 300);
$p2->SetFailureImage(False);
$p2->SetPrintImage(False);
$p2->SetDataValues($data);
$p2->SetDataType($like);
// Base data type - alias should match this
$p2->SetPlotType($plot_type);
$p2->DrawGraph();
$p2_image = $p2->EncodeImage('raw');
if ($test_save) {
file_put_contents("dta-{$case}b_{$like}.png", $p2_image);
}
if ($p1_image == $p2_image) {
$n_pass++;
if ($test_verbose) {
echo "Pass: {$title}\n";
}
} else {
$n_fail++;
echo "FAIL - Image Mismatch: {$title}\n";
}
}
示例2: PHPlot
$plot = new PHPlot(800, 600);
// Disable error images, since this script produces HTML:
$plot->SetFailureImage(False);
// Disable automatic output of the image:
$plot->SetPrintImage(False);
// Set up the rest of the plot:
$plot->SetTitle("'{$plot_type}' plot with image map");
$plot->SetImageBorderType('plain');
$plot->SetDataValues($data);
$plot->SetDataType($data_type);
$plot->SetPlotType($plot_type);
// Set the data_points callback which will generate the image map:
$plot->SetCallback('data_points', 'store_map');
// Produce the graph; this also creates the image map via callback:
$plot->DrawGraph();
$data_url = $plot->EncodeImage();
$html = <<<END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHPlot Example - Inline Image</title>
</head>
<body>
<h1>PHPlot Example - Inline Image</h1>
<map name="map1">
{$image_map}</map>
<p>This is a plot with image map and tooltip text.</p>
<img src="{$data_url}" alt="Plot Image" usemap="#map1">
</body>
</html>
示例3: mietvertraege
function plotfile_me($pdf, $mv_id, $w = 800, $h = 600)
{
$mvs = new mietvertraege();
$mvs->get_mietvertrag_infos_aktuell($mv_id);
$mk = new mietkonto();
$datum_mietdefinition = $mk->datum_1_mietdefinition($mv_id);
// echo "<h1>$datum_mietdefinition</h1>";
$a_dat = explode('-', $datum_mietdefinition);
$jahr_a = date("Y") - 2;
$jahr_e = date("Y") + 3;
$jahre = $jahr_e - $jahr_a;
$z = 0;
for ($jahr = $jahr_a; $jahr <= $jahr_e; $jahr++) {
$monat = date("m");
$mk->kaltmiete_monatlich($mv_id, $monat, $jahr);
if ($jahr > $jahr_a) {
$miete_vorjahr = $arr_stat[$z - 1][1];
$prozent = ($mk->ausgangs_kaltmiete - $miete_vorjahr) / ($miete_vorjahr / 100);
} else {
$prozent = 0;
}
$prozent = nummer_punkt2komma($prozent);
$arr_stat[$z][0] = "{$jahr}\n{$mk->ausgangs_kaltmiete}\nEUR\n{$prozent} %";
$arr_stat[$z][1] = $mk->ausgangs_kaltmiete;
$z++;
}
// print_r($arr_stat);
require_once 'phplot.php';
$plot = new PHPlot($w, $h);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($arr_stat);
// Main plot title:
$plot->SetTitle('MIETENTWICKLUNG' . " {$mvs->einheit_kurzname} \n {$mvs->personen_name_string}");
// No 3-D shading of the bars:
$plot->SetShading(0);
// Make a legend for the 3 data sets plotted:
// $plot->SetLegend(array('Mieteinnahmen', 'Leerstand'));
$plot->SetLegend(array('MIETE'));
// Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
// Draw it
$plot->SetIsInline(true);
$img = $plot->DrawGraph();
$px = 'px';
// echo "<hr>$plot->img ";
// $plot->PrintImageFrame();
// $hhh = $plot->PrintImage();
$ima = $plot->EncodeImage();
// echo "<a style=\"width:$w$px;heigth:$h$px;\" href=\"?option=stat_mv_big&mv_id=$mv_id\"><img style=\"width:$w$px;heigth:$h$px;\" src=\"$plot->img\"></img></a>";
// die();
// echo "<img src=\"$ima\">";
// die();
if ($mvs->mietvertrag_aktuell == 1) {
$pdf->ezNewPage();
$druckdatum = date("d.m.Y");
$pdf->addText(464, 730, 7, "<b>Druckdatum: {$druckdatum}</b>");
$pdf->addPngFromFile($ima, $pdf->x + 10, $pdf->y - $h, $w, $h);
}
}
示例4: PHPlot
} else {
$message .= $text;
}
if (!empty($extra_chars)) {
$message .= str_repeat(' Test', (int) ($extra_chars / 5));
}
$p = new PHPlot(800, 600);
if (!empty($use_gdfont)) {
$p->SetFontGD('generic', 5);
} elseif (!empty($use_ttfont)) {
$p->SetTTFPath($phplot_test_ttfdir);
$p->SetFontTTF('generic', $phplot_test_ttfonts['serifitalic'], 14);
}
if (!empty($set_bgcolor)) {
$p->SetBackgroundColor('yellow');
}
if (!empty($set_bgimage)) {
$p->SetBgImage('images/bubbles.png', 'tile');
}
if (!empty($set_border)) {
$p->SetImageBorderWidth(3);
$p->SetImageBorderColor('red');
$p->SetImageBorderType('raised');
}
if (!empty($noprint)) {
$p->SetPrintImage(False);
}
$p->DrawMessage($message, $options);
if (!empty($noprint)) {
echo $p->EncodeImage('raw');
}
示例5: sin
$plot->SetDataValues($data);
$plot->SetTitle('Line Plot, Sin and Cos - Embedded Image');
$plot->SetLegend(array('sin(t)', 'cos(t)'));
$plot->SetPlotAreaWorld(0, -1, 6.8, 1);
$plot->SetXDataLabelPos('none');
$plot->SetXTickIncrement(M_PI / 8.0);
$plot->SetXLabelType('data');
$plot->SetPrecisionX(3);
$plot->SetYTickIncrement(0.2);
$plot->SetYLabelType('data');
$plot->SetPrecisionY(1);
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
$plot->DrawGraph();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>PHPlot Example - Inline Image</title>
</head>
<body>
<h1>PHPlot Example - Inline Image</h1>
<p>This is a plot of sin() and cos().</p>
<img src="<?php
echo $plot->EncodeImage();
?>
" alt="Plot Image">
</body>
</html>
示例6: array
<?php
# $Id$
# PHPlot test: Return image encoded as raw
require_once 'phplot.php';
$data = array();
for ($i = 0; $i <= 360; $i += 15) {
$theta = deg2rad($i);
$data[] = array('', $i, cos($theta), sin($theta));
}
$p = new PHPlot(800, 600);
$p->SetPrintImage(False);
$p->SetFailureImage(False);
$p->SetTitle('PHPlot Test - Raw Image Encoding');
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(90);
$p->SetYTickIncrement(0.2);
$p->SetPlotAreaWorld(0, -1, 360, 1);
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
$p->SetPlotType('lines');
$p->DrawGraph();
$data = $p->EncodeImage('raw');
// fwrite(STDERR, "EncodeImage('raw') size = " . strlen($data) . "\n");
echo $data;
示例7: array
<?php
# $Id$
# PHPlot test: Return image encoded as base64
require_once 'phplot.php';
$data = array();
for ($i = 0; $i <= 360; $i += 15) {
$theta = deg2rad($i);
$data[] = array('', $i, cos($theta), sin($theta));
}
$p = new PHPlot(800, 600);
$p->SetPrintImage(False);
$p->SetFailureImage(False);
$p->SetTitle('PHPlot Test - Base64 Image Encoding');
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(90);
$p->SetYTickIncrement(0.2);
$p->SetPlotAreaWorld(0, -1, 360, 1);
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
$p->SetPlotType('lines');
$p->DrawGraph();
$data = base64_decode($p->EncodeImage('base64'), True);
if ($data === False) {
fwrite(STDERR, "Failed to decode data as base64\n");
exit(1);
}
echo $data;
示例8: sin
$p->SetPrintImage(False);
$p->SetFailureImage(False);
$p->SetTitle('PHPlot Test - Data URL Encoding');
$p->SetImageBorderType('plain');
$p->SetImageBorderWidth(4);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(90);
$p->SetYTickIncrement(0.2);
$p->SetPlotAreaWorld(0, -1, 360, 1);
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
$p->SetPlotType('lines');
$p->DrawGraph();
$data_url = $p->EncodeImage();
$html = <<<END
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Testing Data URL Inline PHPlot</title>
</head>
<body>
<h1>Inline Image</h1>
<p>This is a plot of sin() and cos().
<p><img src="{$data_url}" alt="Plot Image">
</body>
</html>
END;
示例9: sprintf
//.........这里部分代码省略.........
$arr = $this->leerstand_finden_monat($objekt_id, $datum_vormonat);
$anz_leer_vormonat = count($arr);
// unset($arr);
$arr_leer = $this->leerstand_finden_monat($objekt_id, $datum_heute);
$anz_leer_akt = count($arr_leer);
$anz_vermietet = $anz_einheiten_alle - $anz_leer_akt;
$leere = $this->array_intersect_recursive($arr_leer, $arr, 'EINHEIT_KURZNAME');
$vermietete = $this->array_intersect_recursive($arr, $arr_leer, 'EINHEIT_KURZNAME');
$leer_akt_string = '';
$anz__L = count($leere);
if ($anz__L > 0) {
for ($ee = 0; $ee < $anz__L; $ee++) {
$leer_akt_string .= $leere[$ee] . "\n";
}
}
$vermietet_akt_string = '';
$anz__V = count($vermietete);
// print_r($vermietete);
if ($anz__V > 0) {
for ($ee = 0; $ee < $anz__V; $ee++) {
$vermietet_akt_string .= $vermietete[$ee] . "\n";
}
}
// unset($arr);
/*
* $mvs = new mietvertraege;
* $anz_ausgezogene = $mvs->anzahl_ausgezogene_mieter($objekt_id, $jahr, $monat);
* $anz_eingezogene = $mvs->anzahl_eingezogene_mieter($objekt_id, $jahr, $monat);
*/
$bilanz_akt = $anz__V - $anz__L;
// 0-1 = -1;
$z = 0;
/*
* $data[$z][] = "ALLE\nAKTUELL";
* $data[$z][] = $anz_einheiten_alle;
*
* $data[$z][] = 0;
* $data[$z][] = 0;
*
*/
// $z++;
/*
* $data[$z][] = "LEER\nVERM.";
* $data[$z][] = 0;
* $data[$z][] = $anz_vermietet;
* $data[$z][] = $anz_leer_akt;
*/
$data[$z][] = "VOR-\nMONAT";
$data[$z][] = 0;
$data[$z][] = $anz_leer_vormonat;
$z++;
$data[$z][] = "LEER-\nAKTUELL";
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = $anz_leer_akt;
$z++;
$data[$z][] = "LEER\n\n{$leer_akt_string}";
$data[$z][] = '0';
$data[$z][] = '0';
$data[$z][] = $anz__L;
$z++;
$data[$z][] = "VERM.\n\n{$vermietet_akt_string}";
$data[$z][] = '0';
$data[$z][] = $anz__V;
$z++;
$data[$z][] = "BILANZ\nEIN/AUS";
if ($bilanz_akt < 0) {
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = $bilanz_akt;
} else {
$data[$z][] = 0;
$data[$z][] = $bilanz_akt;
}
// $z++;
$plot->SetYDataLabelPos('plotstack');
$plot->SetDataValues($data);
// Main plot title:
$plot->SetTitle("{$oo->objekt_kurzname} {$monat}/{$jahr}");
// No 3-D shading of the bars:
$plot->SetShading(0);
// Make a legend for the 3 data sets plotted:
// $plot->SetLegend(array('Mieteinnahmen', 'Leerstand'));
// $plot->SetLegend(array('MIETE'));
// Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
// Draw it
$plot->SetIsInline(true);
$plot->DrawGraph();
// echo "<hr>$plot->img ";
// $plot->PrintImageFrame();
// $ima = $plot->PrintImage();
$ima = $plot->EncodeImage();
// ob_clean();
return $ima;
// echo "<img src=\"$ima\"></img>";
}