Version 1.9g
This commit is contained in:
parent
d028822d0b
commit
4c9814a99c
800 changed files with 237325 additions and 1949 deletions
69
artichow/examples/test/error-box.php
Normal file
69
artichow/examples/test/error-box.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
require_once "../../Graph.class.php";
|
||||
|
||||
|
||||
$message = "Missing imageantialias() function.\nCheck your PHP installation.";
|
||||
|
||||
|
||||
$message = wordwrap($message, 48, "\n", TRUE);
|
||||
|
||||
$width = 400;
|
||||
$height = max(90, 50 + 13 * (substr_count($message, "\n") + 1));
|
||||
|
||||
$graph = new Graph($width, $height);
|
||||
|
||||
$driver = $graph->getDriver();
|
||||
|
||||
// Display title
|
||||
$driver->filledRectangle(
|
||||
new White,
|
||||
new Line(
|
||||
new Point(0, 0),
|
||||
new Point($width, $height)
|
||||
)
|
||||
);
|
||||
|
||||
$driver->filledRectangle(
|
||||
new Red,
|
||||
new Line(
|
||||
new Point(0, 0),
|
||||
new Point(110, 25)
|
||||
)
|
||||
);
|
||||
|
||||
$text = new Text(
|
||||
"Artichow error",
|
||||
new Font3,
|
||||
new White,
|
||||
0
|
||||
);
|
||||
|
||||
$driver->string($text, new Point(5, 6));
|
||||
|
||||
// Display red box
|
||||
$driver->rectangle(
|
||||
new Red,
|
||||
new Line(
|
||||
new Point(0, 25),
|
||||
new Point($width - 90, $height - 1)
|
||||
)
|
||||
);
|
||||
|
||||
// Display error image
|
||||
$image = new FileImage('error.png');
|
||||
$driver->copyImage($image, new Point($width - 81, $height - 81), new Point($width - 1, $height - 1));
|
||||
|
||||
// Draw message
|
||||
$text = new Text(
|
||||
$message,
|
||||
new Font2,
|
||||
new Black,
|
||||
0
|
||||
);
|
||||
|
||||
$driver->string($text, new Point(10, 40));
|
||||
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
BIN
artichow/examples/test/error.png
Normal file
BIN
artichow/examples/test/error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
37
artichow/examples/test/multi-line-text.php
Normal file
37
artichow/examples/test/multi-line-text.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
require_once "../../Graph.class.php";
|
||||
|
||||
$graph = new Graph(400, 600);
|
||||
|
||||
$driver = $graph->getDriver();
|
||||
|
||||
$driver->filledRectangle(
|
||||
new Red,
|
||||
new Line(
|
||||
new Point(200, 0),
|
||||
new Point(200, 600)
|
||||
)
|
||||
);
|
||||
|
||||
$text = new Text(
|
||||
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean gravida quam semper nibh. Sed orci. Aenean ullamcorper magna eget odio. Sed nonummy ante sit amet sapien.\nPhasellus nulla dui, aliquet vel, adipiscing vel, vulputate sed, velit.\nSed at neque vel ipsum commodo hendrerit.\nA. Nonyme",
|
||||
new Tuffy(mt_rand(10, 15)),
|
||||
new Color(mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100)),
|
||||
0
|
||||
);
|
||||
|
||||
$driver->string($text, new Point(0, 0), 200);
|
||||
|
||||
$text = new Text(
|
||||
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean gravida quam semper nibh. Sed orci. Aenean ullamcorper magna eget odio. Sed nonummy ante sit amet sapien.\nPhasellus nulla dui, aliquet vel, adipiscing vel, vulputate sed, velit.\nSed at neque vel ipsum commodo hendrerit.\nA. Nonyme",
|
||||
new Font(mt_rand(2, 4)),
|
||||
new Color(mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100)),
|
||||
0
|
||||
);
|
||||
|
||||
$driver->string($text, new Point(0, 400), 200);
|
||||
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
58
artichow/examples/test/set-label-text-error.php
Normal file
58
artichow/examples/test/set-label-text-error.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
require_once '../../BarPlot.class.php';
|
||||
|
||||
$graph = new Graph(600, 200);
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$values = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0);
|
||||
|
||||
$plot = new BarPlot($values);
|
||||
$plot->setBarColor(
|
||||
new Color(234, 236, 255)
|
||||
);
|
||||
$plot->setSpace(5, 5, NULL, NULL);
|
||||
|
||||
$plot->barShadow->setSize(3);
|
||||
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
|
||||
|
||||
$mois = array ('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc');
|
||||
$label = array ();
|
||||
foreach ($mois as $m) { $label []= $m; }
|
||||
$label []= ' ';
|
||||
foreach ($mois as $m) { $label []= $m; }
|
||||
|
||||
|
||||
$plot->xAxis->setLabelText($label);
|
||||
|
||||
/* ICI */
|
||||
|
||||
$max = array_max($values);
|
||||
$yValues = array();
|
||||
for($i=0; $i<= $max; $i++) {
|
||||
$yValues[]=$i;
|
||||
}
|
||||
$plot->yAxis->setLabelText($yValues);
|
||||
|
||||
// Image::drawError(var_export($yValues, TRUE));
|
||||
$plot->yAxis->setLabelText($yValues);
|
||||
|
||||
$plot->setPadding(30,5,20,15);
|
||||
|
||||
$labelAvant = new Label("2005");
|
||||
$labelAvant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12));
|
||||
$labelAvant->move (180,10);
|
||||
|
||||
$labelMaintenant = new Label("2006");
|
||||
$labelMaintenant->setFont (new TTFFont(ARTICHOW_FONT.'/TuffyBold.ttf', 12));
|
||||
$labelMaintenant->move (450,10);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->addLabel($labelAvant, 0, 0);
|
||||
$graph->addLabel($labelMaintenant, 0, 0);
|
||||
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue