mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
initial import
This commit is contained in:
85
lib/classes/graphik/patterns/BarDepth.php
Normal file
85
lib/classes/graphik/patterns/BarDepth.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?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 ARTICHOW."/BarPlot.class.php";
|
||||
|
||||
class BarDepthPattern extends Pattern {
|
||||
|
||||
protected function getPlot($y, $depth) {
|
||||
|
||||
$plot = new BarPlot($y, 1, 1, $depth);
|
||||
|
||||
$plot->barShadow->setSize(2);
|
||||
$plot->barShadow->smooth(TRUE);
|
||||
$plot->barShadow->setColor(new Color(160, 160, 160, 10));
|
||||
|
||||
return $plot;
|
||||
|
||||
}
|
||||
|
||||
public function create() {
|
||||
|
||||
$group = new PlotGroup;
|
||||
$group->setSpace(2, 2, 2, 0);
|
||||
$group->setPadding(30, 10, NULL, NULL);
|
||||
|
||||
$group->grid->hideVertical(TRUE);
|
||||
$group->grid->setType(Line::DASHED);
|
||||
|
||||
$yForeground = $this->getArg('yForeground');
|
||||
$yBackground = $this->getArg('yBackground');
|
||||
|
||||
$legendForeground = $this->getArg('legendForeground');
|
||||
$legendBackground = $this->getArg('legendBackground');
|
||||
|
||||
$colorForeground = $this->getArg('colorForeground', new LightBlue(10));
|
||||
$colorBackground = $this->getArg('colorBackground', new Orange(25));
|
||||
|
||||
if($yForeground === NULL) {
|
||||
awImage::drawError("Class BarDepthPattern: Argument 'yForeground' must not be NULL.");
|
||||
}
|
||||
|
||||
// Background
|
||||
if($yBackground !== NULL) {
|
||||
|
||||
$plot = $this->getPlot($yBackground, 6);
|
||||
$plot->setBarColor($colorBackground);
|
||||
|
||||
$group->add($plot);
|
||||
if($legendBackground !== NULL) {
|
||||
$group->legend->add($plot, $legendBackground, Legend::BACKGROUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Foreground
|
||||
$plot = $this->getPlot($yForeground, 0);
|
||||
$plot->setBarColor($colorForeground);
|
||||
|
||||
$group->add($plot);
|
||||
if($legendForeground !== NULL) {
|
||||
$group->legend->add($plot, $legendForeground, Legend::BACKGROUND);
|
||||
}
|
||||
|
||||
$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, 10));
|
||||
$group->legend->setColumns(2);
|
||||
|
||||
return $group;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
50
lib/classes/graphik/patterns/LightLine.php
Normal file
50
lib/classes/graphik/patterns/LightLine.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 ARTICHOW."/LinePlot.class.php";
|
||||
|
||||
class LightLinePattern extends Pattern {
|
||||
|
||||
public function create() {
|
||||
|
||||
$legend = $this->getArg('legend');
|
||||
|
||||
$y = $this->getArg('y');
|
||||
|
||||
if($y === NULL) {
|
||||
awImage::drawError("Class LightLinePattern: Argument 'y' must not be NULL.");
|
||||
}
|
||||
|
||||
$plot = new LinePlot($y);
|
||||
$plot->setSize(0.7, 1);
|
||||
$plot->setCenter(0.35, 0.5);
|
||||
$plot->setPadding(35, 15, 35, 30);
|
||||
$plot->setColor(new Orange());
|
||||
$plot->setFillColor(new LightOrange(80));
|
||||
|
||||
$plot->grid->setType(Line::DASHED);
|
||||
|
||||
$plot->mark->setType(Mark::CIRCLE);
|
||||
$plot->mark->setFill(new MidRed);
|
||||
$plot->mark->setSize(6);
|
||||
|
||||
$plot->legend->setPosition(1, 0.5);
|
||||
$plot->legend->setAlign(Legend::LEFT);
|
||||
$plot->legend->shadow->smooth(TRUE);
|
||||
|
||||
if($legend !== NULL) {
|
||||
$plot->legend->add($plot, $legend, Legend::MARK);
|
||||
}
|
||||
|
||||
return $plot;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user