forked from halo-battle/game
Version 1.9g
This commit is contained in:
parent
d028822d0b
commit
4c9814a99c
800 changed files with 237325 additions and 1949 deletions
80
artichow/examples/site/bar-001.php
Normal file
80
artichow/examples/site/bar-001.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(280, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
1, 2, 5, 0.5, 3, 8, 6
|
||||
);
|
||||
|
||||
$plot = new BarPlot($x);
|
||||
|
||||
$plot->setSpace(4, 4, 10, 0);
|
||||
$plot->setPadding(40, 15, 10, 40);
|
||||
|
||||
$plot->title->set("Zoé and friends");
|
||||
$plot->title->setFont(new TuffyBold(11));
|
||||
$plot->title->border->show();
|
||||
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
|
||||
$plot->title->setPadding(4, 4, 4, 4);
|
||||
$plot->title->move(-20, 25);
|
||||
|
||||
$plot->yAxis->title->set("Axe des Y");
|
||||
$plot->yAxis->title->setFont(new TuffyBold(10));
|
||||
$plot->yAxis->title->move(-4, 0);
|
||||
$plot->yAxis->setTitleAlignment(Label::TOP);
|
||||
|
||||
$plot->xAxis->title->set("Axe des X");
|
||||
$plot->xAxis->title->setFont(new TuffyBold(10));
|
||||
$plot->xAxis->setTitleAlignment(Label::RIGHT);
|
||||
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(230, 230, 230),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$plot->barBorder->setColor(new Color(0, 0, 150, 20));
|
||||
|
||||
$plot->setBarGradient(
|
||||
new LinearGradient(
|
||||
new Color(150, 150, 210, 0),
|
||||
new Color(230, 230, 255, 30),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$y = array(
|
||||
'Zoé',
|
||||
'Yvan',
|
||||
'Fred',
|
||||
'Lucie',
|
||||
'Ilia',
|
||||
'Nino',
|
||||
'Marie'
|
||||
);
|
||||
|
||||
$plot->xAxis->setLabelText($y);
|
||||
$plot->xAxis->label->setFont(new TuffyBold(7));
|
||||
|
||||
$graph->shadow->setSize(4);
|
||||
$graph->shadow->setPosition(Shadow::LEFT_TOP);
|
||||
$graph->shadow->smooth(TRUE);
|
||||
$graph->shadow->setColor(new Color(160, 160, 160));
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
80
artichow/examples/site/bar-002.php
Normal file
80
artichow/examples/site/bar-002.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
$graph = new Graph(280, 280);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setSpace(6, 6, 5, 5);
|
||||
$group->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(235, 235, 235),
|
||||
new White(),
|
||||
0
|
||||
)
|
||||
);
|
||||
$group->setPadding(40, 10, 10, 50);
|
||||
|
||||
$group->axis->left->setLabelPrecision(2);
|
||||
$group->axis->bottom->label->hide(TRUE);
|
||||
$group->axis->bottom->hideTicks(TRUE);
|
||||
|
||||
$group->grid->setType(Line::DASHED);
|
||||
$group->grid->hideHorizontal(TRUE);
|
||||
|
||||
$gradients = array(
|
||||
new LinearGradient(
|
||||
new Color(30, 30, 160, 10), new Color(120, 120, 160, 10), 0
|
||||
),
|
||||
new LinearGradient(
|
||||
new Color(30, 160, 30, 10), new Color(120, 160, 120, 10), 0
|
||||
),
|
||||
new LinearGradient(
|
||||
new Color(160, 30, 30, 10), new Color(160, 120, 120, 10), 0
|
||||
)
|
||||
);
|
||||
|
||||
for($n = 0; $n < 3; $n++) {
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 6; $i++) {
|
||||
$x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 900) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0);
|
||||
}
|
||||
|
||||
$plot = new BarPlot($x, $n + 1, 3);
|
||||
|
||||
$plot->setXAxis(Plot::BOTTOM);
|
||||
|
||||
$plot->barShadow->setSize(1);
|
||||
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(160, 160, 160, 10));
|
||||
|
||||
$plot->barBorder->setColor($gradients[$n]->from);
|
||||
|
||||
$plot->setBarGradient($gradients[$n]);
|
||||
|
||||
$plot->setBarSpace(2);
|
||||
|
||||
$group->legend->add($plot, 'Bar#'.($n + 1), Legend::BACKGROUND);
|
||||
|
||||
$group->add($plot);
|
||||
|
||||
}
|
||||
|
||||
$group->legend->setModel(Legend::MODEL_BOTTOM);
|
||||
$group->legend->setPosition(NULL, 0.86);
|
||||
$group->legend->shadow->hide();
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
73
artichow/examples/site/bar-003.php
Normal file
73
artichow/examples/site/bar-003.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
function color($a = NULL) {
|
||||
if($a === NULL) {
|
||||
$a = 0;
|
||||
}
|
||||
return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);
|
||||
}
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
$graph->border->hide();
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setSpace(5, 10, 20, 15);
|
||||
$group->setPadding(40, 10, NULL, 20);
|
||||
$group->setXAxisZero(FALSE);
|
||||
|
||||
$group->axis->left->setLabelPrecision(2);
|
||||
|
||||
$colors = array(
|
||||
new Color(100, 180, 154, 12),
|
||||
new Color(100, 154, 180, 12),
|
||||
new Color(154, 100, 180, 12),
|
||||
new Color(180, 100, 154, 12)
|
||||
);
|
||||
|
||||
for($n = 0; $n < 4; $n++) {
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 6; $i++) {
|
||||
$x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 1400) / 1000 - 0.5);
|
||||
}
|
||||
|
||||
$plot = new BarPlot($x, 1, 1, (3 - $n) * 7);
|
||||
$plot->barBorder->setColor(new Color(0, 0, 0));
|
||||
|
||||
$plot->setBarSize(0.54);
|
||||
|
||||
$plot->barShadow->setSize(3);
|
||||
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(160, 160, 160, 10));
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
|
||||
$plot->setBarColor($colors[$n]);
|
||||
|
||||
$group->add($plot);
|
||||
$group->legend->add($plot, "Barre #".$n, Legend::BACKGROUND);
|
||||
|
||||
}
|
||||
|
||||
$group->legend->shadow->setSize(0);
|
||||
$group->legend->setAlign(Legend::CENTER);
|
||||
$group->legend->setSpace(6);
|
||||
$group->legend->setTextFont(new Tuffy(8));
|
||||
$group->legend->setPosition(0.50, 0.12);
|
||||
$group->legend->setBackgroundColor(new Color(255, 255, 255, 25));
|
||||
$group->legend->setColumns(2);
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
92
artichow/examples/site/bar-004.php
Normal file
92
artichow/examples/site/bar-004.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
function labelFormat($value) {
|
||||
return round($value, 2);
|
||||
}
|
||||
|
||||
$graph = new Graph(280, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setSpace(5, 5, 15, 0);
|
||||
$group->setPadding(40, 40);
|
||||
|
||||
$group->axis->left->setLabelPrecision(2);
|
||||
$group->axis->right->setLabelPrecision(2);
|
||||
|
||||
$colors = array(
|
||||
new Color(80, 105, 190, 10),
|
||||
new Color(105, 190, 80, 10)
|
||||
);
|
||||
|
||||
$darkColor = array(
|
||||
new Color(40, 55, 120, 10),
|
||||
new Color(55, 120, 40, 10)
|
||||
);
|
||||
|
||||
$axis = array(
|
||||
Plot::LEFT,
|
||||
Plot::RIGHT
|
||||
);
|
||||
|
||||
$group->axis->left->setColor($darkColor[0]);
|
||||
$group->axis->left->label->setColor($darkColor[0]);
|
||||
$group->axis->right->setColor($darkColor[1]);
|
||||
$group->axis->right->label->setColor($darkColor[1]);
|
||||
|
||||
$group->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(225, 225, 225),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
for($n = 0; $n < 2; $n++) {
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 4; $i++) {
|
||||
$x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * (($n%2) ? -0.5 : 1) + (($n%2) ? -0.4 : 0) + 1;
|
||||
}
|
||||
|
||||
$plot = new BarPlot($x, $n+1, 2);
|
||||
$plot->barBorder->setColor(new Color(0, 0, 0, 30));
|
||||
|
||||
$plot->setBarPadding(0.1, 0.1);
|
||||
$plot->setBarSpace(5);
|
||||
|
||||
$plot->barShadow->setSize(3);
|
||||
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
|
||||
$plot->label->set($x);
|
||||
$plot->label->move(0, -6);
|
||||
$plot->label->setFont(new Tuffy(7));
|
||||
$plot->label->setAngle(90);
|
||||
$plot->label->setAlign(NULL, Label::TOP);
|
||||
$plot->label->setPadding(3, 1, 0, 6);
|
||||
$plot->label->setCallbackFunction("labelFormat");
|
||||
|
||||
$plot->setBarColor($colors[$n]);
|
||||
|
||||
$plot->setYAxis($axis[$n]);
|
||||
|
||||
$group->add($plot);
|
||||
|
||||
}
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
82
artichow/examples/site/bar-005.php
Normal file
82
artichow/examples/site/bar-005.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
$graph->border->hide();
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->grid->hide(TRUE);
|
||||
$group->setSpace(2, 2, 20, 0);
|
||||
$group->setPadding(30, 10, NULL, NULL);
|
||||
|
||||
$colors = array(
|
||||
new Orange(25),
|
||||
new LightBlue(10)
|
||||
);
|
||||
|
||||
for($n = 0; $n < 2; $n++) {
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 3 - $n * 3; $i++) {
|
||||
$x[] = NULL;
|
||||
}
|
||||
|
||||
for($i = 3 - ($n * 3); $i < 12 - ($n * 3); $i++) {
|
||||
$x[] = cos($i * M_PI / 100) * mt_rand(800, 1200) / 1000 * (((1 - $n) * 5 + 10) / 10);
|
||||
}
|
||||
|
||||
for($i = 0; $i < $n * 3; $i++) {
|
||||
$x[] = NULL;
|
||||
}
|
||||
|
||||
$plot = new BarPlot($x, 1, 1, (1 - $n) * 6);
|
||||
|
||||
// $plot->setBarPadding(2, 2);
|
||||
|
||||
$plot->barShadow->setSize(2);
|
||||
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
|
||||
$plot->barShadow->setColor(new Color(160, 160, 160, 10));
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
|
||||
$plot->setBarColor($colors[$n]);
|
||||
|
||||
$group->add($plot);
|
||||
$group->legend->add($plot, $n + date('Y'), Legend::BACKGROUND);
|
||||
|
||||
}
|
||||
|
||||
function setPc($value) {
|
||||
return round($value * 10).'%';
|
||||
}
|
||||
|
||||
$group->axis->left->label->setCallbackFunction('setPc');
|
||||
|
||||
$months = array(
|
||||
"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
|
||||
);
|
||||
|
||||
$group->axis->bottom->setLabelText($months);
|
||||
$group->axis->bottom->hideTicks(TRUE);
|
||||
|
||||
$group->legend->shadow->setSize(0);
|
||||
$group->legend->setAlign(Legend::CENTER);
|
||||
$group->legend->setSpace(6);
|
||||
$group->legend->setTextFont(new Tuffy(8));
|
||||
$group->legend->setPosition(0.50, 0.10);
|
||||
$group->legend->setBackgroundColor(new Color(255, 255, 255, 25));
|
||||
$group->legend->setColumns(2);
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
68
artichow/examples/site/canvas-001.php
Normal file
68
artichow/examples/site/canvas-001.php
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
require_once "../../Graph.class.php";
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$driver = $graph->getDriver();
|
||||
|
||||
$driver->filledRectangle(
|
||||
new Color(230, 230, 230, 0),
|
||||
new Line(
|
||||
new Point(10, 10),
|
||||
new Point(200, 150)
|
||||
)
|
||||
);
|
||||
|
||||
for($i = 7; $i < 400; $i += 15) {
|
||||
$driver->line(
|
||||
new Color(0, 0, 0),
|
||||
new Line(
|
||||
new Point($i, 0 + 50),
|
||||
new Point($i, 30 + 50)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
for($i = 7; $i < 30; $i += 15) {
|
||||
$driver->line(
|
||||
new Color(0, 0, 0),
|
||||
new Line(
|
||||
new Point(0, $i + 50),
|
||||
new Point(400, $i + 50)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$driver->filledRectangle(
|
||||
new Color(0, 100, 200, 50),
|
||||
new Line(
|
||||
new Point(100, 100),
|
||||
new Point(280, 180)
|
||||
)
|
||||
);
|
||||
|
||||
$debut = new Color(230, 250, 0);
|
||||
$fin = new Color(255, 255, 255, 100);
|
||||
|
||||
$driver->filledEllipse(
|
||||
new RadialGradient(
|
||||
$debut,
|
||||
$fin
|
||||
),
|
||||
new Point(105, 135),
|
||||
90, 90
|
||||
);
|
||||
|
||||
$text = new Text(
|
||||
"Artichow !",
|
||||
new Tuffy(15),
|
||||
new Color(0, 0, 80),
|
||||
45
|
||||
);
|
||||
|
||||
$driver->string($text, new Point(210, 75));
|
||||
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
36
artichow/examples/site/impulse-001.php
Normal file
36
artichow/examples/site/impulse-001.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
require_once "../../ScatterPlot.class.php";
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$graph->title->set('Impulses');
|
||||
$graph->shadow->setSize(4);
|
||||
|
||||
$y = array();
|
||||
for($i = 0; $i < 40; $i++) {
|
||||
$y[] = cos($i / 15 * 2 * M_PI) / (0.8 + $i / 15) * 4;
|
||||
}
|
||||
|
||||
$plot = new ScatterPlot($y);
|
||||
$plot->setPadding(25, 15, 35, 15);
|
||||
$plot->setBackgroundColor(new Color(230, 230, 255));
|
||||
$plot->setSpace(2, 2);
|
||||
|
||||
// Set impulses
|
||||
$plot->setImpulse(new DarkBlue);
|
||||
|
||||
$plot->grid->hideVertical();
|
||||
$plot->grid->setType(Line::DASHED);
|
||||
|
||||
// Hide ticks
|
||||
$plot->xAxis->hideTicks();
|
||||
$plot->xAxis->label->hide();
|
||||
|
||||
$plot->mark->setType(Mark::SQUARE);
|
||||
$plot->mark->setSize(4);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
71
artichow/examples/site/line-001.php
Normal file
71
artichow/examples/site/line-001.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
3, 1, 5, 6, 3, 8, 6
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
|
||||
$plot->grid->setNoBackground();
|
||||
|
||||
$plot->title->set("Filled line and marks");
|
||||
$plot->title->setFont(new Tuffy(10));
|
||||
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
|
||||
$plot->title->border->show();
|
||||
$plot->title->setPadding(3, 3, 3, 3);
|
||||
$plot->title->move(-20, 25);
|
||||
|
||||
$plot->setSpace(4, 4, 10, 0);
|
||||
$plot->setPadding(25, 15, 10, 18);
|
||||
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(210, 210, 210),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$plot->setColor(new Color(0, 0, 150, 20));
|
||||
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(150, 150, 210),
|
||||
new Color(245, 245, 245),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$plot->mark->setType(Mark::CIRCLE);
|
||||
$plot->mark->border->show();
|
||||
|
||||
$y = array(
|
||||
'Lundi',
|
||||
'Mardi',
|
||||
'Mercredi',
|
||||
'Jeudi',
|
||||
'Vendredi',
|
||||
'Samedi',
|
||||
'Dimanche'
|
||||
);
|
||||
|
||||
$plot->xAxis->setLabelText($y);
|
||||
$plot->xAxis->label->setFont(new Tuffy(7));
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
62
artichow/examples/site/line-002.php
Normal file
62
artichow/examples/site/line-002.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
4, 3, 1, 0, -2, 1, 3, 2, 3, 5, 4, 1
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setXAxisZero(FALSE);
|
||||
|
||||
$plot->grid->hide(TRUE);
|
||||
|
||||
$plot->title->set("Using dashed line and legend");
|
||||
$plot->title->setFont(new TuffyItalic(9));
|
||||
$plot->title->setBackgroundColor(new Color(255, 255, 255, 50));
|
||||
$plot->title->setPadding(3, 3, 3, 3);
|
||||
$plot->title->move(0, 20);
|
||||
|
||||
$plot->setSpace(6, 6, 10, 10);
|
||||
$plot->setPadding(30, 10, 15, 25);
|
||||
|
||||
$plot->setBackgroundColor(
|
||||
new Color(245, 245, 245)
|
||||
);
|
||||
|
||||
$plot->setStyle(Line::DASHED);
|
||||
$plot->setColor(new Color(0, 150, 0, 20));
|
||||
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(220, 220, 150, 40),
|
||||
new Color(255, 255, 210, 30),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$graph->shadow->setSize(4);
|
||||
$graph->shadow->setPosition(Shadow::LEFT_BOTTOM);
|
||||
$graph->shadow->smooth(TRUE);
|
||||
|
||||
$plot->legend->add($plot, "Apples");
|
||||
$plot->legend->shadow->setSize(0);
|
||||
$plot->legend->setAlign(Legend::CENTER, Legend::TOP);
|
||||
$plot->legend->setPosition(0.75, 0.60);
|
||||
$plot->legend->setTextFont(new Tuffy(8));
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
70
artichow/examples/site/line-003.php
Normal file
70
artichow/examples/site/line-003.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
$graph = new Graph(280, 200);
|
||||
|
||||
$x = array();
|
||||
for($i = 115; $i < 115 + 180; $i++) {
|
||||
$x[] = cos($i / 25);
|
||||
}
|
||||
|
||||
function format($value) {
|
||||
return sprintf("%.1f", $value).' %';
|
||||
}
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
|
||||
$plot->setBackgroundColor(
|
||||
new Color(240, 240, 240)
|
||||
);
|
||||
|
||||
$plot->setPadding(40, 15, 15, 15);
|
||||
|
||||
$plot->setColor(
|
||||
new Color(60, 60, 150)
|
||||
);
|
||||
|
||||
$plot->setFillColor(
|
||||
new Color(120, 175, 80, 47)
|
||||
);
|
||||
|
||||
$plot->grid->setType(Line::DASHED);
|
||||
|
||||
$plot->yAxis->setLabelNumber(6);
|
||||
$plot->yAxis->setLabelPrecision(1);
|
||||
$plot->yAxis->setNumberByTick('minor', 'major', 1);
|
||||
$plot->yAxis->label->setCallbackFunction('format');
|
||||
$plot->yAxis->label->setFont(new Tuffy(7));
|
||||
|
||||
$plot->xAxis->setNumberByTick('minor', 'major', 3);
|
||||
$plot->xAxis->label->hideFirst(TRUE);
|
||||
$plot->xAxis->setLabelInterval(50);
|
||||
$plot->xAxis->label->setFont(new Tuffy(7));
|
||||
|
||||
$plot->grid->setInterval(1, 50);
|
||||
|
||||
$graph->shadow->setSize(4);
|
||||
$graph->shadow->setPosition(Shadow::RIGHT_BOTTOM);
|
||||
$graph->shadow->smooth(TRUE);
|
||||
|
||||
$plot->label->set($x);
|
||||
$plot->label->setInterval(25);
|
||||
$plot->label->hideFirst(TRUE);
|
||||
$plot->label->setPadding(1, 1, 1, 1);
|
||||
$plot->label->setCallbackFunction('format');
|
||||
$plot->label->setBackgroundColor(
|
||||
new Color(227, 223, 241, 15)
|
||||
);
|
||||
$plot->label->setFont(new Tuffy(7));
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
104
artichow/examples/site/line-004.php
Normal file
104
artichow/examples/site/line-004.php
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
require_once "../../BarPlot.class.php";
|
||||
|
||||
|
||||
|
||||
$graph = new Graph(600, 250);
|
||||
|
||||
$graph->setBackgroundColor(new Color(0xF4, 0xF4, 0xF4));
|
||||
$graph->shadow->setSize(3);
|
||||
|
||||
$graph->title->set("Evolution");
|
||||
$graph->title->setFont(new Tuffy(15));
|
||||
$graph->title->setColor(new Color(0x00, 0x00, 0x8B));
|
||||
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setSize(0.82, 1);
|
||||
$group->setCenter(0.41, 0.5);
|
||||
$group->setPadding(35, 26, 40, 27);
|
||||
$group->setSpace(2, 2);
|
||||
|
||||
$group->grid->setColor(new Color(0xC4, 0xC4, 0xC4));
|
||||
$group->grid->setType(Line::DASHED);
|
||||
$group->grid->hideVertical(TRUE);
|
||||
$group->grid->setBackgroundColor(new White);
|
||||
|
||||
$group->axis->left->setColor(new DarkGreen);
|
||||
$group->axis->left->label->setFont(new Font2);
|
||||
|
||||
$group->axis->right->setColor(new DarkBlue);
|
||||
$group->axis->right->label->setFont(new Font2);
|
||||
|
||||
$group->axis->bottom->label->setFont(new Font2);
|
||||
|
||||
$group->legend->setPosition(1.18);
|
||||
$group->legend->setTextFont(new Tuffy(8));
|
||||
$group->legend->setSpace(10);
|
||||
|
||||
// Add a bar plot
|
||||
$x = array(16, 16, 12, 13, 11, 18, 10, 12, 11, 12, 11, 16);
|
||||
|
||||
$plot = new BarPlot($x, 1, 2);
|
||||
$plot->setBarColor(new MidYellow);
|
||||
$plot->setBarPadding(0.15, 0.15);
|
||||
$plot->barShadow->setSize(3);
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
$plot->barShadow->setColor(new Color(200, 200, 200, 10));
|
||||
$plot->move(1, 0);
|
||||
|
||||
$group->legend->add($plot, "Yellow bar", Legend::BACKGROUND);
|
||||
$group->add($plot);
|
||||
|
||||
// Add a bar plot
|
||||
$x = array(20, 25, 20, 18, 16, 25, 29, 12, 15, 18, 21, 26);
|
||||
|
||||
$plot = new BarPlot($x, 2, 2);
|
||||
$plot->setBarColor(new Color(120, 175, 80, 10));
|
||||
$plot->setBarPadding(0.15, 0.15);
|
||||
$plot->barShadow->setSize(3);
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
$plot->barShadow->setColor(new Color(200, 200, 200, 10));
|
||||
|
||||
$group->legend->add($plot, "Green bar", Legend::BACKGROUND);
|
||||
$group->add($plot);
|
||||
|
||||
// Add a second bar plot
|
||||
$x = array(12, 14, 10, 9, 10, 16, 12, 8, 8, 10, 12, 13);
|
||||
|
||||
$plot = new BarPlot($x, 2, 2);
|
||||
$plot->setBarColor(new Orange);
|
||||
$plot->setBarPadding(0.15, 0.15);
|
||||
|
||||
$group->legend->add($plot, "Orange bar", Legend::BACKGROUND);
|
||||
$group->add($plot);
|
||||
|
||||
// Add a line plot
|
||||
$x = array(6, 5, 6, 5.5, 4.5, 4, 4.5, 4, 5, 4, 5, 5.5);
|
||||
|
||||
$plot = new LinePlot($x, LinePlot::MIDDLE);
|
||||
$plot->setColor(new DarkBlue);
|
||||
$plot->setThickness(5);
|
||||
$plot->setYAxis(Plot::RIGHT);
|
||||
$plot->setYMax(12);
|
||||
|
||||
$plot->mark->setType(Mark::CIRCLE);
|
||||
$plot->mark->setSize(6);
|
||||
$plot->mark->setFill(new LightBlue);
|
||||
$plot->mark->border->show();
|
||||
|
||||
$group->legend->add($plot, "Blue line", Legend::MARK);
|
||||
$group->add($plot);
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
58
artichow/examples/site/line-006.php
Normal file
58
artichow/examples/site/line-006.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
-4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setStyle(Line::DASHED);
|
||||
|
||||
$plot->setSpace(4, 4, 10, 0);
|
||||
$plot->setPadding(25, 15, 10, 18);
|
||||
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(230, 230, 230),
|
||||
new Color(255, 255, 255),
|
||||
90
|
||||
)
|
||||
);
|
||||
|
||||
$plot->setFilledArea(7, 9, new Red(25));
|
||||
$plot->setFilledArea(1, 4, new Yellow(25));
|
||||
|
||||
$plot->setColor(new Color(0, 0, 150, 20));
|
||||
|
||||
$plot->grid->setColor(new VeryLightGray);
|
||||
|
||||
$plot->mark->setType(Mark::SQUARE);
|
||||
$plot->mark->setSize(4);
|
||||
$plot->mark->setFill(new VeryDarkGreen(30));
|
||||
$plot->mark->border->show();
|
||||
$plot->mark->border->setColor(new DarkBlue(60));
|
||||
|
||||
$plot->xAxis->label->hide(TRUE);
|
||||
$plot->xAxis->setNumberByTick('minor', 'major', 3);
|
||||
|
||||
$plot->yAxis->setLabelNumber(8);
|
||||
|
||||
$plot->legend->add($plot, "My line");
|
||||
$plot->legend->setPosition(0.9, 0.77);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
70
artichow/examples/site/line-007.php
Normal file
70
artichow/examples/site/line-007.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 200);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->grid->setType(Line::DASHED);
|
||||
|
||||
$group->setPadding(40, NULL, 20, NULL);
|
||||
|
||||
$group->axis->left->setLabelNumber(8);
|
||||
$group->axis->left->setLabelPrecision(1);
|
||||
$group->axis->left->setTickStyle(Tick::OUT);
|
||||
|
||||
$x = array(2, 4, 8, 16, 32, 48, 56, 60, 62);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setColor(new Orange());
|
||||
$plot->setFillColor(new LightOrange(80));
|
||||
|
||||
$plot->mark->setType(Mark::CIRCLE);
|
||||
$plot->mark->setFill(new MidRed);
|
||||
$plot->mark->setSize(6);
|
||||
|
||||
$group->legend->add($plot, "John", Legend::MARK);
|
||||
$group->add($plot);
|
||||
|
||||
$x = array(NULL, NULL, NULL, 10, 12, 14, 18, 26, 42);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setColor(new Color(120, 120, 30, 10));
|
||||
$plot->setFillColor(new Color(120, 120, 60, 90));
|
||||
|
||||
$plot->mark->setType(Mark::SQUARE);
|
||||
$plot->mark->setFill(new DarkGreen);
|
||||
$plot->mark->setSize(5);
|
||||
|
||||
$group->add($plot);
|
||||
|
||||
function setYear($value) {
|
||||
return $value + 2000;
|
||||
}
|
||||
|
||||
$group->axis->bottom->label->setCallbackFunction('setYear');
|
||||
|
||||
function setK($value) {
|
||||
return round($value).'K';
|
||||
}
|
||||
|
||||
$group->axis->left->label->setCallbackFunction('setK');
|
||||
|
||||
$group->legend->add($plot, "George", Legend::MARK);
|
||||
$group->legend->setPosition(0.45, 0.25);
|
||||
$group->legend->shadow->smooth(TRUE);
|
||||
|
||||
$graph->add($group);
|
||||
|
||||
$graph->draw();
|
||||
?>
|
||||
51
artichow/examples/site/logo.php
Normal file
51
artichow/examples/site/logo.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(500, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
$graph->border->hide();
|
||||
|
||||
$x = array();
|
||||
for($i = 0; $i < 20; $i++) {
|
||||
$x[] = mt_rand(4, 12);
|
||||
}
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
|
||||
$plot->setSpace(0, 0, 50, 0);
|
||||
$plot->setPadding(3, 3, 3, 3);
|
||||
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(230, 230, 230),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$plot->setColor(new Color(0, 0, 180, 20));
|
||||
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(220, 220, 230, 25),
|
||||
new Color(240, 240, 255, 25),
|
||||
90
|
||||
)
|
||||
);
|
||||
|
||||
$plot->xAxis->hide(TRUE);
|
||||
$plot->yAxis->hide(TRUE);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
45
artichow/examples/site/math-001.php
Normal file
45
artichow/examples/site/math-001.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../MathPlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 300);
|
||||
|
||||
$plot = new MathPlot(-3, 3, 3, -3);
|
||||
$plot->setInterval(0.2);
|
||||
$plot->setPadding(NULL, NULL, NULL, 20);
|
||||
|
||||
$function = new MathFunction('cos');
|
||||
$function->setColor(new DarkGreen);
|
||||
$function->mark->setType(Mark::SQUARE);
|
||||
$function->mark->setSize(3);
|
||||
$plot->add($function, "f(x) = cos(x)", Legend::MARK);
|
||||
|
||||
$function = new MathFunction('exp');
|
||||
$function->setColor(new DarkRed);
|
||||
$function->mark->setType(Mark::SQUARE);
|
||||
$function->mark->setSize(3);
|
||||
$function->mark->setFill(new DarkBlue);
|
||||
$plot->add($function, "f(x) = exp(x)", Legend::MARK);
|
||||
|
||||
function x2($x) {
|
||||
return - $x * $x + 0.5;
|
||||
}
|
||||
|
||||
$function = new MathFunction('x2');
|
||||
$function->setColor(new DarkBlue);
|
||||
$plot->add($function, "f(x) = - x * x + 0.5");
|
||||
|
||||
$plot->legend->setPosition(0.9, 0.8);
|
||||
$plot->legend->setPadding(3, 3, 3, 3, 3);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
60
artichow/examples/site/mini-001.php
Normal file
60
artichow/examples/site/mini-001.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
0, 2, 5, 2, 3, 8
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setXAxisZero(FALSE);
|
||||
$plot->grid->setNobackground();
|
||||
|
||||
$plot->setSpace(6, 6, 10, 10);
|
||||
$plot->setPadding(30, 6, 8, 18);
|
||||
|
||||
// Set a background gradient
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(210, 210, 210),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
// Change line color
|
||||
$plot->setColor(new Color(0, 0, 150, 20));
|
||||
|
||||
// Set line background gradient
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(150, 150, 210),
|
||||
new Color(230, 230, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
// Change mark type
|
||||
$plot->mark->setType(Mark::CIRCLE);
|
||||
$plot->mark->border->show();
|
||||
$plot->mark->setSize(6);
|
||||
|
||||
$plot->yAxis->setLabelPrecision(1);
|
||||
$plot->yAxis->label->setFont(new Font1);
|
||||
$plot->xAxis->label->setFont(new Font1);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
50
artichow/examples/site/mini-002.php
Normal file
50
artichow/examples/site/mini-002.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
1, 2, 5, 0.5, 3, 8, 7, 6, 2, -4
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->grid->setNobackground();
|
||||
$plot->setPadding(20, 8, 8, 20);
|
||||
$plot->setXAxisZero(FALSE);
|
||||
|
||||
// Set a background gradient
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(210, 210, 210),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
// Set semi-transparent background gradient
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(230, 150, 150, 20),
|
||||
new Color(230, 230, 180, 50),
|
||||
90
|
||||
)
|
||||
);
|
||||
|
||||
$plot->xAxis->label->hideFirst(TRUE);
|
||||
$plot->xAxis->label->hideLast(TRUE);
|
||||
$plot->xAxis->setNumberByTick('minor', 'major', 2);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
56
artichow/examples/site/mini-003.php
Normal file
56
artichow/examples/site/mini-003.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 8; $i++) {
|
||||
$x[] = cos($i / 3 * M_PI) + mt_rand(-10, 10) / 40;
|
||||
}
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setPadding(22, 5, 25, 8);
|
||||
|
||||
// Hide grid
|
||||
$plot->grid->setType(Line::DASHED);
|
||||
|
||||
// Change background color
|
||||
$plot->setBackgroundColor(new Color(240, 240, 240, 50));
|
||||
|
||||
// Set Y on both left and rights sides
|
||||
$plot->setYAxis(Plot::BOTH);
|
||||
|
||||
// Change line properties
|
||||
$plot->setColor(new Color(0, 0, 0));
|
||||
$plot->setFillColor(new Color(240, 190, 130, 50));
|
||||
|
||||
// Chenge ticks and labels interval
|
||||
$plot->xAxis->setTickInterval(2);
|
||||
$plot->xAxis->label->hide(TRUE);
|
||||
$plot->xAxis->setNumberByTick('minor', 'major', 1);
|
||||
|
||||
// Hide first and last values on X axis
|
||||
$plot->xAxis->label->hideFirst(TRUE);
|
||||
$plot->xAxis->label->hideLast(TRUE);
|
||||
|
||||
// Add a title
|
||||
$plot->title->set("Random values");
|
||||
$plot->title->move(0, 2);
|
||||
$plot->title->setFont(new Tuffy(8));
|
||||
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
|
||||
$plot->title->border->show();
|
||||
$plot->title->setPadding(2, 2, 2, 2);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
59
artichow/examples/site/mini-004.php
Normal file
59
artichow/examples/site/mini-004.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array(
|
||||
1, 2, 5, 4, 2, 3
|
||||
);
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
|
||||
// Change component padding
|
||||
$plot->setPadding(10, 12, 12, 7);
|
||||
|
||||
// Set a background gradient
|
||||
$plot->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new Color(230, 230, 230),
|
||||
new Color(255, 255, 255),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
// Change line background color
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(200, 240, 215, 30),
|
||||
new Color(150, 190, 165, 30),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
// Hide grid
|
||||
$plot->grid->hide(TRUE);
|
||||
$plot->grid->setNobackground();
|
||||
|
||||
$plot->yAxis->label->hide(TRUE);
|
||||
$plot->xAxis->label->hide(TRUE);
|
||||
|
||||
$plot->label->set($x);
|
||||
$plot->label->setBackgroundColor(new Color(240, 240, 240, 10));
|
||||
$plot->label->border->setColor(new Color(255, 0, 0, 15));
|
||||
$plot->label->setPadding(3, 2, 0, 0);
|
||||
$plot->label->setFont(new Font1);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
46
artichow/examples/site/mini-005.php
Normal file
46
artichow/examples/site/mini-005.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$x = array();
|
||||
for($i = 0; $i < 10; $i++) {
|
||||
$x[] = mt_rand(1, 99) / 10;
|
||||
}
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setBackgroundColor(new Color(240, 240, 240));
|
||||
$plot->setPadding(30, 8, 8, 20);
|
||||
|
||||
$plot->setColor(
|
||||
new Color(60, 60, 150)
|
||||
);
|
||||
$plot->setFillGradient(
|
||||
new LinearGradient(
|
||||
new Color(120, 175, 80, 47),
|
||||
new Color(231, 172, 113, 30),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$plot->grid->setType(Line::DASHED);
|
||||
|
||||
$plot->yAxis->setLabelNumber(2);
|
||||
$plot->yAxis->setLabelPrecision(1);
|
||||
|
||||
$plot->xAxis->setLabelInterval(2);
|
||||
$plot->xAxis->setNumberByTick('minor', 'major', 2);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
?>
|
||||
53
artichow/examples/site/mini-006.php
Normal file
53
artichow/examples/site/mini-006.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../LinePlot.class.php";
|
||||
|
||||
// Return a random color
|
||||
function color($a = NULL) {
|
||||
return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a);
|
||||
}
|
||||
|
||||
function formatLabel($value) {
|
||||
return sprintf("%.2f", $value);
|
||||
}
|
||||
|
||||
$graph = new Graph(150, 100);
|
||||
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setXAxisZero(FALSE);
|
||||
$group->setBackgroundColor(new Color(197, 180, 210, 80));
|
||||
|
||||
$group->setPadding(25, 10, 10, 20);
|
||||
|
||||
$group->axis->left->setLabelNumber(2);
|
||||
$group->axis->left->setLabelPrecision(1);
|
||||
|
||||
// Display two lines
|
||||
for($n = 0; $n < 2; $n++) {
|
||||
|
||||
$x = array();
|
||||
|
||||
for($i = 0; $i < 10; $i++) {
|
||||
$x[] = (cos($i * M_PI / 5)) / ($n + 1);
|
||||
}
|
||||
|
||||
$plot = new LinePlot($x);
|
||||
$plot->setColor(color(10)); // Random line color
|
||||
$plot->setFillColor(color(90)); // Random background color
|
||||
|
||||
$group->add($plot);
|
||||
|
||||
}
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
?>
|
||||
42
artichow/examples/site/pie-001.php
Normal file
42
artichow/examples/site/pie-001.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../Pie.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$graph->title->set("Stats");
|
||||
$graph->title->setFont(new TuffyItalic(16));
|
||||
|
||||
$values = array(8, 4, 6, 2, 5, 3, 4);
|
||||
|
||||
$plot = new Pie($values, Pie::EARTH);
|
||||
$plot->setCenter(0.4, 0.55);
|
||||
$plot->setSize(0.7, 0.6);
|
||||
$plot->set3D(10);
|
||||
$plot->explode(array(1 => 14, 4 => 20, 0 => 10));
|
||||
|
||||
$plot->setLegend(array(
|
||||
'Mon',
|
||||
'Tue',
|
||||
'Wed',
|
||||
'Thu',
|
||||
'Fri',
|
||||
'Sat',
|
||||
'Sun'
|
||||
));
|
||||
|
||||
$plot->legend->setPosition(1.3);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
50
artichow/examples/site/pie-002.php
Normal file
50
artichow/examples/site/pie-002.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../Pie.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
$graph->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new White,
|
||||
new VeryLightGray(40),
|
||||
0
|
||||
)
|
||||
);
|
||||
$graph->title->set("Horses");
|
||||
$graph->shadow->setSize(5);
|
||||
$graph->shadow->smooth(TRUE);
|
||||
$graph->shadow->setPosition(Shadow::LEFT_BOTTOM);
|
||||
$graph->shadow->setColor(new DarkGray);
|
||||
|
||||
$values = array(8, 4, 6, 2, 5);
|
||||
|
||||
$plot = new Pie($values);
|
||||
$plot->setCenter(0.35, 0.55);
|
||||
$plot->setSize(0.7, 0.6);
|
||||
$plot->set3D(10);
|
||||
$plot->setLabelPosition(10);
|
||||
|
||||
$plot->setLegend(array(
|
||||
'France',
|
||||
'Spain',
|
||||
'Italy',
|
||||
'Germany',
|
||||
'England'
|
||||
));
|
||||
|
||||
$plot->legend->setPosition(1.40);
|
||||
$plot->legend->shadow->setSize(0);
|
||||
$plot->legend->setBackgroundColor(new VeryLightGray(30));
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
52
artichow/examples/site/pie-003.php
Normal file
52
artichow/examples/site/pie-003.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../Pie.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$graph->title->set("Customized colors");
|
||||
$graph->title->setFont(new Tuffy(12));
|
||||
$graph->title->move(80, 10);
|
||||
|
||||
$values = array(16, 9, 13, 23);
|
||||
$colors = array(
|
||||
new LightOrange,
|
||||
new LightPurple,
|
||||
new LightBlue,
|
||||
new LightRed,
|
||||
new LightPink
|
||||
);
|
||||
|
||||
$plot = new Pie($values, $colors);
|
||||
$plot->setCenter(0.3, 0.53);
|
||||
$plot->setAbsSize(200, 200);
|
||||
$plot->setBorderColor(new White);
|
||||
$plot->setStartAngle(234);
|
||||
|
||||
$plot->setLegend(array(
|
||||
'Arthur',
|
||||
'Abel',
|
||||
'Pascal',
|
||||
'Thamer'
|
||||
));
|
||||
|
||||
$plot->setLabelPosition(-40);
|
||||
$plot->label->setPadding(2, 2, 2, 2);
|
||||
$plot->label->setFont(new Tuffy(7));
|
||||
$plot->label->setBackgroundColor(new White(60));
|
||||
|
||||
$plot->legend->setPosition(1.38);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
53
artichow/examples/site/pie-004.php
Normal file
53
artichow/examples/site/pie-004.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../Pie.class.php";
|
||||
|
||||
|
||||
$graph = new Graph(300, 175);
|
||||
$graph->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new VeryLightGray(40),
|
||||
new White,
|
||||
90
|
||||
)
|
||||
);
|
||||
$graph->title->set("Arbitrary labels");
|
||||
$graph->title->setAngle(90);
|
||||
$graph->title->move(120, NULL);
|
||||
|
||||
$values = array(8, 4, 6, 2, 5, 3, 4);
|
||||
|
||||
$plot = new Pie($values);
|
||||
$plot->setCenter(0.45, 0.5);
|
||||
$plot->setSize(0.55, 0.55 * 300 / 175);
|
||||
|
||||
$plot->label->set(array(
|
||||
'Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe'
|
||||
));
|
||||
|
||||
$plot->label->setCallbackFunction(NULL); // We must disable the default callback function
|
||||
$plot->setLabelPosition(10);
|
||||
|
||||
$plot->setLegend(array(
|
||||
'ABC',
|
||||
'DEF',
|
||||
'GHI',
|
||||
'JKL',
|
||||
'MNO',
|
||||
'PQR',
|
||||
'STU'
|
||||
));
|
||||
|
||||
$plot->legend->hide(TRUE);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
51
artichow/examples/site/pie-005.php
Normal file
51
artichow/examples/site/pie-005.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/*
|
||||
* This work is hereby released into the Public Domain.
|
||||
* To view a copy of the public domain dedication,
|
||||
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
|
||||
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once "../../Pie.class.php";
|
||||
|
||||
function createPie($values, $title, $x, $y) {
|
||||
|
||||
$plot = new Pie($values, Pie::EARTH);
|
||||
$plot->title->set($title);
|
||||
$plot->title->setFont(new TuffyBold(9));
|
||||
$plot->title->move(NULL, -12);
|
||||
|
||||
$plot->label->setFont(new Tuffy(7));
|
||||
$plot->legend->hide(TRUE);
|
||||
$plot->setLabelPosition(5);
|
||||
$plot->setSize(0.48, 0.35);
|
||||
$plot->setCenter($x, $y);
|
||||
$plot->set3D(8);
|
||||
$plot->setBorderColor(new White);
|
||||
|
||||
return $plot;
|
||||
|
||||
}
|
||||
|
||||
$graph = new Graph(280, 350);
|
||||
$graph->setAntiAliasing(TRUE);
|
||||
|
||||
$plot = createPie(array(1, 4, 5, 2, 3), "Cowléoptère", 0.25, 0.24);
|
||||
$graph->add($plot);
|
||||
|
||||
$plot = createPie(array(1, 9, 1, 2, 1), "Asticow", 0.75, 0.24);
|
||||
$graph->add($plot);
|
||||
|
||||
$plot = createPie(array(5, 7, 8, 6, 3), "Cowlibri", 0.25, 0.65);
|
||||
$graph->add($plot);
|
||||
|
||||
$plot = createPie(array(6, 4, 6, 5, 6), "Bourricow", 0.75, 0.65);
|
||||
$plot->legend->setModel(Legend::MODEL_BOTTOM);
|
||||
$plot->setLegend(array('plip', 'plop', 'plap', 'plup', 'plep'));
|
||||
$plot->legend->hide(FALSE); // We print only one legend
|
||||
$plot->legend->setPosition(0, 1.10);
|
||||
$graph->add($plot);
|
||||
|
||||
$graph->draw();
|
||||
?>
|
||||
69
artichow/examples/site/scatter-001.php
Normal file
69
artichow/examples/site/scatter-001.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
require_once "../../ScatterPlot.class.php";
|
||||
|
||||
$graph = new Graph(280, 280);
|
||||
|
||||
$graph->title->move(-40, 0);
|
||||
$graph->title->set('Two circles');
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setBackgroundGradient(
|
||||
new LinearGradient(
|
||||
new VeryLightGray,
|
||||
new Color(245, 245, 245),
|
||||
0
|
||||
)
|
||||
);
|
||||
|
||||
$group->setPadding(25, 20, 40, 15);
|
||||
$group->setSpace(5, 5, 5, 5);
|
||||
|
||||
$group->legend->setPosition(0.82, 0.1);
|
||||
$group->legend->setAlign(Legend::CENTER, Legend::MIDDLE);
|
||||
|
||||
function getCircle($size) {
|
||||
|
||||
$center = 0;
|
||||
|
||||
$x = array();
|
||||
$y = array();
|
||||
|
||||
for($i = 0; $i <= 20; $i++) {
|
||||
$rad = ($i / 20) * 2 * M_PI;
|
||||
$x[] = $center + cos($rad) * $size;
|
||||
$y[] = $center + sin($rad) * $size;
|
||||
}
|
||||
|
||||
return array($x, $y);
|
||||
|
||||
}
|
||||
|
||||
list($x, $y) = getCircle(3);
|
||||
|
||||
$plot = new ScatterPlot($y, $x);
|
||||
|
||||
$plot->link(TRUE, new DarkBlue);
|
||||
|
||||
$plot->mark->setFill(new DarkPink);
|
||||
$plot->mark->setType(Mark::CIRCLE, 6);
|
||||
|
||||
$group->legend->add($plot, 'Circle #1', Legend::MARK);
|
||||
$group->add($plot);
|
||||
|
||||
list($x, $y) = getCircle(5);
|
||||
|
||||
$plot = new ScatterPlot($y, $x);
|
||||
|
||||
$plot->link(TRUE, new DarkGreen);
|
||||
|
||||
$plot->mark->setFill(new DarkOrange);
|
||||
$plot->mark->setType(Mark::SQUARE, 4);
|
||||
|
||||
$group->legend->add($plot, 'Circle #2', Legend::MARK);
|
||||
$group->add($plot);
|
||||
|
||||
$graph->add($group);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
30
artichow/examples/site/scatter-002.php
Normal file
30
artichow/examples/site/scatter-002.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
require_once "../../ScatterPlot.class.php";
|
||||
|
||||
$graph = new Graph(300, 240);
|
||||
|
||||
$graph->title->set('Simple ScatterPlot');
|
||||
$graph->shadow->setSize(4);
|
||||
|
||||
$y = array(1, 1.3, 1.8, 1.6, 10, 7, 8, 3, 4, 2, 4);
|
||||
$x = array(0.5, 0.7, 0.65, 0.9, 0.5, 1.5, 4, 3, 5, 2, 2);
|
||||
|
||||
$plot = new ScatterPlot($y, $x);
|
||||
$plot->setBackgroundColor(new Color(255, 245, 220));
|
||||
|
||||
$plot->mark->setSize(15);
|
||||
$plot->mark->setFill(
|
||||
new RadialGradient(
|
||||
new LightRed,
|
||||
new Red
|
||||
)
|
||||
);
|
||||
|
||||
$plot->setSpace(6, 6, 6, 0);
|
||||
$plot->setPadding(25, NULL, 40, 20);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
34
artichow/examples/site/scatter-003.php
Normal file
34
artichow/examples/site/scatter-003.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
require_once "../../ScatterPlot.class.php";
|
||||
|
||||
$graph = new Graph(300, 280);
|
||||
|
||||
$graph->title->set('Linked ScatterPlot');
|
||||
$graph->title->setFont(new TuffyItalic(14));
|
||||
$graph->shadow->setSize(4);
|
||||
|
||||
$y = array(1, 10, 7, 8, 5, 4, 2, 4);
|
||||
$x = array(0.5, 0.5, 1.5, 4, 3, 5, 2, 2);
|
||||
|
||||
$plot = new ScatterPlot($y, $x);
|
||||
$plot->setBackgroundColor(new Color(235, 235, 235));
|
||||
|
||||
$plot->mark->setSize(15);
|
||||
$plot->mark->setFill(
|
||||
new RadialGradient(
|
||||
new LightGreen,
|
||||
new DarkGreen
|
||||
)
|
||||
);
|
||||
|
||||
$plot->link(TRUE);
|
||||
$plot->setColor(new DarkGreen);
|
||||
|
||||
$plot->setSpace(6, 6, 6, 0);
|
||||
$plot->setPadding(25, NULL, 40, 20);
|
||||
|
||||
$graph->add($plot);
|
||||
$graph->draw();
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue